@ykdz/template 0.0.18 → 0.0.20

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 (77) hide show
  1. package/dist/cli.js +61 -24
  2. package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +0 -2
  3. package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +13 -2
  4. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +5 -73
  5. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +3 -2
  6. package/node_modules/@ykdz/template-builtin-source/package.json +36 -3
  7. package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +69 -282
  8. package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/src/main.rs +5 -2
  9. package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/turbo.json +2 -1
  10. package/node_modules/@ykdz/template-builtin-source/templates/ts-lib/turbo.json +2 -1
  11. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{drizzle.config.ts → db/drizzle.config.ts} +2 -2
  12. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{database → db/src}/db.ts +1 -1
  13. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/db/src/index.ts +1 -0
  14. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{database → db/src}/queries/todos.ts +4 -8
  15. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{test → db/test}/todos.test.ts +2 -2
  16. package/node_modules/@ykdz/template-builtin-source/templates/{hono-api → vike-app/db}/turbo.json +2 -1
  17. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/index/+Page.telefunc.ts +3 -1
  18. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/index/+Page.vue +1 -2
  19. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/playwright.config.ts +43 -0
  20. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/scripts/run-playwright.ts +62 -0
  21. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{server → web/server}/app.ts +1 -1
  22. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{test → web/test}/e2e/app.spec.ts +1 -1
  23. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/turbo.json +12 -0
  24. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{types → web/types}/global.d.ts +1 -1
  25. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{vite.config.ts → web/vite.config.ts} +1 -0
  26. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/playwright.config.ts +16 -3
  27. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/scripts/run-playwright.ts +38 -1
  28. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/turbo.json +1 -0
  29. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/api/turbo.json +1 -0
  30. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/playwright.config.ts +7 -9
  31. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/scripts/run-playwright.ts +79 -1
  32. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/App.vue +4 -5
  33. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/api.ts +9 -3
  34. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/test/e2e/app.spec.ts +1 -1
  35. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/turbo.json +1 -0
  36. package/node_modules/@ykdz/template-core/dist/Cargo.lock +16 -0
  37. package/node_modules/@ykdz/template-core/dist/Cargo.toml +12 -0
  38. package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +8 -0
  39. package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +63 -2
  40. package/node_modules/@ykdz/template-core/dist/generated-scenarios.d.ts +1 -1
  41. package/node_modules/@ykdz/template-core/dist/generated-scenarios.js +104 -26
  42. package/node_modules/@ykdz/template-core/dist/next-step-instructions.d.ts +8 -0
  43. package/node_modules/@ykdz/template-core/dist/next-step-instructions.js +65 -0
  44. package/node_modules/@ykdz/template-core/dist/package-addition.js +5 -9
  45. package/node_modules/@ykdz/template-core/dist/package-linking.d.ts +24 -0
  46. package/node_modules/@ykdz/template-core/dist/package-linking.js +35 -0
  47. package/node_modules/@ykdz/template-core/dist/preset-source.d.ts +2 -2
  48. package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +225 -139
  49. package/node_modules/@ykdz/template-core/dist/template-boundary-check.js +46 -10
  50. package/node_modules/@ykdz/template-core/package.json +5 -1
  51. package/node_modules/@ykdz/template-shared/dist/index.d.ts +3 -152
  52. package/node_modules/@ykdz/template-shared/dist/index.js +49 -305
  53. package/node_modules/@ykdz/template-shared/package.json +4 -0
  54. package/package.json +2 -2
  55. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.d.ts +0 -6
  56. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +0 -213
  57. package/node_modules/@ykdz/template-builtin-source/templates/hono-api/.github/dependabot.yml +0 -23
  58. package/node_modules/@ykdz/template-builtin-source/templates/hono-api/.github/workflows/check.yml +0 -19
  59. package/node_modules/@ykdz/template-builtin-source/templates/hono-api/src/app.ts +0 -5
  60. package/node_modules/@ykdz/template-builtin-source/templates/hono-api/src/server.ts +0 -15
  61. package/node_modules/@ykdz/template-builtin-source/templates/hono-api/test/app.test.ts +0 -10
  62. package/node_modules/@ykdz/template-builtin-source/templates/hono-api/vitest.config.ts +0 -15
  63. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/playwright.config.ts +0 -23
  64. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/playwright.package-addition.config.ts +0 -22
  65. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{database → db/src}/schema.ts +0 -0
  66. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{+server.ts → web/+server.ts} +0 -0
  67. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{.env.example → web/.env.example} +0 -0
  68. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{assets → web/assets}/logo.svg +0 -0
  69. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{components → web/components}/CounterButton.vue +0 -0
  70. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{components → web/components}/PageShell.vue +0 -0
  71. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/+Head.vue +0 -0
  72. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/+Layout.vue +0 -0
  73. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/+config.ts +0 -0
  74. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/tailwind.css +0 -0
  75. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{server → web/server}/api.ts +0 -0
  76. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{types → web/types}/env.d.ts +0 -0
  77. /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{vitest.config.ts → web/vitest.config.ts} +0 -0
