@ykdz/template 0.0.7 → 0.0.8

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 (118) hide show
  1. package/dist/{src/cli.js → cli.js} +26 -14
  2. package/node_modules/@ykdz/template-builtin-source/dist/src/index.d.ts +22 -0
  3. package/node_modules/@ykdz/template-builtin-source/dist/src/index.js +92 -0
  4. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.d.ts +6 -0
  5. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +230 -0
  6. package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.d.ts +7 -0
  7. package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.js +94 -0
  8. package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.d.ts +2 -0
  9. package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +15 -0
  10. package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.d.ts +9 -0
  11. package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +103 -0
  12. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.d.ts +6 -0
  13. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +214 -0
  14. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.d.ts +6 -0
  15. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +353 -0
  16. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.d.ts +8 -0
  17. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +203 -0
  18. package/node_modules/@ykdz/template-builtin-source/package.json +46 -0
  19. package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/node/oxlint.config.ts +3 -0
  20. package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/vue/oxlint.config.ts +3 -0
  21. package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.d.ts +7 -4
  22. package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.js +11 -13
  23. package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.js +2 -0
  24. package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.js +3 -1
  25. package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.d.ts +2 -0
  26. package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.js +16 -5
  27. package/node_modules/@ykdz/template-core/dist/package-addition.d.ts +12 -0
  28. package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition.js +11 -10
  29. package/{pnpm-workspace.yaml → node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml} +3 -1
  30. package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.d.ts +1 -3
  31. package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.js +13 -29
  32. package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.d.ts +10 -2
  33. package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.js +22 -49
  34. package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.js +12 -4
  35. package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.js +2 -0
  36. package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.js +1 -1
  37. package/node_modules/@ykdz/template-core/package.json +27 -0
  38. package/package.json +14 -34
  39. package/README.md +0 -35
  40. package/dist/src/package-addition.d.ts +0 -8
  41. /package/dist/{src/cli.d.ts → cli.d.ts} +0 -0
  42. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/dependabot.yml +0 -0
  43. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/workflows/check.yml +0 -0
  44. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/app.ts +0 -0
  45. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/server.ts +0 -0
  46. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/test/app.test.ts +0 -0
  47. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/vitest.config.ts +0 -0
  48. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/preset-source.json +0 -0
  49. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/dependabot.yml +0 -0
  50. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/workflows/check.yml +0 -0
  51. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rust-toolchain.toml +0 -0
  52. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rustfmt.toml +0 -0
  53. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/src/main.rs +0 -0
  54. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/browser-test.Dockerfile +0 -0
  55. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/node-pnpm.Dockerfile +0 -0
  56. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/rust.Dockerfile +0 -0
  57. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/editor-customization/capabilities.json +0 -0
  58. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/oxfmt.config.ts +0 -0
  59. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/dependabot.yml +0 -0
  60. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/workflows/check.yml +0 -0
  61. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/index.ts +0 -0
  62. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/name-schema.ts +0 -0
  63. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/dependabot.yml +0 -0
  64. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/workflows/check.yml +0 -0
  65. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/env.d.ts +0 -0
  66. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/index.html +0 -0
  67. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.config.ts +0 -0
  68. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.package-addition.config.ts +0 -0
  69. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/App.vue +0 -0
  70. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/main.ts +0 -0
  71. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/stores/counter.ts +0 -0
  72. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/style.css +0 -0
  73. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/app.test.ts +0 -0
  74. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/e2e/app.spec.ts +0 -0
  75. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vite.config.ts +0 -0
  76. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vitest.config.ts +0 -0
  77. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/dependabot.yml +0 -0
  78. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/workflows/check.yml +0 -0
  79. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/index.ts +0 -0
  80. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/runtime.ts +0 -0
  81. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/server.ts +0 -0
  82. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/test/app.test.ts +0 -0
  83. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/vitest.config.ts +0 -0
  84. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/env.d.ts +0 -0
  85. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/index.html +0 -0
  86. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/playwright.config.ts +0 -0
  87. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/App.vue +0 -0
  88. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/api.ts +0 -0
  89. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/main.ts +0 -0
  90. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/stores/counter.ts +0 -0
  91. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/style.css +0 -0
  92. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/app.test.ts +0 -0
  93. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/e2e/app.spec.ts +0 -0
  94. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vite.config.ts +0 -0
  95. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vitest.config.ts +0 -0
  96. /package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.d.ts +0 -0
  97. /package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.d.ts +0 -0
  98. /package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.js +0 -0
  99. /package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.d.ts +0 -0
  100. /package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.d.ts +0 -0
  101. /package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.js +0 -0
  102. /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.d.ts +0 -0
  103. /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.js +0 -0
  104. /package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.d.ts +0 -0
  105. /package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.js +0 -0
  106. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.d.ts +0 -0
  107. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.js +0 -0
  108. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.d.ts +0 -0
  109. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.js +0 -0
  110. /package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.d.ts +0 -0
  111. /package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.js +0 -0
  112. /package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.d.ts +0 -0
  113. /package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.js +0 -0
  114. /package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.d.ts +0 -0
  115. /package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.d.ts +0 -0
  116. /package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.d.ts +0 -0
  117. /package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.js +0 -0
  118. /package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.d.ts +0 -0
