This commit is contained in:
lyonbot committed 2025-01-02 13:11:22 +08:00
commit f109f3f2dd
18 files changed
+2521

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
# prod
dist/
# dev
.yarn/
!.yarn/releases
.vscode/*
!.vscode/launch.json
!.vscode/*.code-snippets
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/shelf
# deps
node_modules/
.wrangler
# env
.env
.env.production
.dev.vars
# logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# misc
.DS_Store
+19
View File
@@ -0,0 +1,19 @@
# cf-drop
A fast and simple tool to store and share temporary files via Cloudflare Workers.
```sh
pnpm install
npx wrangler r2 bucket create cf-drop
npx wrangler d1 create cf-drop
# copy the database_id to wrangler.toml
```
```
npm install
npm run dev
```
```
npm run deploy
```
+21
View File
@@ -0,0 +1,21 @@
{
"name": "cf-drop",
"scripts": {
"dev:cf": "wrangler dev",
"dev:web": "cd web && npm run dev",
"dev": "run-p -l dev:*",
"build": "cd web && npm run build",
"deploy": "wrangler deploy --minify"
},
"engines": {
"node": ">=20"
},
"dependencies": {
"hono": "^4.6.15"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20241230.0",
"npm-run-all": "^4.1.5",
"wrangler": "^3.96.0"
}
}
+2227
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -0,0 +1,2 @@
packages:
- web
+14
View File
@@ -0,0 +1,14 @@
import { Hono } from 'hono'
type Bindings = {
DB: D1Database
MY_BUCKET: R2Bucket
}
const app = new Hono<{ Bindings: Bindings }>()
app.get('/api/test', (c) => {
return c.text('Hello Hono')
})
export default app
+17
View File
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"skipLibCheck": true,
"lib": [
"ESNext"
],
"types": [
"@cloudflare/workers-types/2023-07-01"
],
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx"
},
}
+13
View File
@@ -0,0 +1,13 @@
# Local
.DS_Store
*.local
*.log*
# Dist
node_modules
dist/
# IDE
.vscode/*
!.vscode/extensions.json
.idea
+29
View File
@@ -0,0 +1,29 @@
# Rsbuild Project
## Setup
Install the dependencies:
```bash
pnpm install
```
## Get Started
Start the dev server:
```bash
pnpm dev
```
Build the app for production:
```bash
pnpm build
```
Preview the production build locally:
```bash
pnpm preview
```
+21
View File
@@ -0,0 +1,21 @@
{
"name": "web",
"private": true,
"version": "1.0.0",
"scripts": {
"dev": "rsbuild dev --open",
"build": "rsbuild build",
"preview": "rsbuild preview"
},
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@rsbuild/core": "^1.1.8",
"@rsbuild/plugin-react": "^1.0.7",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"typescript": "^5.7.2"
}
}
View File
Whitespace-only changes.
+11
View File
@@ -0,0 +1,11 @@
import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
export default defineConfig({
plugins: [pluginReact()],
server: {
proxy: {
'/api': 'http://localhost:8787'
}
}
});
+26
View File
@@ -0,0 +1,26 @@
body {
margin: 0;
color: #fff;
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
background-image: linear-gradient(to bottom, #020917, #101725);
}
.content {
display: flex;
min-height: 100vh;
line-height: 1.1;
text-align: center;
flex-direction: column;
justify-content: center;
}
.content h1 {
font-size: 3.6rem;
font-weight: 700;
}
.content p {
font-size: 1.2rem;
font-weight: 400;
opacity: 0.5;
}
+22
View File
@@ -0,0 +1,22 @@
import { useEffect, useState } from 'react';
import './App.css';
const App = () => {
const [msg, setMsg] = useState('Hello World');
useEffect(() => {
fetch('/api/test')
.then((res) => res.text())
.then((text) => setMsg(text));
}, []);
return (
<div className="content">
<h1>Rsbuild with React!</h1>
<p>Start building amazing things with Rsbuild.</p>
<p>Msg from API: {msg}</p>
</div>
);
};
export default App;
+1
View File
@@ -0,0 +1 @@
/// <reference types="@rsbuild/core/types" />
+13
View File
@@ -0,0 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
const rootEl = document.getElementById('root');
if (rootEl) {
const root = ReactDOM.createRoot(rootEl);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"lib": ["DOM", "ES2020"],
"jsx": "react-jsx",
"target": "ES2020",
"noEmit": true,
"skipLibCheck": true,
"useDefineForClassFields": true,
/* modules */
"module": "ESNext",
"isolatedModules": true,
"resolveJsonModule": true,
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
/* type checking */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": ["src"]
}
+29
View File
@@ -0,0 +1,29 @@
name = "cf-drop"
main = "src/index.ts"
compatibility_date = "2025-01-02"
assets = { directory = "web/dist" }
# compatibility_flags = [ "nodejs_compat" ]
[[d1_databases]]
binding = "DB"
database_name = "cf-drop"
database_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
[[r2_buckets]]
binding = "MY_BUCKET"
bucket_name = "cf-drop"
# [vars]
# MY_VAR = "my-variable"
# [[kv_namespaces]]
# binding = "MY_KV_NAMESPACE"
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# [ai]
# binding = "AI"
# [observability]
# enabled = true
# head_sampling_rate = 1