@ykdz/template 0.0.16 → 0.0.18

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.
Files changed (25) hide show
  1. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +5 -5
  2. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +4 -4
  3. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +5 -5
  4. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +20 -20
  5. package/node_modules/@ykdz/template-builtin-source/package.json +7 -7
  6. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/components/CounterButton.vue +1 -1
  7. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/components/PageShell.vue +1 -1
  8. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+config.ts +2 -2
  9. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/index/+Page.vue +8 -8
  10. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/playwright.config.ts +2 -1
  11. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/test/e2e/app.spec.ts +9 -3
  12. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/test/todos.test.ts +7 -9
  13. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/index.html +2 -2
  14. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/src/App.vue +8 -12
  15. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/test/e2e/app.spec.ts +3 -3
  16. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/index.html +2 -2
  17. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/App.vue +10 -13
  18. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/test/e2e/app.spec.ts +4 -4
  19. package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +1 -0
  20. package/node_modules/@ykdz/template-core/dist/module-graph.js +19 -12
  21. package/node_modules/@ykdz/template-core/dist/package-addition.js +3 -5
  22. package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +27 -25
  23. package/node_modules/@ykdz/template-core/package.json +4 -4
  24. package/node_modules/@ykdz/template-shared/package.json +4 -4
  25. package/package.json +7 -7