@@ -0,0 +1,103 @@
1
+ import path from "node:path";
2
+ import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
3
+ import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
4
+ import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
5
+ import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
6
+ import { renderNewProject } from "@ykdz/template-core/renderer";
7
+ export const rustBinPresetMetadata = {
8
+ name: "rust-bin",
9
+ title: "Rust binary",
10
+ description: "Rust native binary workspace with rustfmt, clippy, and cargo tests.",
11
+ generation: "supported",
12
+ supportedPackageManagers: ["pnpm"],
13
+ supportedProjectKinds: ["multi-package"],
14
+ packageAdditionSupport: PackageAdditionSupport.Unsupported,
15
+ features: [
16
+ "root-check",
17
+ "fix-command",
18
+ "devcontainer",
19
+ "github-actions",
20
+ "dependabot",
21
+ "rustfmt-clippy",
22
+ "cargo-test",
23
+ ],
24
+ };
25
+ const rustPackageBoundary = {
26
+ kind: "package-boundary",
27
+ path: ".",
28
+ };
29
+ function cargoPackageNameFromProjectName(projectName) {
30
+ const slug = projectName
31
+ .normalize("NFKD")
32
+ .replace(/[\u0300-\u036f]/g, "")
33
+ .toLowerCase()
34
+ .replace(/[^a-z0-9]+/g, "-")
35
+ .replace(/^-+|-+$/g, "");
36
+ return slug || "rust-bin";
37
+ }
38
+ function projectNameFromDir(targetDir) {
39
+ return path.basename(path.resolve(targetDir));
40
+ }
41
+ function rustWorkspacePackageName(projectName) {
42
+ return `${cargoPackageNameFromProjectName(projectName)}-native`;
43
+ }
44
+ function rustWorkspacePackagePath(projectName) {
45
+ return `packages/${cargoPackageNameFromProjectName(projectName)}`;
46
+ }
47
+ export function planRustBinChecks() {
48
+ return {
49
+ components: [
50
+ { kind: "rustfmt-check", owner: rustPackageBoundary },
51
+ { kind: "cargo-clippy", owner: rustPackageBoundary },
52
+ { kind: "cargo-test", owner: rustPackageBoundary },
53
+ ],
54
+ environmentNeeds: [],
55
+ };
56
+ }
57
+ export function planRustBinFixes() {
58
+ return {
59
+ components: [{ kind: "rustfmt-write", owner: rustPackageBoundary }],
60
+ };
61
+ }
62
+ export function rustBinBlueprint(options = { targetDir: process.cwd() }) {
63
+ const projectName = projectNameFromDir(options.targetDir);
64
+ return {
65
+ schemaVersion: 1,
66
+ preset: "rust-bin",
67
+ packageManager: "pnpm",
68
+ projectKind: "multi-package",
69
+ features: [...rustBinPresetMetadata.features],
70
+ packages: [
71
+ {
72
+ name: rustWorkspacePackageName(projectName),
73
+ path: rustWorkspacePackagePath(projectName),
74
+ },
75
+ ],
76
+ };
77
+ }
78
+ export function projectRustBinPackageScripts() {
79
+ return {
80
+ check: renderRootCheckCommand(planRustBinChecks()),
81
+ fix: renderFixCommand(planRustBinFixes()),
82
+ };
83
+ }
84
+ export const rustBinPresetProjection = {
85
+ metadata: rustBinPresetMetadata,
86
+ blueprint: rustBinBlueprint,
87
+ project(context) {
88
+ return interpretPresetProjectionDeclaration({
89
+ preset: rustBinPresetMetadata,
90
+ declaration: loadBuiltInPresetProjectionDeclaration("rust-bin"),
91
+ context,
92
+ sourceRoots: builtInPresetProjectionSourceRoots(),
93
+ });
94
+ },
95
+ async render({ targetDir, plan }) {
96
+ await renderNewProject({
97
+ sourceRoot: plan.sourceRoot,
98
+ sourceRoots: plan.sourceRoots,
99
+ targetRoot: targetDir,
100
+ operations: [...plan.operations],
101
+ });
102
+ },
103
+ };
@@ -0,0 +1,6 @@
1
+ import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
2
+ import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
3
+ export declare const tsLibPresetMetadata: BuiltInPreset;
4
+ export declare function tsLibBlueprint(options?: PresetBlueprintOptions): ProjectBlueprint;
5
+ export declare function projectTsLibPackageScripts(): Record<string, string>;
6
+ export declare const tsLibPresetProjection: PresetProjection;
@@ -0,0 +1,214 @@
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 { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
6
+ import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
7
+ import { packageManifestExposureFields, planPackageLinks, } from "@ykdz/template-core/package-linking";
8
+ import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
9
+ import { renderNewProject, } from "@ykdz/template-core/renderer";
10
+ export const tsLibPresetMetadata = {
11
+ name: "ts-lib",
12
+ title: "TypeScript library",
13
+ description: "Strict TypeScript package with pnpm catalog tooling.",
14
+ generation: "supported",
15
+ supportedPackageManagers: ["pnpm"],
16
+ supportedProjectKinds: ["multi-package"],
17
+ packageAdditionSupport: PackageAdditionSupport.Supported,
18
+ features: [
19
+ "pnpm-catalog",
20
+ "oxc-format-lint",
21
+ "strict-typescript",
22
+ "root-check",
23
+ "fix-command",
24
+ "devcontainer",
25
+ "github-actions",
26
+ "dependabot",
27
+ ],
28
+ };
29
+ const tsLibPackageBoundary = {
30
+ kind: "package-boundary",
31
+ path: ".",
32
+ };
33
+ function planTsLibPackageChecks() {
34
+ return {
35
+ components: [
36
+ { kind: "typescript-typecheck", owner: tsLibPackageBoundary },
37
+ { kind: "oxc-lint", owner: tsLibPackageBoundary },
38
+ { kind: "oxc-format-check", owner: tsLibPackageBoundary },
39
+ ],
40
+ environmentNeeds: [],
41
+ };
42
+ }
43
+ function planTsLibPackageFixes() {
44
+ return {
45
+ components: [
46
+ { kind: "oxc-format-write", owner: tsLibPackageBoundary },
47
+ { kind: "oxc-lint-fix", owner: tsLibPackageBoundary },
48
+ ],
49
+ };
50
+ }
51
+ function projectNameFromDir(targetDir) {
52
+ return path.basename(path.resolve(targetDir));
53
+ }
54
+ function packageScopeFromOptions(options) {
55
+ return options.scope ?? projectNameFromDir(options.targetDir);
56
+ }
57
+ function scopedPackageName(packageScope, packageLeafName) {
58
+ return `@${packageScope}/${packageLeafName}`;
59
+ }
60
+ export function tsLibBlueprint(options = { targetDir: process.cwd() }) {
61
+ const packageScope = packageScopeFromOptions(options);
62
+ const packageLeafName = projectNameFromDir(options.targetDir);
63
+ return {
64
+ schemaVersion: 1,
65
+ preset: "ts-lib",
66
+ packageManager: "pnpm",
67
+ projectKind: "multi-package",
68
+ features: [...tsLibPresetMetadata.features],
69
+ packages: [
70
+ {
71
+ name: scopedPackageName(packageScope, packageLeafName),
72
+ path: `packages/${packageLeafName}`,
73
+ },
74
+ ],
75
+ };
76
+ }
77
+ export function projectTsLibPackageScripts() {
78
+ const checkPlan = planTsLibPackageChecks();
79
+ const fixPlan = planTsLibPackageFixes();
80
+ return {
81
+ check: renderRootCheckCommand(checkPlan),
82
+ fix: renderFixCommand(fixPlan),
83
+ "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
84
+ "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
85
+ lint: "oxlint --config ../../oxlint.config.ts . --deny-warnings",
86
+ "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix --deny-warnings",
87
+ typecheck: "tsc -p tsconfig.json --noEmit",
88
+ };
89
+ }
90
+ function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
91
+ const packageExposure = planPackageLinks([
92
+ {
93
+ name: packageNameValue,
94
+ path: packagePath,
95
+ role: "shared-library",
96
+ sourcePreset: "ts-lib",
97
+ },
98
+ ]).exposuresByPackagePath.get(packagePath);
99
+ if (packageExposure === undefined) {
100
+ throw new Error(`Missing Package Exposure for ${packagePath}`);
101
+ }
102
+ const exposureFields = packageManifestExposureFields(packageExposure);
103
+ return [
104
+ {
105
+ kind: "writeJson",
106
+ to: `${packagePath}/package.json`,
107
+ value: {
108
+ name: packageNameValue,
109
+ version: "0.0.0",
110
+ private: true,
111
+ type: "module",
112
+ imports: exposureFields.imports,
113
+ exports: exposureFields.exports,
114
+ dependencies: {
115
+ valibot: "catalog:",
116
+ },
117
+ scripts: projectTsLibPackageScripts(),
118
+ devDependencies: {
119
+ "@types/node": "catalog:",
120
+ oxfmt: "catalog:",
121
+ oxlint: "catalog:",
122
+ typescript: "catalog:",
123
+ },
124
+ engines: {
125
+ node: nodeVersion,
126
+ },
127
+ },
128
+ multilineArrays: ["files"],
129
+ },
130
+ {
131
+ kind: "writeJson",
132
+ to: `${packagePath}/tsconfig.json`,
133
+ value: {
134
+ compilerOptions: {
135
+ composite: true,
136
+ declaration: true,
137
+ declarationMap: true,
138
+ module: "NodeNext",
139
+ moduleResolution: "NodeNext",
140
+ noEmitOnError: true,
141
+ rootDir: "src",
142
+ skipLibCheck: false,
143
+ strict: true,
144
+ target: "ES2022",
145
+ types: ["node"],
146
+ },
147
+ include: ["src/**/*.ts"],
148
+ },
149
+ },
150
+ {
151
+ kind: "copyFile",
152
+ from: "src/index.ts",
153
+ to: `${packagePath}/src/index.ts`,
154
+ },
155
+ {
156
+ kind: "copyFile",
157
+ from: "src/name-schema.ts",
158
+ to: `${packagePath}/src/name-schema.ts`,
159
+ },
160
+ ];
161
+ }
162
+ function packageAdditionPlan(packageNameValue, packagePath, nodeVersion) {
163
+ const [workspaceCollection] = packagePath.split("/");
164
+ return {
165
+ packagePath,
166
+ workspacePackageGlob: `${workspaceCollection}/*`,
167
+ packageRole: "shared-library",
168
+ packageSourcePreset: "ts-lib",
169
+ sourceRoot: templateSourceRoot(),
170
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
171
+ operations: packageAdditionOperations(packagePath, packageNameValue, nodeVersion),
172
+ };
173
+ }
174
+ function templateSourceRoot() {
175
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
176
+ const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "ts-lib");
177
+ return existsSync(path.join(publishedTemplateRoot, "src", "index.ts"))
178
+ ? publishedTemplateRoot
179
+ : projectionDir;
180
+ }
181
+ function sharedOxcSourceRoot() {
182
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
183
+ const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
184
+ return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
185
+ ? publishedSharedRoot
186
+ : path.join(projectionDir, "..", "shared", "oxc");
187
+ }
188
+ export const tsLibPresetProjection = {
189
+ metadata: tsLibPresetMetadata,
190
+ capabilities: {
191
+ packageAddition: {
192
+ planPackageAddition({ packageName, packagePath, nodeVersion, }) {
193
+ return packageAdditionPlan(packageName, packagePath, nodeVersion);
194
+ },
195
+ },
196
+ },
197
+ blueprint: tsLibBlueprint,
198
+ project(context) {
199
+ return interpretPresetProjectionDeclaration({
200
+ preset: tsLibPresetMetadata,
201
+ declaration: loadBuiltInPresetProjectionDeclaration("ts-lib"),
202
+ context,
203
+ sourceRoots: builtInPresetProjectionSourceRoots(),
204
+ });
205
+ },
206
+ async render({ targetDir, plan }) {
207
+ await renderNewProject({
208
+ sourceRoot: plan.sourceRoot,
209
+ sourceRoots: plan.sourceRoots,
210
+ targetRoot: targetDir,
211
+ operations: [...plan.operations],
212
+ });
213
+ },
214
+ };
@@ -0,0 +1,6 @@
1
+ import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
2
+ import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
3
+ export declare const vueAppPresetMetadata: BuiltInPreset;
4
+ export declare function vueAppBlueprint(options?: PresetBlueprintOptions): ProjectBlueprint;
5
+ export declare function projectVueAppPackageScripts(): Record<string, string>;
6
+ export declare const vueAppPresetProjection: PresetProjection;
@@ -0,0 +1,353 @@
1
+ import { existsSync } from "node:fs";
2
+ import { readFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
6
+ import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
7
+ import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
8
+ import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
9
+ import { renderNewProject, } from "@ykdz/template-core/renderer";
10
+ export const vueAppPresetMetadata = {
11
+ name: "vue-app",
12
+ title: "Vue app",
13
+ description: "Vue app workspace with Vite, Tailwind, Pinia, and test tooling.",
14
+ generation: "supported",
15
+ supportedPackageManagers: ["pnpm"],
16
+ supportedProjectKinds: ["multi-package"],
17
+ packageAdditionSupport: PackageAdditionSupport.Supported,
18
+ features: [
19
+ "pnpm-catalog",
20
+ "oxc-format-lint",
21
+ "strict-typescript",
22
+ "root-check",
23
+ "fix-command",
24
+ "devcontainer",
25
+ "github-actions",
26
+ "dependabot",
27
+ ],
28
+ };
29
+ const webPackageBoundary = {
30
+ kind: "package-boundary",
31
+ path: ".",
32
+ };
33
+ function planVueAppPackageChecks() {
34
+ return {
35
+ components: [
36
+ { kind: "oxc-format-check", owner: webPackageBoundary },
37
+ { kind: "oxc-lint", owner: webPackageBoundary },
38
+ { kind: "typescript-typecheck", owner: webPackageBoundary },
39
+ { kind: "build", owner: webPackageBoundary },
40
+ { kind: "unit-test", owner: webPackageBoundary },
41
+ { kind: "e2e-test", owner: webPackageBoundary },
42
+ ],
43
+ environmentNeeds: [],
44
+ };
45
+ }
46
+ function planVueAppPackageFixes() {
47
+ return {
48
+ components: [
49
+ { kind: "oxc-format-write", owner: webPackageBoundary },
50
+ { kind: "oxc-lint-fix", owner: webPackageBoundary },
51
+ ],
52
+ };
53
+ }
54
+ function projectNameFromDir(targetDir) {
55
+ return path.basename(path.resolve(targetDir));
56
+ }
57
+ function packageScopeFromOptions(options) {
58
+ return options.scope ?? projectNameFromDir(options.targetDir);
59
+ }
60
+ function scopedPackageName(packageScope) {
61
+ return `@${packageScope}/web`;
62
+ }
63
+ export function vueAppBlueprint(options = { targetDir: process.cwd() }) {
64
+ const packageScope = packageScopeFromOptions(options);
65
+ return {
66
+ schemaVersion: 1,
67
+ preset: "vue-app",
68
+ packageManager: "pnpm",
69
+ projectKind: "multi-package",
70
+ features: [...vueAppPresetMetadata.features],
71
+ packages: [{ name: scopedPackageName(packageScope), path: "apps/web" }],
72
+ };
73
+ }
74
+ export function projectVueAppPackageScripts() {
75
+ return {
76
+ build: "vite build",
77
+ check: renderRootCheckCommand(planVueAppPackageChecks()),
78
+ dev: "vite",
79
+ fix: renderFixCommand(planVueAppPackageFixes()),
80
+ "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
81
+ "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
82
+ lint: "oxlint --config ../../oxlint.config.ts . --deny-warnings",
83
+ "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix --deny-warnings",
84
+ preview: "vite preview",
85
+ test: "vitest run",
86
+ "test:e2e": "pnpm run build && playwright test",
87
+ typecheck: "vue-tsc --build --noEmit",
88
+ };
89
+ }
90
+ function isNodeError(error) {
91
+ return error instanceof Error && "code" in error;
92
+ }
93
+ function localPortsFromText(text) {
94
+ return [
95
+ ...text.matchAll(/port:\s*(\d+)/g),
96
+ ...text.matchAll(/--port\s+(\d+)/g),
97
+ ...text.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1):(\d+)/g),
98
+ ].map((match) => Number(match[1]));
99
+ }
100
+ async function usedPlaywrightPorts(root, blueprint) {
101
+ const ports = new Set();
102
+ for (const projectPackage of blueprint.packages ?? []) {
103
+ try {
104
+ const configText = await readFile(path.join(root, projectPackage.path, "playwright.config.ts"), "utf8");
105
+ for (const port of localPortsFromText(configText)) {
106
+ ports.add(port);
107
+ }
108
+ }
109
+ catch (error) {
110
+ if (!isNodeError(error) || error.code !== "ENOENT") {
111
+ throw error;
112
+ }
113
+ }
114
+ }
115
+ return ports;
116
+ }
117
+ async function nextVuePreviewPort(root, blueprint) {
118
+ const usedPorts = await usedPlaywrightPorts(root, blueprint);
119
+ let port = 4173;
120
+ while (usedPorts.has(port)) {
121
+ port += 1;
122
+ }
123
+ return port;
124
+ }
125
+ function vueAppPlaywrightConfig(previewPort) {
126
+ return `import { defineConfig, devices } from "@playwright/test";
127
+
128
+ const previewUrl = "http://127.0.0.1:${previewPort}";
129
+
130
+ export default defineConfig({
131
+ testDir: "./test/e2e",
132
+ use: {
133
+ baseURL: previewUrl,
134
+ trace: "on-first-retry"
135
+ },
136
+ webServer: {
137
+ command: "pnpm run preview --host 127.0.0.1 --port ${previewPort}",
138
+ reuseExistingServer: !process.env.CI,
139
+ url: previewUrl
140
+ },
141
+ projects: [
142
+ {
143
+ name: "chromium",
144
+ use: { ...devices["Desktop Chrome"] }
145
+ }
146
+ ]
147
+ });
148
+ `;
149
+ }
150
+ function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
151
+ return [
152
+ {
153
+ kind: "writeJson",
154
+ to: `${packagePath}/package.json`,
155
+ value: {
156
+ name: packageNameValue,
157
+ version: "0.0.0",
158
+ private: true,
159
+ type: "module",
160
+ imports: {
161
+ "#/*": {
162
+ default: "./src/*.ts",
163
+ types: "./src/*.ts",
164
+ },
165
+ },
166
+ scripts: projectVueAppPackageScripts(),
167
+ dependencies: {
168
+ "@vueuse/core": "catalog:",
169
+ pinia: "catalog:",
170
+ vue: "catalog:",
171
+ },
172
+ devDependencies: {
173
+ "@playwright/test": "catalog:",
174
+ "@tailwindcss/vite": "catalog:",
175
+ "@types/node": "catalog:",
176
+ "@types/web-bluetooth": "catalog:",
177
+ "@vitejs/plugin-vue": "catalog:",
178
+ "@vue/tsconfig": "catalog:",
179
+ oxfmt: "catalog:",
180
+ oxlint: "catalog:",
181
+ tailwindcss: "catalog:",
182
+ typescript: "catalog:",
183
+ vite: "catalog:",
184
+ vitest: "catalog:",
185
+ "vue-tsc": "catalog:",
186
+ },
187
+ engines: {
188
+ node: nodeVersion,
189
+ },
190
+ },
191
+ },
192
+ {
193
+ kind: "writeJson",
194
+ to: `${packagePath}/tsconfig.json`,
195
+ value: {
196
+ files: [],
197
+ references: [
198
+ { path: "./tsconfig.app.json" },
199
+ { path: "./tsconfig.test.json" },
200
+ { path: "./tsconfig.node.json" },
201
+ ],
202
+ },
203
+ },
204
+ {
205
+ kind: "writeJson",
206
+ to: `${packagePath}/tsconfig.app.json`,
207
+ value: {
208
+ extends: "@vue/tsconfig/tsconfig.dom.json",
209
+ compilerOptions: {
210
+ composite: true,
211
+ module: "ESNext",
212
+ moduleResolution: "Bundler",
213
+ noEmitOnError: true,
214
+ skipLibCheck: false,
215
+ strict: true,
216
+ target: "ES2022",
217
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
218
+ types: ["web-bluetooth"],
219
+ },
220
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue"],
221
+ },
222
+ },
223
+ {
224
+ kind: "writeJson",
225
+ to: `${packagePath}/tsconfig.test.json`,
226
+ value: {
227
+ extends: "./tsconfig.app.json",
228
+ compilerOptions: {
229
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
230
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
231
+ types: ["node", "vitest/globals", "web-bluetooth"],
232
+ },
233
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue", "test/**/*.ts"],
234
+ },
235
+ },
236
+ {
237
+ kind: "writeJson",
238
+ to: `${packagePath}/tsconfig.node.json`,
239
+ value: {
240
+ compilerOptions: {
241
+ composite: true,
242
+ module: "ESNext",
243
+ moduleResolution: "Bundler",
244
+ noEmitOnError: true,
245
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
246
+ skipLibCheck: false,
247
+ strict: true,
248
+ target: "ES2022",
249
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
250
+ types: ["node"],
251
+ },
252
+ include: ["playwright.config.ts", "vite.config.ts", "vitest.config.ts"],
253
+ },
254
+ },
255
+ { kind: "copyFile", from: "env.d.ts", to: `${packagePath}/env.d.ts` },
256
+ { kind: "copyFile", from: "index.html", to: `${packagePath}/index.html` },
257
+ {
258
+ kind: "copyFile",
259
+ from: "playwright.config.ts",
260
+ to: `${packagePath}/playwright.config.ts`,
261
+ },
262
+ {
263
+ kind: "copyFile",
264
+ from: "vite.config.ts",
265
+ to: `${packagePath}/vite.config.ts`,
266
+ },
267
+ {
268
+ kind: "copyFile",
269
+ from: "vitest.config.ts",
270
+ to: `${packagePath}/vitest.config.ts`,
271
+ },
272
+ { kind: "copyFile", from: "src/App.vue", to: `${packagePath}/src/App.vue` },
273
+ { kind: "copyFile", from: "src/main.ts", to: `${packagePath}/src/main.ts` },
274
+ {
275
+ kind: "copyFile",
276
+ from: "src/style.css",
277
+ to: `${packagePath}/src/style.css`,
278
+ },
279
+ {
280
+ kind: "copyFile",
281
+ from: "src/stores/counter.ts",
282
+ to: `${packagePath}/src/stores/counter.ts`,
283
+ },
284
+ {
285
+ kind: "copyFile",
286
+ from: "test/app.test.ts",
287
+ to: `${packagePath}/test/app.test.ts`,
288
+ },
289
+ {
290
+ kind: "copyFile",
291
+ from: "test/e2e/app.spec.ts",
292
+ to: `${packagePath}/test/e2e/app.spec.ts`,
293
+ },
294
+ ];
295
+ }
296
+ async function packageAdditionPlan({ root, blueprint, packageName: packageNameValue, packagePath, nodeVersion, }) {
297
+ const [workspaceCollection] = packagePath.split("/");
298
+ const previewPort = await nextVuePreviewPort(root, blueprint);
299
+ return {
300
+ packagePath,
301
+ workspacePackageGlob: `${workspaceCollection}/*`,
302
+ packageRole: "runtime-service",
303
+ packageSourcePreset: "vue-app",
304
+ sourceRoot: templateSourceRoot(),
305
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
306
+ operations: packageAdditionOperations(packagePath, packageNameValue, nodeVersion),
307
+ textFiles: [
308
+ {
309
+ path: `${packagePath}/playwright.config.ts`,
310
+ text: vueAppPlaywrightConfig(previewPort),
311
+ },
312
+ ],
313
+ };
314
+ }
315
+ function templateSourceRoot() {
316
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
317
+ const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "vue-app");
318
+ return existsSync(path.join(publishedTemplateRoot, "src", "App.vue"))
319
+ ? publishedTemplateRoot
320
+ : projectionDir;
321
+ }
322
+ function sharedOxcSourceRoot() {
323
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
324
+ const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
325
+ return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
326
+ ? publishedSharedRoot
327
+ : path.join(projectionDir, "..", "shared", "oxc");
328
+ }
329
+ export const vueAppPresetProjection = {
330
+ metadata: vueAppPresetMetadata,
331
+ capabilities: {
332
+ packageAddition: {
333
+ planPackageAddition: packageAdditionPlan,
334
+ },
335
+ },
336
+ blueprint: vueAppBlueprint,
337
+ project(context) {
338
+ return interpretPresetProjectionDeclaration({
339
+ preset: vueAppPresetMetadata,
340
+ declaration: loadBuiltInPresetProjectionDeclaration("vue-app"),
341
+ context,
342
+ sourceRoots: builtInPresetProjectionSourceRoots(),
343
+ });
344
+ },
345
+ async render({ targetDir, plan }) {
346
+ await renderNewProject({
347
+ sourceRoot: plan.sourceRoot,
348
+ sourceRoots: plan.sourceRoots,
349
+ targetRoot: targetDir,
350
+ operations: [...plan.operations],
351
+ });
352
+ },
353
+ };
@@ -0,0 +1,8 @@
1
+ import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
2
+ import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
3
+ export declare const vueHonoAppPresetMetadata: BuiltInPreset;
4
+ export declare function vueHonoAppBlueprint(options: PresetBlueprintOptions): ProjectBlueprint;
5
+ export declare function projectVueHonoRootPackageScripts(): Record<string, string>;
6
+ export declare function projectVueHonoApiPackageScripts(): Record<string, string>;
7
+ export declare function projectVueHonoWebPackageScripts(): Record<string, string>;
8
+ export declare const vueHonoAppPresetProjection: PresetProjection;