@@ -1,213 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import path from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
5
- import { packageManifestExposureFields, planPackageLinks, } from "@ykdz/template-core/package-linking";
6
- import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
7
- import { renderNewProject, } from "@ykdz/template-core/renderer";
8
- import { PackageAdditionSupport, } from "@ykdz/template-shared";
9
- export const honoApiPresetMetadata = {
10
- name: "hono-api",
11
- title: "Hono API",
12
- description: "Hono Node API workspace with strict TypeScript tooling.",
13
- generation: "supported",
14
- supportedPackageManagers: ["pnpm"],
15
- supportedProjectKinds: ["multi-package"],
16
- packageAdditionSupport: PackageAdditionSupport.Supported,
17
- features: [
18
- "pnpm-catalog",
19
- "oxc-format-lint",
20
- "strict-typescript",
21
- "root-check",
22
- "fix-command",
23
- "devcontainer",
24
- "github-actions",
25
- "dependabot",
26
- ],
27
- };
28
- function projectNameFromDir(targetDir) {
29
- return path.basename(path.resolve(targetDir));
30
- }
31
- function packageScopeFromOptions(options) {
32
- return options.scope ?? projectNameFromDir(options.targetDir);
33
- }
34
- function scopedPackageName(packageScope) {
35
- return `@${packageScope}/api`;
36
- }
37
- export function honoApiBlueprint(options = { targetDir: process.cwd() }) {
38
- const packageScope = packageScopeFromOptions(options);
39
- return {
40
- schemaVersion: 1,
41
- preset: "hono-api",
42
- packageManager: "pnpm",
43
- projectKind: "multi-package",
44
- features: [...honoApiPresetMetadata.features],
45
- packages: [{ name: scopedPackageName(packageScope), path: "apps/api" }],
46
- };
47
- }
48
- export function projectHonoApiPackageScripts() {
49
- return {
50
- "build:run": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
51
- "format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
52
- "format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
53
- "lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
54
- "lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
55
- start: "node dist/server.js",
56
- "test:run": "vitest run --reporter=agent --silent=passed-only",
57
- "typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
58
- };
59
- }
60
- function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
61
- const packageExposure = planPackageLinks([
62
- {
63
- name: packageNameValue,
64
- path: packagePath,
65
- role: "runtime-service",
66
- sourcePreset: "hono-api",
67
- },
68
- ]).exposuresByPackagePath.get(packagePath);
69
- if (packageExposure === undefined) {
70
- throw new Error(`Missing Package Exposure for ${packagePath}`);
71
- }
72
- const exposureFields = packageManifestExposureFields(packageExposure);
73
- return [
74
- {
75
- kind: "writeJson",
76
- to: `${packagePath}/package.json`,
77
- value: {
78
- name: packageNameValue,
79
- version: "0.0.0",
80
- private: true,
81
- type: "module",
82
- types: exposureFields.types,
83
- exports: exposureFields.exports,
84
- imports: exposureFields.imports,
85
- scripts: projectHonoApiPackageScripts(),
86
- dependencies: {
87
- "@hono/node-server": "catalog:",
88
- hono: "catalog:",
89
- },
90
- devDependencies: {
91
- "@types/node": "catalog:",
92
- oxfmt: "catalog:",
93
- oxlint: "catalog:",
94
- "oxlint-tsgolint": "catalog:",
95
- "tsc-alias": "catalog:",
96
- typescript: "catalog:",
97
- vitest: "catalog:",
98
- },
99
- engines: {
100
- node: nodeVersion,
101
- },
102
- },
103
- },
104
- {
105
- kind: "writeJson",
106
- to: `${packagePath}/tsconfig.json`,
107
- value: {
108
- compilerOptions: {
109
- composite: true,
110
- erasableSyntaxOnly: true,
111
- exactOptionalPropertyTypes: true,
112
- forceConsistentCasingInFileNames: true,
113
- isolatedModules: true,
114
- module: "nodenext",
115
- moduleResolution: "nodenext",
116
- noEmitOnError: true,
117
- noFallthroughCasesInSwitch: true,
118
- noImplicitOverride: true,
119
- noImplicitReturns: true,
120
- noUncheckedIndexedAccess: true,
121
- skipLibCheck: false,
122
- strict: true,
123
- target: "es2023",
124
- types: ["node", "vitest/globals"],
125
- verbatimModuleSyntax: true,
126
- },
127
- include: ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
128
- },
129
- },
130
- {
131
- kind: "writeJson",
132
- to: `${packagePath}/tsconfig.build.json`,
133
- value: {
134
- extends: "./tsconfig.json",
135
- compilerOptions: {
136
- outDir: "dist",
137
- rootDir: "src",
138
- types: ["node"],
139
- },
140
- include: ["src/**/*.ts"],
141
- },
142
- },
143
- { kind: "copyFile", from: "src/app.ts", to: `${packagePath}/src/app.ts` },
144
- {
145
- kind: "copyFile",
146
- from: "src/server.ts",
147
- to: `${packagePath}/src/server.ts`,
148
- },
149
- {
150
- kind: "copyFile",
151
- from: "test/app.test.ts",
152
- to: `${packagePath}/test/app.test.ts`,
153
- },
154
- {
155
- kind: "copyFile",
156
- from: "vitest.config.ts",
157
- to: `${packagePath}/vitest.config.ts`,
158
- },
159
- ];
160
- }
161
- function packageAdditionPlan(packageNameValue, packagePath, nodeVersion) {
162
- const [workspaceCollection] = packagePath.split("/");
163
- return {
164
- packagePath,
165
- workspacePackageGlob: `${workspaceCollection}/*`,
166
- packageRole: "runtime-service",
167
- packageSourcePreset: "hono-api",
168
- sourceRoot: templateSourceRoot(),
169
- sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
170
- operations: packageAdditionOperations(packagePath, packageNameValue, nodeVersion),
171
- };
172
- }
173
- function templateSourceRoot() {
174
- const projectionDir = path.dirname(fileURLToPath(import.meta.url));
175
- const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "hono-api");
176
- return existsSync(path.join(publishedTemplateRoot, "src", "app.ts"))
177
- ? publishedTemplateRoot
178
- : projectionDir;
179
- }
180
- function sharedOxcSourceRoot() {
181
- const projectionDir = path.dirname(fileURLToPath(import.meta.url));
182
- const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
183
- return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
184
- ? publishedSharedRoot
185
- : path.join(projectionDir, "..", "shared", "oxc");
186
- }
187
- export const honoApiPresetProjection = {
188
- metadata: honoApiPresetMetadata,
189
- capabilities: {
190
- packageAddition: {
191
- planPackageAddition({ packageName, packagePath, nodeVersion, }) {
192
- return packageAdditionPlan(packageName, packagePath, nodeVersion);
193
- },
194
- },
195
- },
196
- blueprint: honoApiBlueprint,
197
- project(context) {
198
- return interpretPresetProjectionDeclaration({
199
- preset: honoApiPresetMetadata,
200
- declaration: loadBuiltInPresetProjectionDeclaration("hono-api"),
201
- context,
202
- sourceRoots: builtInPresetProjectionSourceRoots(),
203
- });
204
- },
205
- async render({ targetDir, plan }) {
206
- await renderNewProject({
207
- sourceRoot: plan.sourceRoot,
208
- sourceRoots: plan.sourceRoots,
209
- targetRoot: targetDir,
210
- operations: [...plan.operations],
211
- });
212
- },
213
- };
@@ -1,23 +0,0 @@
1
- version: 2
2
-
3
- updates:
4
- - package-ecosystem: npm
5
- directory: /
6
- schedule:
7
- interval: weekly
8
- ignore:
9
- - dependency-name: "@types/node"
10
- update-types:
11
- - version-update:semver-major
12
- - package-ecosystem: github-actions
13
- directory: /
14
- schedule:
15
- interval: weekly
16
- - package-ecosystem: docker
17
- directory: /.devcontainer
18
- schedule:
19
- interval: weekly
20
- ignore:
21
- - dependency-name: mcr.microsoft.com/devcontainers/typescript-node
22
- update-types:
23
- - version-update:semver-major
@@ -1,19 +0,0 @@
1
- name: Check
2
-
3
- on:
4
- pull_request:
5
- push:
6
- branches:
7
- - main
8
-
9
- jobs:
10
- check:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v7
14
- - uses: actions/setup-node@v6
15
- with:
16
- node-version-file: package.json
17
- - run: corepack enable
18
- - run: pnpm install
19
- - run: pnpm run check
@@ -1,5 +0,0 @@
1
- import { Hono } from "hono";
2
-
3
- export const app = new Hono();
4
-
5
- app.get("/health", (context) => context.json({ status: "ok" }));
@@ -1,15 +0,0 @@
1
- import { serve } from "@hono/node-server";
2
-
3
- import { app } from "#/app";
4
-
5
- const port = Number.parseInt(process.env.PORT ?? "3000", 10);
6
-
7
- serve(
8
- {
9
- fetch: app.fetch,
10
- port,
11
- },
12
- (info) => {
13
- console.log(`Hono API listening on http://localhost:${info.port}`);
14
- },
15
- );
@@ -1,10 +0,0 @@
1
- import { app } from "#/app";
2
-
3
- describe("Hono API", () => {
4
- it("responds to the health route", async () => {
5
- const response = await app.request("/health");
6
-
7
- expect(response.status).toBe(200);
8
- await expect(response.json()).resolves.toEqual({ status: "ok" });
9
- });
10
- });
@@ -1,15 +0,0 @@
1
- import { fileURLToPath, URL } from "node:url";
2
-
3
- import { defineConfig } from "vitest/config";
4
-
5
- export default defineConfig({
6
- resolve: {
7
- alias: {
8
- "#": fileURLToPath(new URL("./src", import.meta.url)),
9
- "@": fileURLToPath(new URL("./src", import.meta.url)),
10
- },
11
- },
12
- test: {
13
- globals: true,
14
- },
15
- });
@@ -1,23 +0,0 @@
1
- import { defineConfig, devices } from "@playwright/test";
2
-
3
- const previewUrl = "http://127.0.0.1:4173";
4
-
5
- export default defineConfig({
6
- testDir: "./test/e2e",
7
- use: {
8
- baseURL: previewUrl,
9
- trace: "on-first-retry",
10
- },
11
- webServer: {
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",
14
- reuseExistingServer: !process.env.CI,
15
- url: previewUrl,
16
- },
17
- projects: [
18
- {
19
- name: "chromium",
20
- use: { ...devices["Desktop Chrome"] },
21
- },
22
- ],
23
- });
@@ -1,22 +0,0 @@
1
- import { defineConfig, devices } from "@playwright/test";
2
-
3
- const previewUrl = "http://127.0.0.1:{{VUE_PREVIEW_PORT}}";
4
-
5
- export default defineConfig({
6
- testDir: "./test/e2e",
7
- use: {
8
- baseURL: previewUrl,
9
- trace: "on-first-retry",
10
- },
11
- webServer: {
12
- command: "pnpm run preview --host 127.0.0.1 --port {{VUE_PREVIEW_PORT}}",
13
- reuseExistingServer: !process.env.CI,
14
- url: previewUrl,
15
- },
16
- projects: [
17
- {
18
- name: "chromium",
19
- use: { ...devices["Desktop Chrome"] },
20
- },
21
- ],
22
- });