@@ -48,13 +48,13 @@ export function honoApiBlueprint(options = { targetDir: process.cwd() }) {
48
48
  export function projectHonoApiPackageScripts() {
49
49
  return {
50
50
  "build:run": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
51
- "format:check:run": "oxfmt --check --config ../../oxfmt.config.ts .",
51
+ "format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
52
52
  "format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
53
- "lint:run": "oxlint --config ../../oxlint.config.ts .",
54
- "lint:fix:run": "oxlint --config ../../oxlint.config.ts . --fix",
53
+ "lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
54
+ "lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
55
55
  start: "node dist/server.js",
56
- "test:run": "vitest run",
57
- "typecheck:run": "tsc -p tsconfig.json --noEmit",
56
+ "test:run": "vitest run --reporter=agent --silent=passed-only",
57
+ "typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
58
58
  };
59
59
  }
60
60
  function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
@@ -53,11 +53,11 @@ export function tsLibBlueprint(options = { targetDir: process.cwd() }) {
53
53
  }
54
54
  export function projectTsLibPackageScripts() {
55
55
  return {
56
- "format:check:run": "oxfmt --check --config ../../oxfmt.config.ts .",
56
+ "format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
57
57
  "format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
58
- "lint:run": "oxlint --config ../../oxlint.config.ts .",
59
- "lint:fix:run": "oxlint --config ../../oxlint.config.ts . --fix",
60
- "typecheck:run": "tsc -p tsconfig.json --noEmit",
58
+ "lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
59
+ "lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
60
+ "typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
61
61
  };
62
62
  }
63
63
  function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
@@ -49,14 +49,14 @@ export function projectVueAppPackageScripts() {
49
49
  return {
50
50
  "build:run": "vite build",
51
51
  dev: "vite",
52
- "format:check:run": "oxfmt --check --config ../../oxfmt.config.ts .",
52
+ "format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
53
53
  "format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
54
- "lint:run": "oxlint --config ../../oxlint.config.ts .",
55
- "lint:fix:run": "oxlint --config ../../oxlint.config.ts . --fix",
54
+ "lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
55
+ "lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
56
56
  preview: "vite preview",
57
- "test:run": "vitest run",
57
+ "test:run": "vitest run --reporter=agent --silent=passed-only",
58
58
  "test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
59
- "typecheck:run": "vue-tsc --build --noEmit",
59
+ "typecheck:run": "vue-tsc --build --noEmit --pretty false",
60
60
  };
61
61
  }
62
62
  function isNodeError(error) {
@@ -1,6 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
3
- import { playwrightBrowserAssetsEnvironmentNeed, renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
3
+ import { playwrightBrowserAssetsEnvironmentNeed, renderFixCommand, renderRootCheckCommand, renderTurboRunCommand, } from "@ykdz/template-core/module-graph";
4
4
  import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
5
5
  import { renderNewProject } from "@ykdz/template-core/renderer";
6
6
  import { PackageAdditionSupport, } from "@ykdz/template-shared";
@@ -92,43 +92,43 @@ export function projectVueHonoRootPackageScripts() {
92
92
  dev: "turbo run dev --parallel",
93
93
  fix: renderFixCommand(planVueHonoRootFixes()),
94
94
  "fix:run": 'node -e ""',
95
- "format:check": "turbo run format:check:run",
96
- "format:check:run": "oxfmt --check oxlint.config.ts oxfmt.config.ts",
97
- "format:write": "turbo run format:write:run",
95
+ "format:check": renderTurboRunCommand(["format:check:run"]),
96
+ "format:check:run": "oxfmt --list-different oxlint.config.ts oxfmt.config.ts",
97
+ "format:write": renderTurboRunCommand(["format:write:run"]),
98
98
  "format:write:run": "oxfmt --write oxlint.config.ts oxfmt.config.ts",
99
- lint: "turbo run lint:run",
100
- "lint:fix": "turbo run lint:fix:run",
101
- "lint:fix:run": "oxlint oxlint.config.ts oxfmt.config.ts --fix",
102
- "lint:run": "oxlint oxlint.config.ts oxfmt.config.ts",
103
- typecheck: "turbo run typecheck:run",
104
- "typecheck:run": "tsc -p tsconfig.config.json --noEmit",
99
+ lint: renderTurboRunCommand(["lint:run"]),
100
+ "lint:fix": renderTurboRunCommand(["lint:fix:run"]),
101
+ "lint:fix:run": "oxlint --format=unix oxlint.config.ts oxfmt.config.ts --fix",
102
+ "lint:run": "oxlint --quiet --format=unix oxlint.config.ts oxfmt.config.ts",
103
+ typecheck: renderTurboRunCommand(["typecheck:run"]),
104
+ "typecheck:run": "tsc -p tsconfig.config.json --noEmit --pretty false",
105
105
  };
106
106
  }
107
107
  export function projectVueHonoApiPackageScripts() {
108
108
  return {
109
109
  "build:run": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
110
110
  dev: "tsx watch src/server.ts",
111
- "format:check:run": "oxfmt --check --config ../../oxfmt.config.ts .",
111
+ "format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
112
112
  "format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
113
- "lint:run": "oxlint --config ../../oxlint.config.ts .",
114
- "lint:fix:run": "oxlint --config ../../oxlint.config.ts . --fix",
113
+ "lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
114
+ "lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
115
115
  start: "node dist/server.js",
116
- "test:run": "vitest run",
117
- "typecheck:run": "tsc -p tsconfig.json --noEmit",
116
+ "test:run": "vitest run --reporter=agent --silent=passed-only",
117
+ "typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
118
118
  };
119
119
  }
120
120
  export function projectVueHonoWebPackageScripts() {
121
121
  return {
122
122
  "build:run": "vite build",
123
123
  dev: "vite",
124
- "format:check:run": "oxfmt --check --config ../../oxfmt.config.ts .",
124
+ "format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
125
125
  "format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
126
- "lint:run": "oxlint --config ../../oxlint.config.ts .",
127
- "lint:fix:run": "oxlint --config ../../oxlint.config.ts . --fix",
126
+ "lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
127
+ "lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
128
128
  preview: "vite preview",
129
- "test:run": "vitest run",
129
+ "test:run": "vitest run --reporter=agent --silent=passed-only",
130
130
  "test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
131
- "typecheck:run": "vue-tsc --build",
131
+ "typecheck:run": "vue-tsc --build --pretty false",
132
132
  };
133
133
  }
134
134
  export const vueHonoAppPresetProjection = {
@@ -35,15 +35,15 @@
35
35
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
36
36
  "check:templates": "pnpm run check:templates:shared-oxc && pnpm run check:templates:static-source",
37
37
  "check:templates:shared-oxc": "pnpm run check:templates:shared-oxc:format && pnpm run check:templates:shared-oxc:lint && pnpm run check:templates:shared-oxc:typecheck",
38
- "check:templates:shared-oxc:format": "oxfmt --check templates/shared/oxc",
39
- "check:templates:shared-oxc:lint": "oxlint --config templates/shared/oxc/node/oxlint.config.ts templates/shared/oxc",
40
- "check:templates:shared-oxc:typecheck": "tsc -p templates/shared/oxc/tsconfig.json --noEmit",
38
+ "check:templates:shared-oxc:format": "oxfmt --list-different templates/shared/oxc",
39
+ "check:templates:shared-oxc:lint": "oxlint --quiet --format=unix --config templates/shared/oxc/node/oxlint.config.ts templates/shared/oxc",
40
+ "check:templates:shared-oxc:typecheck": "tsc -p templates/shared/oxc/tsconfig.json --noEmit --pretty false",
41
41
  "check:templates:static-source": "rustup run stable rustfmt --check templates/rust-bin/src/main.rs",
42
- "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
42
+ "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
43
43
  "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
44
- "lint": "oxlint --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts",
45
- "lint:fix": "oxlint --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts --fix",
46
- "typecheck": "tsc -p tsconfig.json --noEmit"
44
+ "lint": "oxlint --quiet --format=unix --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts",
45
+ "lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts --fix",
46
+ "typecheck": "tsc -p tsconfig.json --noEmit --pretty false"
47
47
  },
48
48
  "dependencies": {
49
49
  "@ykdz/template-core": "workspace:*",
@@ -16,6 +16,6 @@ onMounted(() => {
16
16
  :disabled="!mounted"
17
17
  @click="count += 1"
18
18
  >
19
- Count {{ count }}
19
+ 计数:{{ count }}
20
20
  </button>
21
21
  </template>
@@ -7,7 +7,7 @@ import logoUrl from "#/assets/logo.svg";
7
7
  <header class="border-b border-slate-200 bg-white">
8
8
  <nav class="mx-auto flex max-w-4xl items-center gap-3 px-6 py-4">
9
9
  <img :src="logoUrl" alt="" class="size-8" />
10
- <a href="/" class="font-semibold text-slate-950">Vike App</a>
10
+ <a href="/" class="font-semibold text-slate-950">Vike 应用</a>
11
11
  </nav>
12
12
  </header>
13
13
  <main class="mx-auto max-w-4xl px-6 py-10">
@@ -2,8 +2,8 @@ import vikeVue from "vike-vue/config";
2
2
  import type { Config } from "vike/types";
3
3
 
4
4
  const config: Config = {
5
- title: "Vike App",
6
- description: "Vike, Hono, Telefunc, Drizzle, and Vue.",
5
+ title: "Vike 应用",
6
+ description: "使用 Vike、Hono、Telefunc、Drizzle 和 Vue 的示例应用。",
7
7
  extends: [vikeVue],
8
8
  };
9
9
 
@@ -18,8 +18,8 @@ async function refreshTodos() {
18
18
  } catch (unknownError) {
19
19
  error.value =
20
20
  unknownError instanceof Error
21
- ? unknownError.message
22
- : "Unable to load todos";
21
+ ? `待办加载失败:${unknownError.message}`
22
+ : "无法加载待办事项";
23
23
  }
24
24
  }
25
25
 
@@ -41,10 +41,10 @@ async function submitTodo() {
41
41
  <p class="text-sm font-semibold tracking-wide text-rose-600 uppercase">
42
42
  Vike + Hono
43
43
  </p>
44
- <h1 class="text-4xl font-bold tracking-tight">Full-stack Vike app</h1>
44
+ <h1 class="text-4xl font-bold tracking-tight">全栈 Vike 应用</h1>
45
45
  <p class="max-w-2xl text-lg text-slate-700">
46
- Server-rendered Vue with Hono routing, Telefunc actions, and Drizzle
47
- database access.
46
+ 使用 Hono 路由、Telefunc 动作和 Drizzle 数据访问构建服务端渲染 Vue
47
+ 应用。
48
48
  </p>
49
49
  <CounterButton />
50
50
  </div>
@@ -54,10 +54,10 @@ async function submitTodo() {
54
54
  v-model="title"
55
55
  class="min-w-0 flex-1 rounded border border-slate-300 px-3 py-2"
56
56
  name="title"
57
- placeholder="Add a database-backed todo"
57
+ placeholder="添加一条数据库待办"
58
58
  />
59
59
  <button class="rounded bg-slate-950 px-4 py-2 text-white" type="submit">
60
- Add
60
+ 添加
61
61
  </button>
62
62
  </form>
63
63
 
@@ -66,7 +66,7 @@ async function submitTodo() {
66
66
  type="button"
67
67
  @click="refreshTodos"
68
68
  >
69
- Load todos
69
+ 加载待办事项
70
70
  </button>
71
71
 
72
72
  <p
@@ -9,7 +9,8 @@ export default defineConfig({
9
9
  trace: "on-first-retry",
10
10
  },
11
11
  webServer: {
12
- command: "PORT=4173 node dist/server/index.mjs",
12
+ command:
13
+ "DATABASE_FILE=./node_modules/.tmp/e2e.sqlite pnpm run db:push && DATABASE_FILE=./node_modules/.tmp/e2e.sqlite PORT=4173 node dist/server/index.mjs",
13
14
  reuseExistingServer: !process.env.CI,
14
15
  url: previewUrl,
15
16
  },
@@ -1,10 +1,16 @@
1
1
  import { expect, test } from "@playwright/test";
2
2
 
3
3
  test("renders the Vike home page", async ({ page }) => {
4
+ const todoTitle = `编写生成项目端到端测试 ${Date.now()}`;
5
+
4
6
  await page.goto("/");
5
7
  await expect(
6
- page.getByRole("heading", { name: "Full-stack Vike app" }),
8
+ page.getByRole("heading", { name: "全栈 Vike 应用" }),
7
9
  ).toBeVisible();
8
- await page.getByRole("button", { name: "Count 0" }).click();
9
- await expect(page.getByRole("button", { name: "Count 1" })).toBeVisible();
10
+ await page.getByRole("button", { name: "计数:0" }).click();
11
+ await expect(page.getByRole("button", { name: "计数:1" })).toBeVisible();
12
+
13
+ await page.getByPlaceholder("添加一条数据库待办").fill(todoTitle);
14
+ await page.getByRole("button", { name: "添加" }).click();
15
+ await expect(page.getByText(todoTitle)).toBeVisible();
10
16
  });
@@ -5,16 +5,14 @@ import { createTodo, listTodos } from "#/database/queries/todos";
5
5
 
6
6
  describe("todo queries", () => {
7
7
  it("creates and lists todos through Drizzle SQLite", async () => {
8
- const db = createDatabase(":memory:");
8
+ const db = createDatabase();
9
+ const title = `发布模板 ${Date.now()}`;
9
10
 
10
- db.run(
11
- "CREATE TABLE todos (id integer PRIMARY KEY AUTOINCREMENT NOT NULL, title text NOT NULL, completed integer DEFAULT false NOT NULL, created_at text DEFAULT (CURRENT_TIMESTAMP) NOT NULL)",
12
- );
13
-
14
- await expect(createTodo(db, { title: "Ship" })).resolves.toMatchObject({
15
- id: 1,
16
- title: "Ship",
11
+ await expect(createTodo(db, { title })).resolves.toMatchObject({
12
+ title,
17
13
  });
18
- await expect(listTodos(db)).resolves.toMatchObject([{ title: "Ship" }]);
14
+ await expect(listTodos(db)).resolves.toEqual(
15
+ expect.arrayContaining([expect.objectContaining({ title })]),
16
+ );
19
17
  });
20
18
  });
@@ -1,9 +1,9 @@
1
1
  <!doctype html>
2
- <html lang="en">
2
+ <html lang="zh-CN">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Vue App</title>
6
+ <title>Vue 应用</title>
7
7
  </head>
8
8
  <body>
9
9
  <div id="app"></div>
@@ -6,12 +6,12 @@ import { useCounterStore } from "#/stores/counter";
6
6
 
7
7
  const counter = useCounterStore();
8
8
  const { count } = storeToRefs(counter);
9
- const themeLabel = ref<"dark" | "light">("light");
9
+ const themeLabel = ref<"深色" | "浅色">("浅色");
10
10
 
11
11
  let preferredThemeQuery: MediaQueryList | undefined;
12
12
 
13
13
  function updateThemeLabel(event: MediaQueryList | MediaQueryListEvent): void {
14
- themeLabel.value = event.matches ? "dark" : "light";
14
+ themeLabel.value = event.matches ? "深色" : "浅色";
15
15
  }
16
16
 
17
17
  onMounted(() => {
@@ -31,14 +31,12 @@ onUnmounted(() => {
31
31
  class="mx-auto flex min-h-screen max-w-3xl flex-col justify-center px-6 py-16"
32
32
  >
33
33
  <p class="text-sm font-medium tracking-wide text-cyan-300 uppercase">
34
- Vue app preset
34
+ Vue 应用预设
35
35
  </p>
36
- <h1 class="mt-4 text-4xl font-semibold">
37
- Vue, Vite, Tailwind, and Pinia
38
- </h1>
36
+ <h1 class="mt-4 text-4xl font-semibold">Vue、Vite、Tailwind 和 Pinia</h1>
39
37
  <p class="mt-4 text-lg text-slate-300">
40
- This generated app is ready for strict TypeScript checks, unit tests,
41
- and Playwright.
38
+ 这个生成的应用已经接入严格 TypeScript 检查、单元测试和 Playwright
39
+ 端到端测试。
42
40
  </p>
43
41
  <div class="mt-8 flex items-center gap-4">
44
42
  <button
@@ -46,11 +44,9 @@ onUnmounted(() => {
46
44
  type="button"
47
45
  @click="counter.increment()"
48
46
  >
49
- Count is {{ count }}
47
+ 计数:{{ count }}
50
48
  </button>
51
- <span class="text-sm text-slate-400"
52
- >Preferred theme: {{ themeLabel }}</span
53
- >
49
+ <span class="text-sm text-slate-400">系统主题:{{ themeLabel }}</span>
54
50
  </div>
55
51
  </section>
56
52
  </main>
@@ -4,11 +4,11 @@ test("renders and updates the counter", async ({ page }) => {
4
4
  await page.goto("/");
5
5
 
6
6
  await expect(
7
- page.getByRole("heading", { name: "Vue, Vite, Tailwind, and Pinia" }),
7
+ page.getByRole("heading", { name: "Vue、Vite、Tailwind 和 Pinia" }),
8
8
  ).toBeVisible();
9
- const counterButton = page.getByRole("button", { name: "Count is 0" });
9
+ const counterButton = page.getByRole("button", { name: "计数:0" });
10
10
 
11
11
  await expect(counterButton).toBeVisible();
12
12
  await counterButton.click({ force: true });
13
- await expect(page.getByRole("button", { name: "Count is 1" })).toBeVisible();
13
+ await expect(page.getByRole("button", { name: "计数:1" })).toBeVisible();
14
14
  });
@@ -1,9 +1,9 @@
1
1
  <!doctype html>
2
- <html lang="en">
2
+ <html lang="zh-CN">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Vue Hono app</title>
6
+ <title>Vue Hono 应用</title>
7
7
  </head>
8
8
  <body>
9
9
  <div id="app"></div>
@@ -7,13 +7,13 @@ import { useCounterStore } from "#/stores/counter";
7
7
 
8
8
  const counter = useCounterStore();
9
9
  const { count } = storeToRefs(counter);
10
- const themeLabel = ref<"dark" | "light">("light");
11
- const apiStatus = ref("checking");
10
+ const themeLabel = ref<"深色" | "浅色">("浅色");
11
+ const apiStatus = ref("检查中");
12
12
 
13
13
  let preferredThemeQuery: MediaQueryList | undefined;
14
14
 
15
15
  function updateThemeLabel(event: MediaQueryList | MediaQueryListEvent): void {
16
- themeLabel.value = event.matches ? "dark" : "light";
16
+ themeLabel.value = event.matches ? "深色" : "浅色";
17
17
  }
18
18
 
19
19
  onMounted(() => {
@@ -29,7 +29,7 @@ onUnmounted(() => {
29
29
  onMounted(async () => {
30
30
  const response = await api.api.health.$get();
31
31
  const body = await response.json();
32
- apiStatus.value = body.status;
32
+ apiStatus.value = body.status === "ok" ? "正常" : body.status;
33
33
  });
34
34
  </script>
35
35
 
@@ -39,12 +39,11 @@ onMounted(async () => {
39
39
  class="mx-auto flex min-h-screen max-w-3xl flex-col justify-center px-6 py-16"
40
40
  >
41
41
  <p class="text-sm font-medium tracking-wide text-cyan-300 uppercase">
42
- Vue Hono app preset
42
+ Vue + Hono 应用预设
43
43
  </p>
44
- <h1 class="mt-4 text-4xl font-semibold">Vue, Hono, and typed RPC</h1>
44
+ <h1 class="mt-4 text-4xl font-semibold">Vue、Hono 和类型化 RPC</h1>
45
45
  <p class="mt-4 text-lg text-slate-300">
46
- This generated workspace typechecks the web package against the API
47
- contract.
46
+ 这个生成的工作区会让 Web 包根据 API 契约进行类型检查。
48
47
  </p>
49
48
  <div class="mt-8 flex flex-wrap items-center gap-4">
50
49
  <button
@@ -52,12 +51,10 @@ onMounted(async () => {
52
51
  type="button"
53
52
  @click="counter.increment()"
54
53
  >
55
- Count is {{ count }}
54
+ 计数:{{ count }}
56
55
  </button>
57
- <span class="text-sm text-slate-400"
58
- >Preferred theme: {{ themeLabel }}</span
59
- >
60
- <span class="text-sm text-slate-400">API status: {{ apiStatus }}</span>
56
+ <span class="text-sm text-slate-400">系统主题:{{ themeLabel }}</span>
57
+ <span class="text-sm text-slate-400">API 状态:{{ apiStatus }}</span>
61
58
  </div>
62
59
  </section>
63
60
  </main>
@@ -4,12 +4,12 @@ test("renders the web app and calls the API", async ({ page }) => {
4
4
  await page.goto("/");
5
5
 
6
6
  await expect(
7
- page.getByRole("heading", { name: "Vue, Hono, and typed RPC" }),
7
+ page.getByRole("heading", { name: "Vue、Hono 和类型化 RPC" }),
8
8
  ).toBeVisible();
9
- await expect(page.getByText("API status: ok")).toBeVisible();
10
- const counterButton = page.getByRole("button", { name: "Count is 0" });
9
+ await expect(page.getByText("API 状态:正常")).toBeVisible();
10
+ const counterButton = page.getByRole("button", { name: "计数:0" });
11
11
 
12
12
  await expect(counterButton).toBeVisible();
13
13
  await counterButton.click({ force: true });
14
- await expect(page.getByRole("button", { name: "Count is 1" })).toBeVisible();
14
+ await expect(page.getByRole("button", { name: "计数:1" })).toBeVisible();
15
15
  });
@@ -37,6 +37,7 @@ export type CheckPlan = {
37
37
  export type FixPlan = {
38
38
  readonly components: FixComponent[];
39
39
  };
40
+ export declare function renderTurboRunCommand(taskNames: readonly string[], args?: readonly string[]): string;
40
41
  export declare function checkComponentTaskName(component: CheckComponent): string;
41
42
  export declare function fixComponentTaskName(component: FixComponent): string;
42
43
  export declare function renderCheckLeafCommand(component: CheckComponent): string;
@@ -4,6 +4,13 @@ function renderTurboPackageFilter(owner) {
4
4
  }
5
5
  return `--filter './${owner.path}'`;
6
6
  }
7
+ const turboAgentOutputArgs = [
8
+ "--output-logs=errors-only",
9
+ "--log-order=grouped",
10
+ ];
11
+ export function renderTurboRunCommand(taskNames, args = []) {
12
+ return ["turbo run", ...taskNames, ...args, ...turboAgentOutputArgs].join(" ");
13
+ }
7
14
  export function checkComponentTaskName(component) {
8
15
  return checkComponentTaskNames(component)[0] ?? "check:run";
9
16
  }
@@ -73,17 +80,17 @@ export function renderCheckLeafCommand(component) {
73
80
  case "e2e-test":
74
81
  return "pnpm run test:e2e";
75
82
  case "turbo-check":
76
- return "turbo run check";
83
+ return renderTurboRunCommand(["check"]);
77
84
  case "turbo-package-typecheck":
78
- return `turbo run typecheck ${renderTurboPackageFilter(component.owner)}`;
85
+ return renderTurboRunCommand(["typecheck"], [renderTurboPackageFilter(component.owner)]);
79
86
  case "turbo-package-build":
80
- return `turbo run build ${renderTurboPackageFilter(component.owner)}`;
87
+ return renderTurboRunCommand(["build"], [renderTurboPackageFilter(component.owner)]);
81
88
  case "turbo-package-test":
82
- return `turbo run test ${renderTurboPackageFilter(component.owner)}`;
89
+ return renderTurboRunCommand(["test"], [renderTurboPackageFilter(component.owner)]);
83
90
  case "turbo-package-e2e-test":
84
- return `turbo run test:e2e ${renderTurboPackageFilter(component.owner)}`;
91
+ return renderTurboRunCommand(["test:e2e"], [renderTurboPackageFilter(component.owner)]);
85
92
  case "turbo-package-check":
86
- return `turbo run check ${renderTurboPackageFilter(component.owner)}`;
93
+ return renderTurboRunCommand(["check"], [renderTurboPackageFilter(component.owner)]);
87
94
  case "rustfmt-check":
88
95
  return "cargo fmt --all -- --check";
89
96
  case "cargo-clippy":
@@ -99,24 +106,24 @@ export function renderFixLeafCommand(component) {
99
106
  case "oxc-lint-fix":
100
107
  return "pnpm run lint:fix";
101
108
  case "turbo-fix":
102
- return "turbo run fix";
109
+ return renderTurboRunCommand(["fix"]);
103
110
  case "turbo-package-fix":
104
- return `turbo run fix ${renderTurboPackageFilter(component.owner)}`;
111
+ return renderTurboRunCommand(["fix"], [renderTurboPackageFilter(component.owner)]);
105
112
  case "rustfmt-write":
106
113
  return "cargo fmt --all";
107
114
  }
108
115
  }
109
116
  export function renderRootCheckCommand(plan) {
110
- return `turbo run ${uniqueTaskNames([
117
+ return renderTurboRunCommand(uniqueTaskNames([
111
118
  ...plan.components.flatMap(checkComponentTaskNames),
112
119
  "check:run",
113
- ]).join(" ")}`;
120
+ ]));
114
121
  }
115
122
  export function renderFixCommand(plan) {
116
- return `turbo run ${uniqueTaskNames([
123
+ return renderTurboRunCommand(uniqueTaskNames([
117
124
  ...plan.components.flatMap(fixComponentTaskNames),
118
125
  "fix:run",
119
- ]).join(" ")}`;
126
+ ]));
120
127
  }
121
128
  function playwrightBrowserInstallArgs(need, options = {}) {
122
129
  const installArgs = [
@@ -3,6 +3,7 @@ import path from "node:path";
3
3
  import { validateProjectBlueprint, } from "@ykdz/template-shared";
4
4
  import { PackageAdditionSupport, } from "@ykdz/template-shared";
5
5
  import { collectGeneratedManifestCatalogReferences, pnpmWorkspaceYamlWithCatalogDependencies, } from "./dependency-catalog.js";
6
+ import { renderTurboRunCommand } from "./module-graph.js";
6
7
  import { assertTypeScriptPackageBoundaryForLinkIntent, packageTurboTasks, planPackageLinks, } from "./package-linking.js";
7
8
  import { findPresetSourceManifestPreset, } from "./preset-source.js";
8
9
  import { defaultPackagePathForPresetSourcePackageAddition, planPresetSourcePackageAddition, } from "./projection-capabilities.js";
@@ -385,11 +386,8 @@ function rootScriptWithTurboPackageTasks(options) {
385
386
  const rootCommands = options.script
386
387
  .split(" && ")
387
388
  .filter((command) => !command.startsWith("turbo run "));
388
- const turboCommand = [
389
- "turbo run",
390
- ...options.taskNames,
391
- ...(options.concurrency === undefined ? [] : ["--concurrency=1"]),
392
- ].join(" ");
389
+ const turboArgs = options.concurrency === undefined ? [] : ["--concurrency=1"];
390
+ const turboCommand = renderTurboRunCommand(options.taskNames, turboArgs);
393
391
  return [...rootCommands, turboCommand].join(" && ");
394
392
  }
395
393
  function rootPackageJsonWithPackageTaskFilters(input, blueprint) {
@@ -5,7 +5,7 @@ import { normalizePresetProjectionDeclaration, projectionCapabilityIssues, valid
5
5
  import { collectGeneratedManifestCatalogDependencies, collectGeneratedManifestCatalogReferences, renderGeneratedPnpmWorkspaceYaml, } from "./dependency-catalog.js";
6
6
  import { browserTestToolLayer, checkedDockerfileFirstNodePnpmDevcontainer, dockerfileFirstRustPnpmDevcontainer, nodePnpmToolLayer, rustToolLayer, } from "./devcontainer.js";
7
7
  import { editorCustomizationForCapabilities, loadEditorCustomizationDeclarations, } from "./editor-customization.js";
8
- import { playwrightBrowserAssetsEnvironmentNeed, renderCheckLeafCommand, renderFixCommand, renderFixLeafCommand, renderRootCheckCommand, } from "./module-graph.js";
8
+ import { playwrightBrowserAssetsEnvironmentNeed, renderCheckLeafCommand, renderFixCommand, renderFixLeafCommand, renderRootCheckCommand, renderTurboRunCommand, } from "./module-graph.js";
9
9
  import { packageManifestExposureFields, packageTurboTasks, planPackageLinks, } from "./package-linking.js";
10
10
  export { normalizePresetProjectionDeclaration, projectionCapabilityIssues, validateProjectionCapabilities, };
11
11
  const strictTypescriptRootBoundary = {
@@ -139,8 +139,9 @@ const capabilityInterpreters = {
139
139
  owner: workspacePackageBoundary,
140
140
  });
141
141
  state.rootScriptFragments.typecheck =
142
- "tsc -p tsconfig.config.json --noEmit";
143
- state.packageScriptFragments.typecheck = "tsc -p tsconfig.json --noEmit";
142
+ "tsc -p tsconfig.config.json --noEmit --pretty false";
143
+ state.packageScriptFragments.typecheck =
144
+ "tsc -p tsconfig.json --noEmit --pretty false";
144
145
  state.rootDevDependencies.add("typescript");
145
146
  state.packageDevDependencies.add("@types/node");
146
147
  state.packageDevDependencies.add("typescript");
@@ -173,21 +174,21 @@ const capabilityInterpreters = {
173
174
  });
174
175
  state.packageFixComponents.push({ kind: "oxc-format-write", owner: workspacePackageBoundary }, { kind: "oxc-lint-fix", owner: workspacePackageBoundary });
175
176
  state.rootScriptFragments["format:check"] =
176
- "oxfmt --check oxlint.config.ts oxfmt.config.ts";
177
+ "oxfmt --list-different oxlint.config.ts oxfmt.config.ts";
177
178
  state.rootScriptFragments["format:write"] =
178
179
  "oxfmt --write oxlint.config.ts oxfmt.config.ts";
179
180
  state.rootScriptFragments.lint =
180
- "oxlint oxlint.config.ts oxfmt.config.ts";
181
+ "oxlint --quiet --format=unix oxlint.config.ts oxfmt.config.ts";
181
182
  state.rootScriptFragments["lint:fix"] =
182
- "oxlint oxlint.config.ts oxfmt.config.ts --fix";
183
+ "oxlint --format=unix oxlint.config.ts oxfmt.config.ts --fix";
183
184
  state.packageScriptFragments["format:check"] =
184
- "oxfmt --check --config ../../oxfmt.config.ts .";
185
+ "oxfmt --list-different --config ../../oxfmt.config.ts .";
185
186
  state.packageScriptFragments["format:write"] =
186
187
  "oxfmt --write --config ../../oxfmt.config.ts .";
187
188
  state.packageScriptFragments.lint =
188
- "oxlint --config ../../oxlint.config.ts .";
189
+ "oxlint --quiet --format=unix --config ../../oxlint.config.ts .";
189
190
  state.packageScriptFragments["lint:fix"] =
190
- "oxlint --config ../../oxlint.config.ts . --fix";
191
+ "oxlint --format=unix --config ../../oxlint.config.ts . --fix";
191
192
  state.rootDevDependencies.add("oxfmt");
192
193
  state.rootDevDependencies.add("oxlint");
193
194
  state.rootDevDependencies.add("oxlint-tsgolint");
@@ -850,7 +851,7 @@ function rootTaskEntrypoints(checkPlan, fixPlan) {
850
851
  if (taskName === undefined) {
851
852
  continue;
852
853
  }
853
- entries.push([taskName, `turbo run ${taskName}:run`]);
854
+ entries.push([taskName, renderTurboRunCommand([`${taskName}:run`])]);
854
855
  }
855
856
  return Object.fromEntries(entries);
856
857
  }
@@ -1525,10 +1526,10 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
1525
1526
  }
1526
1527
  function nodePackageScripts(nodePackage, workspace) {
1527
1528
  const oxcScripts = {
1528
- "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
1529
+ "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
1529
1530
  "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
1530
- lint: "oxlint --config ../../oxlint.config.ts .",
1531
- "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix",
1531
+ lint: "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
1532
+ "lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
1532
1533
  };
1533
1534
  if (nodePackage.kind === "hono-api") {
1534
1535
  return {
@@ -1538,26 +1539,27 @@ function nodePackageScripts(nodePackage, workspace) {
1538
1539
  : {}),
1539
1540
  ...leafScriptFragments(oxcScripts),
1540
1541
  start: "node dist/server.js",
1541
- "test:run": "vitest run",
1542
- "typecheck:run": "tsc -p tsconfig.json --noEmit",
1542
+ "test:run": "vitest run --reporter=agent --silent=passed-only",
1543
+ "typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
1543
1544
  };
1544
1545
  }
1545
1546
  if (nodePackage.kind === "vike-app") {
1546
1547
  return {
1547
1548
  "build:run": "vike build",
1548
- dev: "vike dev",
1549
+ dev: "pnpm run db:push && vike dev",
1550
+ "db:push": "mkdir -p data node_modules/.tmp && drizzle-kit push",
1549
1551
  "drizzle:generate": "drizzle-kit generate",
1550
1552
  "drizzle:migrate": "drizzle-kit migrate",
1551
1553
  "drizzle:studio": "drizzle-kit studio",
1552
- "format:check:run": "oxfmt --check --config ../../oxfmt.config.ts .",
1554
+ "format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
1553
1555
  "format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
1554
- "lint:run": "oxlint --type-aware --config ../../oxlint.config.ts .",
1555
- "lint:fix:run": "oxlint --type-aware --config ../../oxlint.config.ts . --fix",
1556
- preview: "vike preview",
1556
+ "lint:run": "oxlint --quiet --format=unix --type-aware --config ../../oxlint.config.ts .",
1557
+ "lint:fix:run": "oxlint --type-aware --format=unix --config ../../oxlint.config.ts . --fix",
1558
+ preview: "pnpm run db:push && vike preview",
1557
1559
  start: "node ./dist/server/index.mjs",
1558
- "test:run": "vitest run",
1560
+ "test:run": "DATABASE_FILE=./node_modules/.tmp/test.sqlite pnpm run db:push && DATABASE_FILE=./node_modules/.tmp/test.sqlite vitest run --reporter=agent --silent=passed-only",
1559
1561
  "test:e2e:run": "playwright test --config playwright.config.ts",
1560
- "typecheck:run": "vue-tsc --build --noEmit",
1562
+ "typecheck:run": "vue-tsc --build --noEmit --pretty false",
1561
1563
  };
1562
1564
  }
1563
1565
  return {
@@ -1565,11 +1567,11 @@ function nodePackageScripts(nodePackage, workspace) {
1565
1567
  dev: "vite",
1566
1568
  ...leafScriptFragments(oxcScripts),
1567
1569
  preview: "vite preview",
1568
- "test:run": "vitest run",
1570
+ "test:run": "vitest run --reporter=agent --silent=passed-only",
1569
1571
  "test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
1570
1572
  "typecheck:run": workspace.packages.length > 1
1571
- ? "vue-tsc --build"
1572
- : "vue-tsc --build --noEmit",
1573
+ ? "vue-tsc --build --pretty false"
1574
+ : "vue-tsc --build --noEmit --pretty false",
1573
1575
  };
1574
1576
  }
1575
1577
  function nodePackageTsconfigOperations(nodePackage, workspace) {
@@ -14,11 +14,11 @@
14
14
  },
15
15
  "scripts": {
16
16
  "build": "rm -rf dist && tsc -p tsconfig.build.json && cp ../../pnpm-workspace.yaml dist/pnpm-workspace.yaml",
17
- "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
17
+ "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
18
18
  "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
19
- "lint": "oxlint --config ../../oxlint.config.ts --ignore-pattern dist .",
20
- "lint:fix": "oxlint --config ../../oxlint.config.ts --ignore-pattern dist . --fix",
21
- "typecheck": "tsc -p tsconfig.json --noEmit"
19
+ "lint": "oxlint --quiet --format=unix --config ../../oxlint.config.ts --ignore-pattern dist .",
20
+ "lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts --ignore-pattern dist . --fix",
21
+ "typecheck": "tsc -p tsconfig.json --noEmit --pretty false"
22
22
  },
23
23
  "dependencies": {
24
24
  "@ykdz/template-shared": "workspace:*",
@@ -14,11 +14,11 @@
14
14
  },
15
15
  "scripts": {
16
16
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
17
- "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
17
+ "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
18
18
  "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
19
- "lint": "oxlint --config ../../oxlint.config.ts --ignore-pattern dist .",
20
- "lint:fix": "oxlint --config ../../oxlint.config.ts --ignore-pattern dist . --fix",
21
- "typecheck": "tsc -p tsconfig.json --noEmit"
19
+ "lint": "oxlint --quiet --format=unix --config ../../oxlint.config.ts --ignore-pattern dist .",
20
+ "lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts --ignore-pattern dist . --fix",
21
+ "typecheck": "tsc -p tsconfig.json --noEmit --pretty false"
22
22
  },
23
23
  "dependencies": {
24
24
  "valibot": "catalog:"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ykdz/template",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "private": false,
5
5
  "description": "Project template generator for YKDZ starter projects.",
6
6
  "keywords": [
@@ -34,9 +34,9 @@
34
34
  "dependencies": {
35
35
  "typescript": "^6.0.3",
36
36
  "valibot": "^1.4.2",
37
+ "@ykdz/template-core": "0.0.0",
37
38
  "@ykdz/template-builtin-source": "0.0.0",
38
- "@ykdz/template-shared": "0.0.0",
39
- "@ykdz/template-core": "0.0.0"
39
+ "@ykdz/template-shared": "0.0.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^24.0.0",
@@ -54,10 +54,10 @@
54
54
  },
55
55
  "scripts": {
56
56
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
57
- "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
57
+ "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
58
58
  "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
59
- "lint": "oxlint --config ../../oxlint.config.ts --ignore-pattern dist .",
60
- "lint:fix": "oxlint --config ../../oxlint.config.ts --ignore-pattern dist . --fix",
61
- "typecheck": "tsc -p tsconfig.json --noEmit"
59
+ "lint": "oxlint --quiet --format=unix --config ../../oxlint.config.ts --ignore-pattern dist .",
60
+ "lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts --ignore-pattern dist . --fix",
61
+ "typecheck": "tsc -p tsconfig.json --noEmit --pretty false"
62
62
  }
63
63
  }