@icebreakers/monorepo 3.0.1 → 3.0.3
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 +8 -8
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{upgrade-C7eRZs41.cjs → upgrade-BTMNNTgu.cjs} +10 -12
- package/dist/{upgrade-CHym1gi7.mjs → upgrade-CxCmaiou.mjs} +10 -12
- package/package.json +3 -3
- package/templates/apps/client/package.json +16 -12
- package/templates/apps/client/src/App.vue +5 -3
- package/templates/apps/client/src/main.ts +2 -0
- package/templates/apps/client/src/pages/index.vue +329 -39
- package/templates/apps/client/src/query-keys.ts +4 -0
- package/templates/apps/client/src/stores/i18n.ts +1 -0
- package/templates/apps/client/wrangler.jsonc +4 -1
- package/templates/apps/server/package.json +8 -8
- package/templates/packages/vue-lib-template/package.json +3 -3
package/assets/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"version": "0.0.0",
|
|
5
5
|
"private": true,
|
|
6
|
-
"packageManager": "pnpm@10.
|
|
6
|
+
"packageManager": "pnpm@10.24.0",
|
|
7
7
|
"author": "ice breaker <1324318532@qq.com>",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"script:mirror": "monorepo mirror"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@changesets/changelog-github": "^0.5.
|
|
44
|
-
"@changesets/cli": "^2.29.
|
|
43
|
+
"@changesets/changelog-github": "^0.5.2",
|
|
44
|
+
"@changesets/cli": "^2.29.8",
|
|
45
45
|
"@commitlint/cli": "^20.1.0",
|
|
46
46
|
"@icebreakers/commitlint-config": "^1.2.2",
|
|
47
|
-
"@icebreakers/eslint-config": "^1.
|
|
47
|
+
"@icebreakers/eslint-config": "^1.6.0",
|
|
48
48
|
"@icebreakers/monorepo": "workspace:*",
|
|
49
49
|
"@icebreakers/stylelint-config": "^1.2.3",
|
|
50
50
|
"@types/fs-extra": "^11.0.4",
|
|
51
51
|
"@types/node": "^24.10.1",
|
|
52
52
|
"@types/semver": "^7.7.1",
|
|
53
|
-
"@vitest/coverage-v8": "~4.0.
|
|
53
|
+
"@vitest/coverage-v8": "~4.0.14",
|
|
54
54
|
"ci-info": "^4.3.1",
|
|
55
55
|
"cross-env": "^10.1.0",
|
|
56
56
|
"defu": "^6.1.4",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"pathe": "^2.0.3",
|
|
65
65
|
"pkg-types": "^2.3.0",
|
|
66
66
|
"rimraf": "^6.1.2",
|
|
67
|
-
"stylelint": "^16.
|
|
68
|
-
"tsdown": "^0.16.
|
|
67
|
+
"stylelint": "^16.26.1",
|
|
68
|
+
"tsdown": "^0.16.8",
|
|
69
69
|
"tslib": "^2.8.1",
|
|
70
70
|
"tsup": "^8.5.1",
|
|
71
71
|
"tsx": "^4.20.6",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"type-fest": "^5.2.0",
|
|
74
74
|
"typescript": "^5.9.3",
|
|
75
75
|
"unbuild": "^3.6.1",
|
|
76
|
-
"vitest": "~4.0.
|
|
76
|
+
"vitest": "~4.0.14",
|
|
77
77
|
"yaml": "^2.8.1"
|
|
78
78
|
},
|
|
79
79
|
"publishConfig": {
|
package/dist/cli.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_upgrade = require('./upgrade-
|
|
1
|
+
const require_upgrade = require('./upgrade-BTMNNTgu.cjs');
|
|
2
2
|
let node_process = require("node:process");
|
|
3
3
|
node_process = require_upgrade.__toESM(node_process);
|
|
4
4
|
let __inquirer_input = require("@inquirer/input");
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as cleanProjects, T as version, c as getCreateChoices, i as init, k as resolveCommandConfig, n as syncNpmMirror, o as createNewProject, r as setVscodeBinaryMirror, s as defaultTemplate, t as upgradeMonorepo, w as name, y as logger } from "./upgrade-
|
|
1
|
+
import { E as cleanProjects, T as version, c as getCreateChoices, i as init, k as resolveCommandConfig, n as syncNpmMirror, o as createNewProject, r as setVscodeBinaryMirror, s as defaultTemplate, t as upgradeMonorepo, w as name, y as logger } from "./upgrade-CxCmaiou.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import input from "@inquirer/input";
|
|
4
4
|
import select from "@inquirer/select";
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as getWorkspaceData, C as templatesDir, D as defineMonorepoConfig, E as cleanProjects, M as GitClient, O as loadMonorepoConfig, S as rootDir, T as version, _ as toWorkspaceGitignorePath, a as createContext, b as assetsDir, c as getCreateChoices, d as escapeStringRegexp, f as isMatch, g as toPublishGitignorePath, h as isGitignoreFile, i as init, j as getWorkspacePackages, k as resolveCommandConfig, l as getTemplateMap, m as isFileChanged, n as syncNpmMirror, o as createNewProject, p as getFileHash, r as setVscodeBinaryMirror, t as upgradeMonorepo, u as templateMap, v as isIgnorableFsError, w as name, x as packageDir, y as logger } from "./upgrade-
|
|
1
|
+
import { A as getWorkspaceData, C as templatesDir, D as defineMonorepoConfig, E as cleanProjects, M as GitClient, O as loadMonorepoConfig, S as rootDir, T as version, _ as toWorkspaceGitignorePath, a as createContext, b as assetsDir, c as getCreateChoices, d as escapeStringRegexp, f as isMatch, g as toPublishGitignorePath, h as isGitignoreFile, i as init, j as getWorkspacePackages, k as resolveCommandConfig, l as getTemplateMap, m as isFileChanged, n as syncNpmMirror, o as createNewProject, p as getFileHash, r as setVscodeBinaryMirror, t as upgradeMonorepo, u as templateMap, v as isIgnorableFsError, w as name, x as packageDir, y as logger } from "./upgrade-CxCmaiou.mjs";
|
|
2
2
|
|
|
3
3
|
export { GitClient, assetsDir, cleanProjects, createContext, createNewProject, defineMonorepoConfig, escapeStringRegexp, getCreateChoices, getFileHash, getTemplateMap, getWorkspaceData, getWorkspacePackages, init, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadMonorepoConfig, logger, name, packageDir, resolveCommandConfig, rootDir, setVscodeBinaryMirror, syncNpmMirror, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath, upgradeMonorepo, version };
|
|
@@ -5,9 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
11
9
|
var __copyProps = (to, from, except, desc) => {
|
|
12
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
11
|
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
@@ -285,12 +283,12 @@ async function getWorkspaceData(cwd, options) {
|
|
|
285
283
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
286
284
|
* Released under the MIT License.
|
|
287
285
|
*/
|
|
288
|
-
var require_is_primitive = /* @__PURE__ */
|
|
286
|
+
var require_is_primitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
289
287
|
module.exports = function isPrimitive$1(val) {
|
|
290
288
|
if (typeof val === "object") return val === null;
|
|
291
289
|
return typeof val !== "function";
|
|
292
290
|
};
|
|
293
|
-
})
|
|
291
|
+
}));
|
|
294
292
|
|
|
295
293
|
//#endregion
|
|
296
294
|
//#region ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
|
|
@@ -300,11 +298,11 @@ var require_is_primitive = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
|
|
|
300
298
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
301
299
|
* Released under the MIT License.
|
|
302
300
|
*/
|
|
303
|
-
var require_isobject = /* @__PURE__ */
|
|
301
|
+
var require_isobject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
304
302
|
module.exports = function isObject$3(val) {
|
|
305
303
|
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
306
304
|
};
|
|
307
|
-
})
|
|
305
|
+
}));
|
|
308
306
|
|
|
309
307
|
//#endregion
|
|
310
308
|
//#region ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
@@ -314,7 +312,7 @@ var require_isobject = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/is
|
|
|
314
312
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
315
313
|
* Released under the MIT License.
|
|
316
314
|
*/
|
|
317
|
-
var require_is_plain_object = /* @__PURE__ */
|
|
315
|
+
var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
318
316
|
var isObject$1 = require_isobject();
|
|
319
317
|
function isObjectObject(o) {
|
|
320
318
|
return isObject$1(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
@@ -329,7 +327,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJS({ "../../node_modules/.
|
|
|
329
327
|
if (prot.hasOwnProperty("isPrototypeOf") === false) return false;
|
|
330
328
|
return true;
|
|
331
329
|
};
|
|
332
|
-
})
|
|
330
|
+
}));
|
|
333
331
|
|
|
334
332
|
//#endregion
|
|
335
333
|
//#region ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
|
|
@@ -339,7 +337,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJS({ "../../node_modules/.
|
|
|
339
337
|
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
340
338
|
* Released under the MIT License.
|
|
341
339
|
*/
|
|
342
|
-
var require_set_value = /* @__PURE__ */
|
|
340
|
+
var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
343
341
|
const { deleteProperty } = Reflect;
|
|
344
342
|
const isPrimitive = require_is_primitive();
|
|
345
343
|
const isPlainObject = require_is_plain_object();
|
|
@@ -443,7 +441,7 @@ var require_set_value = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/s
|
|
|
443
441
|
setValue.cache = /* @__PURE__ */ new Map();
|
|
444
442
|
};
|
|
445
443
|
module.exports = setValue;
|
|
446
|
-
})
|
|
444
|
+
}));
|
|
447
445
|
|
|
448
446
|
//#endregion
|
|
449
447
|
//#region src/core/config.ts
|
|
@@ -531,7 +529,7 @@ async function cleanProjects(cwd) {
|
|
|
531
529
|
//#endregion
|
|
532
530
|
//#region package.json
|
|
533
531
|
var name = "@icebreakers/monorepo";
|
|
534
|
-
var version = "3.0.
|
|
532
|
+
var version = "3.0.3";
|
|
535
533
|
|
|
536
534
|
//#endregion
|
|
537
535
|
//#region src/constants.ts
|
|
@@ -29,9 +29,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
29
29
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
30
30
|
var __getProtoOf = Object.getPrototypeOf;
|
|
31
31
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
32
|
-
var
|
|
33
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
34
|
-
};
|
|
32
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
35
33
|
var __copyProps = (to, from, except, desc) => {
|
|
36
34
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
37
35
|
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
@@ -274,12 +272,12 @@ async function getWorkspaceData(cwd, options) {
|
|
|
274
272
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
275
273
|
* Released under the MIT License.
|
|
276
274
|
*/
|
|
277
|
-
var require_is_primitive = /* @__PURE__ */
|
|
275
|
+
var require_is_primitive = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
278
276
|
module.exports = function isPrimitive$1(val) {
|
|
279
277
|
if (typeof val === "object") return val === null;
|
|
280
278
|
return typeof val !== "function";
|
|
281
279
|
};
|
|
282
|
-
})
|
|
280
|
+
}));
|
|
283
281
|
|
|
284
282
|
//#endregion
|
|
285
283
|
//#region ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
|
|
@@ -289,11 +287,11 @@ var require_is_primitive = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
|
|
|
289
287
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
290
288
|
* Released under the MIT License.
|
|
291
289
|
*/
|
|
292
|
-
var require_isobject = /* @__PURE__ */
|
|
290
|
+
var require_isobject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
293
291
|
module.exports = function isObject$3(val) {
|
|
294
292
|
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
295
293
|
};
|
|
296
|
-
})
|
|
294
|
+
}));
|
|
297
295
|
|
|
298
296
|
//#endregion
|
|
299
297
|
//#region ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
@@ -303,7 +301,7 @@ var require_isobject = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/is
|
|
|
303
301
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
304
302
|
* Released under the MIT License.
|
|
305
303
|
*/
|
|
306
|
-
var require_is_plain_object = /* @__PURE__ */
|
|
304
|
+
var require_is_plain_object = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
307
305
|
var isObject$1 = require_isobject();
|
|
308
306
|
function isObjectObject(o) {
|
|
309
307
|
return isObject$1(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
@@ -318,7 +316,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJS({ "../../node_modules/.
|
|
|
318
316
|
if (prot.hasOwnProperty("isPrototypeOf") === false) return false;
|
|
319
317
|
return true;
|
|
320
318
|
};
|
|
321
|
-
})
|
|
319
|
+
}));
|
|
322
320
|
|
|
323
321
|
//#endregion
|
|
324
322
|
//#region ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
|
|
@@ -328,7 +326,7 @@ var require_is_plain_object = /* @__PURE__ */ __commonJS({ "../../node_modules/.
|
|
|
328
326
|
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
329
327
|
* Released under the MIT License.
|
|
330
328
|
*/
|
|
331
|
-
var require_set_value = /* @__PURE__ */
|
|
329
|
+
var require_set_value = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
332
330
|
const { deleteProperty } = Reflect;
|
|
333
331
|
const isPrimitive = require_is_primitive();
|
|
334
332
|
const isPlainObject = require_is_plain_object();
|
|
@@ -432,7 +430,7 @@ var require_set_value = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/s
|
|
|
432
430
|
setValue.cache = /* @__PURE__ */ new Map();
|
|
433
431
|
};
|
|
434
432
|
module.exports = setValue;
|
|
435
|
-
})
|
|
433
|
+
}));
|
|
436
434
|
|
|
437
435
|
//#endregion
|
|
438
436
|
//#region src/core/config.ts
|
|
@@ -520,7 +518,7 @@ async function cleanProjects(cwd) {
|
|
|
520
518
|
//#endregion
|
|
521
519
|
//#region package.json
|
|
522
520
|
var name = "@icebreakers/monorepo";
|
|
523
|
-
var version = "3.0.
|
|
521
|
+
var version = "3.0.3";
|
|
524
522
|
|
|
525
523
|
//#endregion
|
|
526
524
|
//#region src/constants.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/monorepo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.3",
|
|
5
5
|
"description": "The icebreaker's monorepo manager",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"@pnpm/find-workspace-dir": "^1000.1.3",
|
|
65
65
|
"@pnpm/logger": "^1001.0.1",
|
|
66
66
|
"@pnpm/types": "^1001.0.1",
|
|
67
|
-
"@pnpm/worker": "^1000.
|
|
68
|
-
"@pnpm/workspace.find-packages": "^1000.0.
|
|
67
|
+
"@pnpm/worker": "^1000.4.0",
|
|
68
|
+
"@pnpm/workspace.find-packages": "^1000.0.47",
|
|
69
69
|
"@pnpm/workspace.read-manifest": "^1000.2.7",
|
|
70
70
|
"c12": "^3.3.2",
|
|
71
71
|
"commander": "^14.0.2",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"version": "0.0.0",
|
|
5
5
|
"private": true,
|
|
6
6
|
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
7
|
+
"dev": "vite --host",
|
|
8
8
|
"build": "vue-tsc -b && vite build",
|
|
9
9
|
"lint": "eslint .",
|
|
10
10
|
"lint:fix": "eslint . --fix",
|
|
@@ -15,33 +15,37 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@faker-js/faker": "^10.1.0",
|
|
18
|
-
"@tanstack/vue-query": "^5.
|
|
18
|
+
"@tanstack/vue-query": "^5.92.0",
|
|
19
|
+
"@tanstack/vue-query-devtools": "^6.1.2",
|
|
19
20
|
"@tanstack/vue-table": "^8.21.3",
|
|
20
21
|
"@tanstack/vue-virtual": "^3.13.12",
|
|
21
|
-
"@trpc/client": "^11.7.
|
|
22
|
+
"@trpc/client": "^11.7.2",
|
|
23
|
+
"clsx": "^2.1.1",
|
|
22
24
|
"pinia": "^3.0.4",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
+
"tailwind-merge": "^3.4.0",
|
|
26
|
+
"tailwind-variants": "^3.2.2",
|
|
27
|
+
"vue": "^3.5.25",
|
|
28
|
+
"vue-i18n": "^11.2.2",
|
|
25
29
|
"vue-router": "^4.6.3"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
28
|
-
"@cloudflare/vite-plugin": "^1.15.
|
|
32
|
+
"@cloudflare/vite-plugin": "^1.15.3",
|
|
29
33
|
"@hono/node-server": "^1.19.6",
|
|
30
34
|
"@hono/trpc-server": "^0.4.0",
|
|
31
35
|
"@tailwindcss/vite": "^4.1.17",
|
|
32
|
-
"@trpc/server": "^11.7.
|
|
36
|
+
"@trpc/server": "^11.7.2",
|
|
33
37
|
"@vitejs/plugin-vue": "^6.0.2",
|
|
34
38
|
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
|
35
39
|
"@vue/tsconfig": "^0.8.1",
|
|
36
|
-
"hono": "^4.10.
|
|
40
|
+
"hono": "^4.10.7",
|
|
37
41
|
"tailwindcss": "^4.1.17",
|
|
38
42
|
"typescript": "~5.9.3",
|
|
39
|
-
"unplugin-vue-router": "^0.
|
|
43
|
+
"unplugin-vue-router": "^0.18.0",
|
|
40
44
|
"vite": "^7.2.4",
|
|
41
45
|
"vite-plugin-vue-devtools": "^8.0.5",
|
|
42
46
|
"vite-tsconfig-paths": "^5.1.4",
|
|
43
|
-
"vue-tsc": "3.1.
|
|
44
|
-
"wrangler": "^4.
|
|
45
|
-
"zod": "^4.1.
|
|
47
|
+
"vue-tsc": "3.1.5",
|
|
48
|
+
"wrangler": "^4.51.0",
|
|
49
|
+
"zod": "^4.1.13"
|
|
46
50
|
}
|
|
47
51
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { VueQueryDevtools } from '@tanstack/vue-query-devtools'
|
|
2
3
|
import { RouterView } from 'vue-router'
|
|
3
4
|
</script>
|
|
4
5
|
|
|
5
6
|
<template>
|
|
6
|
-
<
|
|
7
|
+
<div>
|
|
8
|
+
<RouterView />
|
|
9
|
+
</div>
|
|
10
|
+
<VueQueryDevtools />
|
|
7
11
|
</template>
|
|
8
|
-
|
|
9
|
-
<style scoped></style>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VueQueryPlugin } from '@tanstack/vue-query'
|
|
1
2
|
import { createPinia } from 'pinia'
|
|
2
3
|
import { createApp } from 'vue'
|
|
3
4
|
import App from './App.vue'
|
|
@@ -10,5 +11,6 @@ const app = createApp(App)
|
|
|
10
11
|
app.use(router)
|
|
11
12
|
app.use(pinia)
|
|
12
13
|
app.use(i18n)
|
|
14
|
+
app.use(VueQueryPlugin)
|
|
13
15
|
|
|
14
16
|
app.mount('#app')
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
<script setup lang="
|
|
2
|
-
import {
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useQuery, useQueryClient } from '@tanstack/vue-query'
|
|
3
|
+
import { computed } from 'vue'
|
|
3
4
|
import { useI18n } from 'vue-i18n'
|
|
4
|
-
import {
|
|
5
|
+
import { helloKeys } from '@/query-keys'
|
|
6
|
+
import { client } from '@/trpc'
|
|
7
|
+
|
|
8
|
+
type HelloResponse = Awaited<ReturnType<typeof client.hello.query>>
|
|
5
9
|
|
|
6
10
|
const { t, locale } = useI18n()
|
|
7
11
|
function changeLocale(lang: 'en' | 'zh') {
|
|
@@ -12,55 +16,341 @@ function toggleLocale() {
|
|
|
12
16
|
changeLocale(locale.value === 'en' ? 'zh' : 'en')
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
function formatTime(timestamp?: number) {
|
|
20
|
+
if (!timestamp) {
|
|
21
|
+
return '-'
|
|
22
|
+
}
|
|
23
|
+
return new Intl.DateTimeFormat(undefined, {
|
|
24
|
+
hour: '2-digit',
|
|
25
|
+
minute: '2-digit',
|
|
26
|
+
second: '2-digit',
|
|
27
|
+
}).format(new Date(timestamp))
|
|
20
28
|
}
|
|
21
29
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
const queryClient = useQueryClient()
|
|
31
|
+
const helloName = 'icebreakers' as const
|
|
32
|
+
|
|
33
|
+
const helloQuery = useQuery<HelloResponse>({
|
|
34
|
+
queryKey: helloKeys.detail(helloName),
|
|
35
|
+
queryFn: () => client.hello.query(helloName),
|
|
36
|
+
staleTime: 30_000,
|
|
37
|
+
gcTime: 5 * 60_000,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const liveData = computed(() => ({
|
|
41
|
+
message: helloQuery.data.value?.message ?? '-',
|
|
42
|
+
time: helloQuery.data.value?.time ?? null,
|
|
43
|
+
formattedTime: formatTime(helloQuery.data.value?.time),
|
|
44
|
+
}))
|
|
45
|
+
|
|
46
|
+
const cachedHello = computed<HelloResponse | undefined>(() => {
|
|
47
|
+
const cached = queryClient.getQueryData<HelloResponse>(
|
|
48
|
+
helloKeys.detail(helloName),
|
|
49
|
+
)
|
|
50
|
+
return helloQuery.data.value ?? cached
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const queryMeta = computed(() => ({
|
|
54
|
+
status: helloQuery.status.value,
|
|
55
|
+
fetchStatus: helloQuery.fetchStatus.value,
|
|
56
|
+
isFetching: helloQuery.isFetching.value,
|
|
57
|
+
isStale: helloQuery.isStale.value,
|
|
58
|
+
dataUpdatedAt: helloQuery.dataUpdatedAt.value,
|
|
59
|
+
}))
|
|
60
|
+
|
|
61
|
+
const helloErrorMessage = computed(() => {
|
|
62
|
+
const error = helloQuery.error.value
|
|
63
|
+
if (!error) {
|
|
64
|
+
return ''
|
|
65
|
+
}
|
|
66
|
+
if (error instanceof Error) {
|
|
67
|
+
return error.message
|
|
68
|
+
}
|
|
69
|
+
return String(error)
|
|
26
70
|
})
|
|
27
71
|
</script>
|
|
28
72
|
|
|
29
73
|
<template>
|
|
30
|
-
<div>
|
|
31
|
-
<div
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
74
|
+
<div class="min-h-screen bg-slate-950 text-slate-50">
|
|
75
|
+
<div class="mx-auto flex min-h-screen max-w-5xl flex-col gap-6 px-6 py-8">
|
|
76
|
+
<header
|
|
77
|
+
class="
|
|
78
|
+
rounded-2xl bg-linear-to-br from-slate-800 to-slate-900 p-6 shadow-xl
|
|
79
|
+
ring-1 ring-white/5
|
|
80
|
+
"
|
|
81
|
+
>
|
|
82
|
+
<div class="flex flex-wrap items-center justify-between gap-4">
|
|
83
|
+
<div class="space-y-2">
|
|
84
|
+
<p class="text-xs tracking-[0.2em] text-slate-400 uppercase">
|
|
85
|
+
TanStack Query + i18n
|
|
86
|
+
</p>
|
|
87
|
+
<h1 class="text-3xl leading-tight font-semibold">
|
|
88
|
+
{{ t('hello') }}
|
|
89
|
+
</h1>
|
|
90
|
+
<p class="text-sm text-slate-400">
|
|
91
|
+
Minimal data-fetch demo. Everything stays on screen for quick checks.
|
|
92
|
+
</p>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
95
|
+
<button
|
|
96
|
+
class="
|
|
97
|
+
rounded-full bg-white/15 px-4 py-2 text-sm font-medium
|
|
98
|
+
text-slate-50 shadow-sm transition
|
|
99
|
+
hover:scale-[1.02] hover:bg-white/25
|
|
100
|
+
"
|
|
101
|
+
@click="toggleLocale"
|
|
102
|
+
>
|
|
103
|
+
{{ t('toggleLocale') }}
|
|
104
|
+
</button>
|
|
105
|
+
<button
|
|
106
|
+
class="
|
|
107
|
+
rounded-full bg-emerald-500/90 px-4 py-2 text-sm font-semibold
|
|
108
|
+
text-emerald-950 shadow-sm transition
|
|
109
|
+
hover:scale-[1.02] hover:bg-emerald-400
|
|
110
|
+
disabled:opacity-60
|
|
111
|
+
"
|
|
112
|
+
:disabled="helloQuery.isFetching.value"
|
|
113
|
+
@click="helloQuery.refetch()"
|
|
114
|
+
>
|
|
115
|
+
{{ helloQuery.isFetching ? 'Refreshing…' : 'Refetch now' }}
|
|
116
|
+
</button>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
<div
|
|
120
|
+
class="mt-4 flex flex-wrap items-center gap-3 text-xs text-slate-300"
|
|
121
|
+
>
|
|
122
|
+
<span
|
|
123
|
+
class="
|
|
124
|
+
inline-flex items-center gap-2 rounded-full bg-emerald-500/15 px-3
|
|
125
|
+
py-1 font-semibold text-emerald-200 ring-1 ring-emerald-500/30
|
|
126
|
+
"
|
|
127
|
+
>
|
|
128
|
+
<span class="size-2 rounded-full bg-emerald-400" />
|
|
129
|
+
Live data connected
|
|
130
|
+
</span>
|
|
131
|
+
<span
|
|
132
|
+
class="
|
|
133
|
+
rounded-full bg-white/5 px-3 py-1 font-semibold text-white/80
|
|
134
|
+
ring-1 ring-white/10
|
|
135
|
+
"
|
|
136
|
+
>
|
|
137
|
+
Status: {{ helloQuery.status }}
|
|
138
|
+
</span>
|
|
139
|
+
<span
|
|
140
|
+
v-if="helloQuery.isFetching"
|
|
141
|
+
class="
|
|
142
|
+
rounded-full bg-amber-500/15 px-3 py-1 font-semibold
|
|
143
|
+
text-amber-200 ring-1 ring-amber-500/30
|
|
144
|
+
"
|
|
145
|
+
>
|
|
146
|
+
Fetching…
|
|
147
|
+
</span>
|
|
148
|
+
</div>
|
|
149
|
+
</header>
|
|
150
|
+
|
|
37
151
|
<div
|
|
38
152
|
class="
|
|
39
|
-
|
|
153
|
+
grid gap-4
|
|
154
|
+
md:grid-cols-2
|
|
40
155
|
"
|
|
41
156
|
>
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
157
|
+
<section
|
|
158
|
+
class="rounded-2xl bg-slate-900/70 p-5 shadow-lg ring-1 ring-white/5"
|
|
159
|
+
>
|
|
160
|
+
<div class="flex items-center justify-between gap-3">
|
|
161
|
+
<div>
|
|
162
|
+
<h2 class="text-lg font-semibold">
|
|
163
|
+
Live data
|
|
164
|
+
</h2>
|
|
165
|
+
<p class="text-xs text-slate-400">
|
|
166
|
+
Latest response from the server
|
|
167
|
+
</p>
|
|
168
|
+
</div>
|
|
169
|
+
<span
|
|
170
|
+
class="
|
|
171
|
+
rounded-full bg-white/10 px-3 py-1 text-xs font-semibold
|
|
172
|
+
text-white/90 ring-1 ring-white/10
|
|
173
|
+
"
|
|
174
|
+
>
|
|
175
|
+
{{ helloQuery.fetchStatus }}
|
|
176
|
+
</span>
|
|
177
|
+
</div>
|
|
178
|
+
<dl
|
|
179
|
+
class="
|
|
180
|
+
mt-4 grid gap-3
|
|
181
|
+
sm:grid-cols-2
|
|
182
|
+
"
|
|
183
|
+
>
|
|
184
|
+
<div
|
|
185
|
+
class="
|
|
186
|
+
rounded-lg bg-white/5 px-3 py-2 text-sm text-slate-100 ring-1
|
|
187
|
+
ring-white/10
|
|
188
|
+
"
|
|
189
|
+
>
|
|
190
|
+
<dt class="text-xs tracking-wide text-slate-400 uppercase">
|
|
191
|
+
Message
|
|
192
|
+
</dt>
|
|
193
|
+
<dd class="mt-1 font-semibold">
|
|
194
|
+
{{ liveData.message }}
|
|
195
|
+
</dd>
|
|
196
|
+
</div>
|
|
197
|
+
<div
|
|
198
|
+
class="
|
|
199
|
+
rounded-lg bg-white/5 px-3 py-2 text-sm text-slate-100 ring-1
|
|
200
|
+
ring-white/10
|
|
201
|
+
"
|
|
202
|
+
>
|
|
203
|
+
<dt class="text-xs tracking-wide text-slate-400 uppercase">
|
|
204
|
+
Server time
|
|
205
|
+
</dt>
|
|
206
|
+
<dd class="mt-1 font-semibold">
|
|
207
|
+
{{ liveData.formattedTime }}
|
|
208
|
+
</dd>
|
|
209
|
+
</div>
|
|
210
|
+
</dl>
|
|
211
|
+
<pre
|
|
212
|
+
class="
|
|
213
|
+
mt-4 max-h-48 overflow-auto rounded-lg bg-black/40 p-3 text-left
|
|
214
|
+
text-xs leading-relaxed text-slate-100 ring-1 ring-white/10
|
|
215
|
+
"
|
|
216
|
+
>{{ JSON.stringify(liveData, null, 2) }}</pre>
|
|
217
|
+
<p v-if="helloErrorMessage" class="mt-3 text-sm text-rose-200">
|
|
218
|
+
{{ helloErrorMessage }}
|
|
219
|
+
</p>
|
|
220
|
+
</section>
|
|
221
|
+
|
|
222
|
+
<section
|
|
223
|
+
class="rounded-2xl bg-slate-900/70 p-5 shadow-lg ring-1 ring-white/5"
|
|
224
|
+
>
|
|
225
|
+
<div class="flex items-center justify-between gap-3">
|
|
226
|
+
<div>
|
|
227
|
+
<h2 class="text-lg font-semibold">
|
|
228
|
+
Cache snapshot
|
|
229
|
+
</h2>
|
|
230
|
+
<p class="text-xs text-slate-400">
|
|
231
|
+
Result from getQueryData
|
|
232
|
+
</p>
|
|
233
|
+
</div>
|
|
234
|
+
<span
|
|
235
|
+
class="
|
|
236
|
+
rounded-full bg-emerald-500/15 px-3 py-1 text-xs font-semibold
|
|
237
|
+
text-emerald-100 ring-1 ring-emerald-500/30
|
|
238
|
+
"
|
|
239
|
+
>
|
|
240
|
+
{{ cachedHello ? 'Cached' : 'Empty' }}
|
|
241
|
+
</span>
|
|
242
|
+
</div>
|
|
243
|
+
<div
|
|
244
|
+
class="
|
|
245
|
+
mt-3 rounded-lg bg-white/5 px-3 py-2 text-sm text-slate-100 ring-1
|
|
246
|
+
ring-white/10
|
|
247
|
+
"
|
|
248
|
+
>
|
|
249
|
+
<p class="text-xs tracking-wide text-slate-400 uppercase">
|
|
250
|
+
Time
|
|
251
|
+
</p>
|
|
252
|
+
<p class="mt-1 font-semibold">
|
|
253
|
+
{{ formatTime(cachedHello?.time) }}
|
|
254
|
+
</p>
|
|
255
|
+
</div>
|
|
256
|
+
<pre
|
|
257
|
+
class="
|
|
258
|
+
mt-4 max-h-48 overflow-auto rounded-lg bg-black/40 p-3 text-left
|
|
259
|
+
text-xs leading-relaxed text-slate-100 ring-1 ring-white/10
|
|
260
|
+
"
|
|
261
|
+
>{{ JSON.stringify(cachedHello ?? '-', null, 2) }}</pre>
|
|
262
|
+
</section>
|
|
263
|
+
|
|
264
|
+
<section
|
|
46
265
|
class="
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
hover:scale-105
|
|
266
|
+
rounded-2xl bg-slate-900/70 p-5 shadow-lg ring-1 ring-white/5
|
|
267
|
+
md:col-span-2
|
|
50
268
|
"
|
|
51
|
-
@click="toggleLocale"
|
|
52
269
|
>
|
|
53
|
-
<div
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
270
|
+
<div class="flex flex-wrap items-center justify-between gap-3">
|
|
271
|
+
<div>
|
|
272
|
+
<h2 class="text-lg font-semibold">
|
|
273
|
+
Query meta
|
|
274
|
+
</h2>
|
|
275
|
+
<p class="text-xs text-slate-400">
|
|
276
|
+
What TanStack Query is tracking
|
|
277
|
+
</p>
|
|
278
|
+
</div>
|
|
279
|
+
<span
|
|
280
|
+
class="
|
|
281
|
+
rounded-full bg-white/10 px-3 py-1 text-xs font-semibold
|
|
282
|
+
text-white/80 ring-1 ring-white/10
|
|
283
|
+
"
|
|
284
|
+
>
|
|
285
|
+
Updated: {{ formatTime(queryMeta.dataUpdatedAt) }}
|
|
286
|
+
</span>
|
|
287
|
+
</div>
|
|
288
|
+
<div
|
|
289
|
+
class="
|
|
290
|
+
mt-4 grid gap-3
|
|
291
|
+
sm:grid-cols-4
|
|
292
|
+
"
|
|
293
|
+
>
|
|
294
|
+
<div
|
|
295
|
+
class="
|
|
296
|
+
rounded-lg bg-white/5 px-3 py-2 text-xs text-slate-100 ring-1
|
|
297
|
+
ring-white/10
|
|
298
|
+
"
|
|
299
|
+
>
|
|
300
|
+
<p class="text-slate-400">
|
|
301
|
+
Status
|
|
302
|
+
</p>
|
|
303
|
+
<p class="mt-1 font-semibold">
|
|
304
|
+
{{ queryMeta.status }}
|
|
305
|
+
</p>
|
|
306
|
+
</div>
|
|
307
|
+
<div
|
|
308
|
+
class="
|
|
309
|
+
rounded-lg bg-white/5 px-3 py-2 text-xs text-slate-100 ring-1
|
|
310
|
+
ring-white/10
|
|
311
|
+
"
|
|
312
|
+
>
|
|
313
|
+
<p class="text-slate-400">
|
|
314
|
+
Fetch
|
|
315
|
+
</p>
|
|
316
|
+
<p class="mt-1 font-semibold">
|
|
317
|
+
{{ queryMeta.fetchStatus }}
|
|
318
|
+
</p>
|
|
319
|
+
</div>
|
|
320
|
+
<div
|
|
321
|
+
class="
|
|
322
|
+
rounded-lg bg-white/5 px-3 py-2 text-xs text-slate-100 ring-1
|
|
323
|
+
ring-white/10
|
|
324
|
+
"
|
|
325
|
+
>
|
|
326
|
+
<p class="text-slate-400">
|
|
327
|
+
Fetching?
|
|
328
|
+
</p>
|
|
329
|
+
<p class="mt-1 font-semibold">
|
|
330
|
+
{{ queryMeta.isFetching ? 'Yes' : 'No' }}
|
|
331
|
+
</p>
|
|
332
|
+
</div>
|
|
333
|
+
<div
|
|
334
|
+
class="
|
|
335
|
+
rounded-lg bg-white/5 px-3 py-2 text-xs text-slate-100 ring-1
|
|
336
|
+
ring-white/10
|
|
337
|
+
"
|
|
338
|
+
>
|
|
339
|
+
<p class="text-slate-400">
|
|
340
|
+
Stale?
|
|
341
|
+
</p>
|
|
342
|
+
<p class="mt-1 font-semibold">
|
|
343
|
+
{{ queryMeta.isStale ? 'Yes' : 'No' }}
|
|
344
|
+
</p>
|
|
345
|
+
</div>
|
|
346
|
+
</div>
|
|
347
|
+
<pre
|
|
348
|
+
class="
|
|
349
|
+
mt-4 max-h-48 overflow-auto rounded-lg bg-black/40 p-3 text-left
|
|
350
|
+
text-xs leading-relaxed text-slate-100 ring-1 ring-white/10
|
|
351
|
+
"
|
|
352
|
+
>{{ JSON.stringify(queryMeta, null, 2) }}</pre>
|
|
353
|
+
</section>
|
|
64
354
|
</div>
|
|
65
355
|
</div>
|
|
66
356
|
</div>
|
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
"compatibility_date": "2025-10-16",
|
|
5
5
|
"main": "./worker/fetch-entry.ts",
|
|
6
6
|
"assets": {
|
|
7
|
-
"not_found_handling": "single-page-application"
|
|
7
|
+
"not_found_handling": "single-page-application",
|
|
8
|
+
"run_worker_first": [
|
|
9
|
+
"/api/*"
|
|
10
|
+
]
|
|
8
11
|
},
|
|
9
12
|
"dev": {
|
|
10
13
|
"port": 8787
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
|
-
"dev": "
|
|
28
|
-
"
|
|
29
|
-
"build
|
|
30
|
-
"
|
|
27
|
+
"dev": "wrangler dev",
|
|
28
|
+
"node:build:watch": "tsup --watch --sourcemap",
|
|
29
|
+
"node:build": "tsup",
|
|
30
|
+
"node:dev": "tsx watch src/node-entry.ts",
|
|
31
|
+
"node:start": "node dist/node-entry.js",
|
|
31
32
|
"test": "vitest run",
|
|
32
33
|
"test:dev": "vitest",
|
|
33
34
|
"release": "pnpm publish",
|
|
@@ -35,7 +36,6 @@
|
|
|
35
36
|
"lint:fix": "eslint . --fix",
|
|
36
37
|
"deploy": "wrangler deploy",
|
|
37
38
|
"cf-typegen": "wrangler types",
|
|
38
|
-
"worker:dev": "wrangler dev",
|
|
39
39
|
"postinstall": "pnpm cf-typegen"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@hono/node-server": "^1.19.6",
|
|
55
|
-
"hono": "^4.10.
|
|
56
|
-
"wrangler": "^4.
|
|
57
|
-
"zod": "^4.1.
|
|
55
|
+
"hono": "^4.10.7",
|
|
56
|
+
"wrangler": "^4.51.0",
|
|
57
|
+
"zod": "^4.1.13"
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"@vue/tsconfig": "^0.8.1",
|
|
52
52
|
"jsdom": "^27.2.0",
|
|
53
53
|
"tailwindcss": "^4.1.17",
|
|
54
|
-
"unplugin-vue-router": "^0.
|
|
54
|
+
"unplugin-vue-router": "^0.18.0",
|
|
55
55
|
"vite": "^7.2.4",
|
|
56
56
|
"vite-plugin-dts": "^4.5.4",
|
|
57
|
-
"vue": "^3.5.
|
|
57
|
+
"vue": "^3.5.25",
|
|
58
58
|
"vue-router": "^4.6.3",
|
|
59
|
-
"vue-tsc": "^3.1.
|
|
59
|
+
"vue-tsc": "^3.1.5"
|
|
60
60
|
}
|
|
61
61
|
}
|