@icebreakers/monorepo 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/package.json +2 -2
- package/dist/{chunk-EBATUF3S.js → chunk-SC5QBYJ5.js} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/templates/apps/cli/bin/index.js +2 -0
- package/templates/apps/cli/dev/index.ts +2 -0
- package/templates/apps/cli/package.json +32 -0
- package/templates/apps/cli/src/cli.ts +3 -0
- package/templates/apps/cli/src/index.ts +0 -0
- package/templates/apps/cli/tsconfig.json +7 -0
- package/templates/apps/cli/tsup.config.ts +13 -0
- package/templates/apps/client/eslint.config.js +12 -0
- package/templates/apps/client/index.html +13 -0
- package/templates/apps/client/package.json +44 -0
- package/templates/apps/client/public/vite.svg +1 -0
- package/templates/apps/client/src/App.vue +9 -0
- package/templates/apps/client/src/main.ts +14 -0
- package/templates/apps/client/src/pages/index.vue +67 -0
- package/templates/apps/client/src/router/index.ts +13 -0
- package/templates/apps/client/src/stores/i18n.ts +23 -0
- package/templates/apps/client/src/stores/index.ts +15 -0
- package/templates/apps/client/src/style.css +1 -0
- package/templates/apps/client/src/trpc/index.ts +10 -0
- package/templates/apps/client/src/vite-env.d.ts +2 -0
- package/templates/apps/client/tsconfig.app.json +28 -0
- package/templates/apps/client/tsconfig.json +8 -0
- package/templates/apps/client/tsconfig.node.json +25 -0
- package/templates/apps/client/tsconfig.worker.json +11 -0
- package/templates/apps/client/vite.config.ts +40 -0
- package/templates/apps/client/worker/app.ts +24 -0
- package/templates/apps/client/worker/config.ts +1 -0
- package/templates/apps/client/worker/fetch-entry.ts +5 -0
- package/templates/apps/client/worker/node-entry.ts +12 -0
- package/templates/apps/client/worker/trpc-router.ts +24 -0
- package/templates/apps/client/worker-configuration.d.ts +7688 -0
- package/templates/apps/client/wrangler.jsonc +21 -0
- package/templates/apps/server/package.json +58 -0
- package/templates/apps/server/src/app.ts +191 -0
- package/templates/apps/server/src/config.ts +1 -0
- package/templates/apps/server/src/fetch-entry.ts +5 -0
- package/templates/apps/server/src/node-entry.ts +12 -0
- package/templates/apps/server/test/index.test.ts +14 -0
- package/templates/apps/server/tsconfig.json +24 -0
- package/templates/apps/server/tsup.config.ts +13 -0
- package/templates/apps/server/vitest.config.ts +15 -0
- package/templates/apps/server/worker-configuration.d.ts +7688 -0
- package/templates/apps/server/wrangler.jsonc +18 -0
- package/templates/apps/website/.vitepress/config.ts +93 -0
- package/templates/apps/website/.vitepress/theme/index.ts +4 -0
- package/templates/apps/website/.vitepress/theme/tailwind.css +1 -0
- package/templates/apps/website/index.md +151 -0
- package/templates/apps/website/monorepo/index.md +68 -0
- package/templates/apps/website/monorepo/manage.md +60 -0
- package/templates/apps/website/monorepo/publish.md +189 -0
- package/templates/apps/website/package.json +34 -0
- package/templates/apps/website/public/logo.jpg +0 -0
- package/templates/apps/website/thinking.md +88 -0
- package/templates/apps/website/tools/changeset.md +87 -0
- package/templates/apps/website/tools/husky.md +108 -0
- package/templates/apps/website/tools/lint-staged.md +79 -0
- package/templates/apps/website/tools/pnpm.md +100 -0
- package/templates/apps/website/tools/renovate.md +91 -0
- package/templates/apps/website/tools/turborepo.md +149 -0
- package/templates/apps/website/why/assets/npm-dt.svg +15 -0
- package/templates/apps/website/why/assets/npm-ts.svg +19 -0
- package/templates/apps/website/why/examples/0.npm-basic-package/index.js +9 -0
- package/templates/apps/website/why/examples/0.npm-basic-package/package.json +11 -0
- package/templates/apps/website/why/examples/1.npm-basic-package/index.cjs +11 -0
- package/templates/apps/website/why/examples/1.npm-basic-package/index.d.ts +1 -0
- package/templates/apps/website/why/examples/1.npm-basic-package/index.js +7 -0
- package/templates/apps/website/why/examples/1.npm-basic-package/package.json +19 -0
- package/templates/apps/website/why/examples/2.npm-basic-package/README.md +1 -0
- package/templates/apps/website/why/examples/2.npm-basic-package/package-lock.json +30 -0
- package/templates/apps/website/why/examples/2.npm-basic-package/package.json +35 -0
- package/templates/apps/website/why/examples/2.npm-basic-package/rename-ext.js +24 -0
- package/templates/apps/website/why/examples/2.npm-basic-package/src/index.ts +7 -0
- package/templates/apps/website/why/examples/2.npm-basic-package/tsconfig.cjs.json +8 -0
- package/templates/apps/website/why/examples/2.npm-basic-package/tsconfig.esm.json +7 -0
- package/templates/apps/website/why/examples/2.npm-basic-package/tsconfig.json +18 -0
- package/templates/apps/website/why/examples/3.npm-basic-package/README.md +1 -0
- package/templates/apps/website/why/examples/3.npm-basic-package/build.config.ts +24 -0
- package/templates/apps/website/why/examples/3.npm-basic-package/package-lock.json +3661 -0
- package/templates/apps/website/why/examples/3.npm-basic-package/package.json +32 -0
- package/templates/apps/website/why/examples/3.npm-basic-package/src/index.ts +7 -0
- package/templates/apps/website/why/examples/3.npm-basic-package/tsconfig.json +16 -0
- package/templates/apps/website/why/examples/3.npm-basic-package/tsup.config.ts +16 -0
- package/templates/apps/website/why/examples/usage-cjs/cjs.cjs +3 -0
- package/templates/apps/website/why/examples/usage-cjs/esm.mjs +3 -0
- package/templates/apps/website/why/examples/usage-cjs/index.js +11 -0
- package/templates/apps/website/why/examples/usage-cjs/package-lock.json +42 -0
- package/templates/apps/website/why/examples/usage-cjs/package.json +20 -0
- package/templates/apps/website/why/examples/usage-esm/cjs.cjs +3 -0
- package/templates/apps/website/why/examples/usage-esm/createRequire.js +7 -0
- package/templates/apps/website/why/examples/usage-esm/esm.mjs +3 -0
- package/templates/apps/website/why/examples/usage-esm/index.js +7 -0
- package/templates/apps/website/why/examples/usage-esm/package-lock.json +42 -0
- package/templates/apps/website/why/examples/usage-esm/package.json +21 -0
- package/templates/apps/website/why/how-to-reuse-js-code.md +250 -0
- package/templates/apps/website/why/index.md +1 -0
- package/templates/apps/website/why/js-cjs-mjs.md +99 -0
- package/templates/apps/website/why/js-keywords.md +132 -0
- package/templates/apps/website/why/modern/bundlers.md +79 -0
- package/templates/apps/website/why/modern/dts.md +93 -0
- package/templates/apps/website/why/modern/esm-vs-cjs.md +84 -0
- package/templates/apps/website/why/modern/index.md +55 -0
- package/templates/apps/website/why/modern/package-entry-points.md +128 -0
- package/templates/apps/website/why/modern/typescript.md +155 -0
- package/templates/apps/website/why/publish-basic-npm-package.md +146 -0
- package/templates/apps/website/why/what-is-npm-package.md +162 -0
- package/templates/packages/tsup-template/build.config.ts +24 -0
- package/templates/packages/tsup-template/package.json +42 -0
- package/templates/packages/tsup-template/src/index.ts +12 -0
- package/templates/packages/tsup-template/test/index.test.ts +7 -0
- package/templates/packages/tsup-template/tsconfig.json +15 -0
- package/templates/packages/tsup-template/tsup.config.ts +18 -0
- package/templates/packages/tsup-template/vitest.config.ts +15 -0
- package/templates/packages/unbuild-template/build.config.ts +24 -0
- package/templates/packages/unbuild-template/package.json +42 -0
- package/templates/packages/unbuild-template/src/index.ts +9 -0
- package/templates/packages/unbuild-template/src/utils.ts +3 -0
- package/templates/packages/unbuild-template/test/index.test.ts +7 -0
- package/templates/packages/unbuild-template/tsconfig.json +15 -0
- package/templates/packages/unbuild-template/vitest.config.ts +15 -0
- package/templates/packages/vue-lib-template/eslint.config.js +12 -0
- package/templates/packages/vue-lib-template/index.html +13 -0
- package/templates/packages/vue-lib-template/lib/HelloWorld.vue +21 -0
- package/templates/packages/vue-lib-template/lib/index.ts +3 -0
- package/templates/packages/vue-lib-template/package.json +61 -0
- package/templates/packages/vue-lib-template/src/App.vue +9 -0
- package/templates/packages/vue-lib-template/src/main.ts +8 -0
- package/templates/packages/vue-lib-template/src/pages/index.vue +7 -0
- package/templates/packages/vue-lib-template/src/router/index.ts +11 -0
- package/templates/packages/vue-lib-template/src/style.css +1 -0
- package/templates/packages/vue-lib-template/src/vite-env.d.ts +2 -0
- package/templates/packages/vue-lib-template/test/index.test.ts +13 -0
- package/templates/packages/vue-lib-template/tsconfig.app.json +30 -0
- package/templates/packages/vue-lib-template/tsconfig.json +14 -0
- package/templates/packages/vue-lib-template/tsconfig.node.json +25 -0
- package/templates/packages/vue-lib-template/tsconfig.test.json +40 -0
- package/templates/packages/vue-lib-template/vite.config.ts +47 -0
- package/templates/packages/vue-lib-template/vite.shared.config.ts +13 -0
- package/templates/packages/vue-lib-template/vitest.config.ts +13 -0
package/assets/package.json
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@commitlint/config-conventional": "^19.8.1",
|
|
47
47
|
"@commitlint/prompt-cli": "^19.8.1",
|
|
48
48
|
"@commitlint/types": "^19.8.1",
|
|
49
|
-
"@icebreakers/eslint-config": "^1.4.
|
|
49
|
+
"@icebreakers/eslint-config": "^1.4.4",
|
|
50
50
|
"@icebreakers/monorepo": "workspace:*",
|
|
51
51
|
"@icebreakers/stylelint-config": "^1.1.4",
|
|
52
52
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"cross-env": "^10.0.0",
|
|
57
57
|
"defu": "^6.1.4",
|
|
58
58
|
"es-toolkit": "^1.39.10",
|
|
59
|
-
"eslint": "^9.
|
|
59
|
+
"eslint": "^9.36.0",
|
|
60
60
|
"execa": "^9.6.0",
|
|
61
61
|
"fs-extra": "^11.3.2",
|
|
62
62
|
"husky": "^9.1.7",
|
|
@@ -375,7 +375,7 @@ import { fileURLToPath as fileURLToPath2 } from "url";
|
|
|
375
375
|
|
|
376
376
|
// package.json
|
|
377
377
|
var name = "@icebreakers/monorepo";
|
|
378
|
-
var version = "1.2.
|
|
378
|
+
var version = "1.2.2";
|
|
379
379
|
|
|
380
380
|
// src/constants.ts
|
|
381
381
|
var __filename2 = fileURLToPath2(import.meta.url);
|
package/dist/cli.cjs
CHANGED
|
@@ -234,7 +234,7 @@ var import_node_url = require("url");
|
|
|
234
234
|
|
|
235
235
|
// package.json
|
|
236
236
|
var name = "@icebreakers/monorepo";
|
|
237
|
-
var version = "1.2.
|
|
237
|
+
var version = "1.2.2";
|
|
238
238
|
|
|
239
239
|
// src/constants.ts
|
|
240
240
|
var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
|
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -407,7 +407,7 @@ var import_node_url = require("url");
|
|
|
407
407
|
|
|
408
408
|
// package.json
|
|
409
409
|
var name = "@icebreakers/monorepo";
|
|
410
|
-
var version = "1.2.
|
|
410
|
+
var version = "1.2.2";
|
|
411
411
|
|
|
412
412
|
// src/constants.ts
|
|
413
413
|
var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/monorepo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.2",
|
|
5
5
|
"description": "The icebreaker's monorepo manager",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"scripts": {
|
|
70
70
|
"dev": "tsup --watch --sourcemap",
|
|
71
71
|
"build": "tsup",
|
|
72
|
-
"test": "
|
|
72
|
+
"test": "vitest run",
|
|
73
73
|
"test:dev": "vitest",
|
|
74
74
|
"release": "pnpm publish",
|
|
75
75
|
"lint": "eslint .",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@icebreakers/cli",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"description": "icebreaker's cli template",
|
|
6
|
+
"author": "ice breaker <1324318532@qq.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/sonofmagic/monorepo-template.git",
|
|
11
|
+
"directory": "apps/cli"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/sonofmagic/monorepo-template/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [],
|
|
17
|
+
"bin": {
|
|
18
|
+
"ice": "./dev/index.ts"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"start": "tsx src/index.ts",
|
|
22
|
+
"dev": "tsup --watch --sourcemap",
|
|
23
|
+
"build": "tsup",
|
|
24
|
+
"lint": "eslint .",
|
|
25
|
+
"lint:fix": "eslint . --fix"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"bin": {
|
|
29
|
+
"ice": "./bin/index.js"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/index.ts', 'src/cli.ts'], // ,],
|
|
5
|
+
shims: true,
|
|
6
|
+
format: ['cjs', 'esm'],
|
|
7
|
+
clean: true,
|
|
8
|
+
dts: true,
|
|
9
|
+
// https://github.com/egoist/tsup/pull/1056
|
|
10
|
+
// https://github.com/egoist/tsup/issues?q=cjsInterop
|
|
11
|
+
// cjsInterop: true,
|
|
12
|
+
// splitting: true,
|
|
13
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + Vue + TS</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@icebreakers/client",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vue-tsc -b && vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"deploy": "wrangler deploy",
|
|
11
|
+
"cf-typegen": "wrangler types"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@faker-js/faker": "^10.0.0",
|
|
15
|
+
"@tanstack/vue-query": "^5.89.0",
|
|
16
|
+
"@tanstack/vue-table": "^8.21.3",
|
|
17
|
+
"@tanstack/vue-virtual": "^3.13.12",
|
|
18
|
+
"@trpc/client": "^11.5.1",
|
|
19
|
+
"pinia": "^3.0.3",
|
|
20
|
+
"vue": "^3.5.21",
|
|
21
|
+
"vue-i18n": "^11.1.12",
|
|
22
|
+
"vue-router": "^4.5.1"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@cloudflare/vite-plugin": "^1.13.3",
|
|
26
|
+
"@hono/node-server": "^1.19.3",
|
|
27
|
+
"@hono/trpc-server": "^0.4.0",
|
|
28
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
29
|
+
"@trpc/server": "^11.5.1",
|
|
30
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
31
|
+
"@vitejs/plugin-vue-jsx": "^5.1.1",
|
|
32
|
+
"@vue/tsconfig": "^0.8.1",
|
|
33
|
+
"hono": "^4.9.8",
|
|
34
|
+
"tailwindcss": "^4.1.13",
|
|
35
|
+
"typescript": "~5.9.2",
|
|
36
|
+
"unplugin-vue-router": "^0.15.0",
|
|
37
|
+
"vite": "^7.1.6",
|
|
38
|
+
"vite-plugin-vue-devtools": "^8.0.2",
|
|
39
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
40
|
+
"vue-tsc": "3.0.7",
|
|
41
|
+
"wrangler": "^4.38.0",
|
|
42
|
+
"zod": "^4.1.9"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createPinia } from 'pinia'
|
|
2
|
+
import { createApp } from 'vue'
|
|
3
|
+
import App from './App.vue'
|
|
4
|
+
import router from './router'
|
|
5
|
+
import { i18n } from './stores/i18n'
|
|
6
|
+
import './style.css'
|
|
7
|
+
|
|
8
|
+
const pinia = createPinia()
|
|
9
|
+
const app = createApp(App)
|
|
10
|
+
app.use(router)
|
|
11
|
+
app.use(pinia)
|
|
12
|
+
app.use(i18n)
|
|
13
|
+
|
|
14
|
+
app.mount('#app')
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script setup lang="tsx">
|
|
2
|
+
import { onMounted, ref } from 'vue'
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
4
|
+
import { client } from '../trpc'
|
|
5
|
+
|
|
6
|
+
const { t, locale } = useI18n()
|
|
7
|
+
function changeLocale(lang: 'en' | 'zh') {
|
|
8
|
+
locale.value = lang
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function toggleLocale() {
|
|
12
|
+
changeLocale(locale.value === 'en' ? 'zh' : 'en')
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const fetchData = ref<any>()
|
|
16
|
+
|
|
17
|
+
async function getFetchData() {
|
|
18
|
+
const result = await client.hello.query('icebreakers')
|
|
19
|
+
fetchData.value = result
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
onMounted(() => {
|
|
23
|
+
getFetchData()
|
|
24
|
+
client.sayHello.query({ name: '2' })
|
|
25
|
+
// init()
|
|
26
|
+
})
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div>
|
|
31
|
+
<div
|
|
32
|
+
class="
|
|
33
|
+
flex min-h-screen items-center justify-center bg-black bg-gradient-to-br
|
|
34
|
+
p-4
|
|
35
|
+
"
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
class="
|
|
39
|
+
space-y-6 rounded-2xl bg-white/20 p-8 text-center backdrop-blur-md
|
|
40
|
+
"
|
|
41
|
+
>
|
|
42
|
+
<h1 class="animate-pulse text-4xl font-semibold text-white">
|
|
43
|
+
{{ t('hello') }}
|
|
44
|
+
</h1>
|
|
45
|
+
<button
|
|
46
|
+
class="
|
|
47
|
+
transform rounded-full bg-white/30 px-5 py-2 text-white
|
|
48
|
+
backdrop-blur-sm transition
|
|
49
|
+
hover:scale-105
|
|
50
|
+
"
|
|
51
|
+
@click="toggleLocale"
|
|
52
|
+
>
|
|
53
|
+
<div>{{ t('toggleLocale') }}</div>
|
|
54
|
+
</button>
|
|
55
|
+
|
|
56
|
+
<div class="rounded border border-white p-2">
|
|
57
|
+
<pre class="text-left text-white">
|
|
58
|
+
{{ fetchData }}
|
|
59
|
+
</pre>
|
|
60
|
+
<button class="rounded bg-white/30 px-5 py-2 text-white" @click="getFetchData">
|
|
61
|
+
refetch
|
|
62
|
+
</button>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
2
|
+
import { handleHotUpdate, routes } from 'vue-router/auto-routes'
|
|
3
|
+
|
|
4
|
+
const router = createRouter({
|
|
5
|
+
history: createWebHistory(),
|
|
6
|
+
routes,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
if (import.meta.hot) {
|
|
10
|
+
handleHotUpdate(router)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default router
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
|
|
3
|
+
import { createI18n } from 'vue-i18n'
|
|
4
|
+
|
|
5
|
+
export const i18n = createI18n({
|
|
6
|
+
locale: 'en',
|
|
7
|
+
messages: {
|
|
8
|
+
en: {
|
|
9
|
+
hello: 'Hello World',
|
|
10
|
+
toggleLocale: 'toggle locale',
|
|
11
|
+
},
|
|
12
|
+
zh: {
|
|
13
|
+
hello: '你好世界',
|
|
14
|
+
toggleLocale: '切换语言',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const useI18nStore = defineStore('i18n', {
|
|
20
|
+
state: () => ({
|
|
21
|
+
i18n,
|
|
22
|
+
}),
|
|
23
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineStore } from 'pinia'
|
|
2
|
+
|
|
3
|
+
export const useCounterStore = defineStore('counter', {
|
|
4
|
+
state: () => ({
|
|
5
|
+
counter: 0,
|
|
6
|
+
}),
|
|
7
|
+
getters: {
|
|
8
|
+
doubleCount: state => state.counter * 2,
|
|
9
|
+
},
|
|
10
|
+
actions: {
|
|
11
|
+
increment() {
|
|
12
|
+
this.counter++
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
5
|
+
|
|
6
|
+
"paths": {
|
|
7
|
+
"@/*": [
|
|
8
|
+
"./src/*"
|
|
9
|
+
],
|
|
10
|
+
"~/*": [
|
|
11
|
+
"./*"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
/* Linting */
|
|
15
|
+
"strict": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"erasableSyntaxOnly": true,
|
|
20
|
+
"noUncheckedSideEffectImports": true
|
|
21
|
+
},
|
|
22
|
+
"include": [
|
|
23
|
+
"./worker-configuration.d.ts",
|
|
24
|
+
"src/**/*.ts",
|
|
25
|
+
"src/**/*.tsx",
|
|
26
|
+
"src/**/*.vue"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": ["ES2023"],
|
|
6
|
+
"moduleDetection": "force",
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
|
|
13
|
+
/* Linting */
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"noEmit": true,
|
|
19
|
+
"verbatimModuleSyntax": true,
|
|
20
|
+
"erasableSyntaxOnly": true,
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
"noUncheckedSideEffectImports": true
|
|
23
|
+
},
|
|
24
|
+
"include": ["vite.config.ts"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { cloudflare } from '@cloudflare/vite-plugin'
|
|
3
|
+
import Tailwindcss from '@tailwindcss/vite'
|
|
4
|
+
import Vue from '@vitejs/plugin-vue'
|
|
5
|
+
import VueJsx from '@vitejs/plugin-vue-jsx'
|
|
6
|
+
import VueRouter from 'unplugin-vue-router/vite'
|
|
7
|
+
import { defineConfig } from 'vite'
|
|
8
|
+
import VueDevTools from 'vite-plugin-vue-devtools'
|
|
9
|
+
// https://vite.dev/config/
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
resolve: {
|
|
12
|
+
alias: {
|
|
13
|
+
'@': path.resolve(import.meta.dirname, 'src'),
|
|
14
|
+
'~': import.meta.dirname,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
plugins: [
|
|
18
|
+
VueRouter(
|
|
19
|
+
{
|
|
20
|
+
dts: path.resolve(import.meta.dirname, 'src/types/typed-router.d.ts'),
|
|
21
|
+
},
|
|
22
|
+
),
|
|
23
|
+
Vue(),
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
VueJsx(),
|
|
26
|
+
Tailwindcss(),
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
cloudflare(),
|
|
29
|
+
VueDevTools(),
|
|
30
|
+
],
|
|
31
|
+
server: {
|
|
32
|
+
// proxy: {
|
|
33
|
+
// '/api': {
|
|
34
|
+
// target: `http://localhost:8787`,
|
|
35
|
+
// changeOrigin: true,
|
|
36
|
+
// // rewrite: path => path.replace(/^\/api/, ''),
|
|
37
|
+
// },
|
|
38
|
+
// },
|
|
39
|
+
},
|
|
40
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { trpcServer } from '@hono/trpc-server'
|
|
2
|
+
import { Hono } from 'hono'
|
|
3
|
+
import { appRouter } from './trpc-router'
|
|
4
|
+
|
|
5
|
+
const app = new Hono()
|
|
6
|
+
|
|
7
|
+
app.get('/api', (c) => {
|
|
8
|
+
return c.json({
|
|
9
|
+
message: 'Hello World',
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
app.use(
|
|
14
|
+
'/api/trpc/*',
|
|
15
|
+
trpcServer({
|
|
16
|
+
endpoint: '/api/trpc',
|
|
17
|
+
router: appRouter,
|
|
18
|
+
}),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
app,
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const port = 8787
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { serve } from '@hono/node-server'
|
|
2
|
+
import { logger } from 'hono/logger'
|
|
3
|
+
import { app } from './app'
|
|
4
|
+
import { port } from './config'
|
|
5
|
+
|
|
6
|
+
app.use(logger())
|
|
7
|
+
serve({
|
|
8
|
+
fetch: app.fetch,
|
|
9
|
+
port,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
console.log(`Server listening on http://localhost:${port}`)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { initTRPC } from '@trpc/server'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
const t = initTRPC.create()
|
|
5
|
+
|
|
6
|
+
const publicProcedure = t.procedure
|
|
7
|
+
const router = t.router
|
|
8
|
+
|
|
9
|
+
export const appRouter = router({
|
|
10
|
+
hello: publicProcedure.input(z.string().nullish()).query(({ input }) => {
|
|
11
|
+
return {
|
|
12
|
+
message: `hello ${input || 'world'}`,
|
|
13
|
+
time: Date.now(),
|
|
14
|
+
}
|
|
15
|
+
}),
|
|
16
|
+
sayHello: publicProcedure
|
|
17
|
+
.input(z.object({ name: z.string() }))
|
|
18
|
+
.output(z.object({ greeting: z.string() }))
|
|
19
|
+
.query(({ input }) => {
|
|
20
|
+
return { greeting: `Hello ${input.name}!` }
|
|
21
|
+
}),
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export type AppRouter = typeof appRouter
|