@ykdz/template 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/src/cli.d.ts.map +1 -0
  2. package/dist/{cli.js → src/cli.js} +126 -128
  3. package/dist/{declarations.d.ts → src/declarations.d.ts} +1 -2
  4. package/dist/src/declarations.d.ts.map +1 -0
  5. package/dist/{declarations.js → src/declarations.js} +2 -109
  6. package/dist/src/dependency-catalog.d.ts +10 -0
  7. package/dist/src/dependency-catalog.d.ts.map +1 -0
  8. package/dist/src/dependency-catalog.js +63 -0
  9. package/dist/src/devcontainer.d.ts +18 -0
  10. package/dist/src/devcontainer.d.ts.map +1 -0
  11. package/dist/src/devcontainer.js +24 -0
  12. package/dist/src/editor-customization.d.ts +13 -0
  13. package/dist/src/editor-customization.d.ts.map +1 -0
  14. package/dist/src/editor-customization.js +101 -0
  15. package/dist/src/generation-context.d.ts +24 -0
  16. package/dist/src/generation-context.d.ts.map +1 -0
  17. package/dist/src/generation-context.js +12 -0
  18. package/dist/src/module-graph.d.ts +31 -0
  19. package/dist/src/module-graph.d.ts.map +1 -0
  20. package/dist/src/module-graph.js +48 -0
  21. package/dist/src/next-step-instructions.d.ts +21 -0
  22. package/dist/src/next-step-instructions.d.ts.map +1 -0
  23. package/dist/src/next-step-instructions.js +89 -0
  24. package/dist/src/package-addition.d.ts.map +1 -0
  25. package/dist/src/package-addition.js +188 -0
  26. package/dist/src/preset-projection.d.ts +66 -0
  27. package/dist/src/preset-projection.d.ts.map +1 -0
  28. package/dist/src/preset-projection.js +7 -0
  29. package/dist/src/project-github.d.ts +29 -0
  30. package/dist/src/project-github.d.ts.map +1 -0
  31. package/dist/src/project-github.js +63 -0
  32. package/dist/src/renderer.d.ts.map +1 -0
  33. package/dist/{renderer.js → src/renderer.js} +0 -3
  34. package/dist/src/runtime-paths.d.ts +2 -0
  35. package/dist/src/runtime-paths.d.ts.map +1 -0
  36. package/dist/src/runtime-paths.js +11 -0
  37. package/dist/src/toolchain-resolution.d.ts +35 -0
  38. package/dist/src/toolchain-resolution.d.ts.map +1 -0
  39. package/dist/src/toolchain-resolution.js +192 -0
  40. package/dist/templates/hono-api/projection.d.ts +7 -0
  41. package/dist/templates/hono-api/projection.d.ts.map +1 -0
  42. package/dist/templates/hono-api/projection.js +377 -0
  43. package/dist/templates/projection-plans.d.ts +8 -0
  44. package/dist/templates/projection-plans.d.ts.map +1 -0
  45. package/dist/templates/projection-plans.js +94 -0
  46. package/dist/templates/registry.d.ts +8 -0
  47. package/dist/templates/registry.d.ts.map +1 -0
  48. package/dist/templates/registry.js +42 -0
  49. package/dist/templates/rust-bin/projection.d.ts +10 -0
  50. package/dist/templates/rust-bin/projection.d.ts.map +1 -0
  51. package/dist/templates/rust-bin/projection.js +282 -0
  52. package/dist/templates/ts-lib/projection.d.ts +7 -0
  53. package/dist/templates/ts-lib/projection.d.ts.map +1 -0
  54. package/dist/templates/ts-lib/projection.js +372 -0
  55. package/dist/templates/vue-app/projection.d.ts +7 -0
  56. package/dist/templates/vue-app/projection.d.ts.map +1 -0
  57. package/dist/templates/vue-app/projection.js +594 -0
  58. package/dist/templates/vue-hono-app/projection.d.ts +9 -0
  59. package/dist/templates/vue-hono-app/projection.d.ts.map +1 -0
  60. package/dist/templates/vue-hono-app/projection.js +589 -0
  61. package/package.json +30 -24
  62. package/pnpm-workspace.yaml +34 -0
  63. package/templates/hono-api/projection.ts +453 -0
  64. package/templates/projection-plans.ts +135 -0
  65. package/templates/registry.ts +59 -0
  66. package/templates/rust-bin/.github/dependabot.yml +4 -0
  67. package/templates/rust-bin/.github/workflows/check.yml +6 -1
  68. package/templates/rust-bin/projection.ts +346 -0
  69. package/templates/ts-lib/projection.ts +454 -0
  70. package/templates/vue-app/projection.ts +687 -0
  71. package/templates/vue-app/test/e2e/app.spec.ts +4 -1
  72. package/templates/vue-hono-app/projection.ts +669 -0
  73. package/templates/vue-hono-app/web/test/e2e/app.spec.ts +4 -1
  74. package/dist/cli.d.ts.map +0 -1
  75. package/dist/declarations.d.ts.map +0 -1
  76. package/dist/hono-api.d.ts +0 -2
  77. package/dist/hono-api.d.ts.map +0 -1
  78. package/dist/hono-api.js +0 -208
  79. package/dist/package-addition.d.ts.map +0 -1
  80. package/dist/package-addition.js +0 -560
  81. package/dist/post-commands.d.ts +0 -40
  82. package/dist/post-commands.d.ts.map +0 -1
  83. package/dist/post-commands.js +0 -154
  84. package/dist/renderer.d.ts.map +0 -1
  85. package/dist/rust-bin.d.ts +0 -2
  86. package/dist/rust-bin.d.ts.map +0 -1
  87. package/dist/rust-bin.js +0 -174
  88. package/dist/ts-lib.d.ts +0 -2
  89. package/dist/ts-lib.d.ts.map +0 -1
  90. package/dist/ts-lib.js +0 -181
  91. package/dist/vue-app.d.ts +0 -2
  92. package/dist/vue-app.d.ts.map +0 -1
  93. package/dist/vue-app.js +0 -299
  94. package/dist/vue-hono-app.d.ts +0 -4
  95. package/dist/vue-hono-app.d.ts.map +0 -1
  96. package/dist/vue-hono-app.js +0 -436
  97. package/templates/shared/oxc/package.json +0 -18
  98. package/templates/shared/oxc/tsconfig.json +0 -11
  99. /package/dist/{cli.d.ts → src/cli.d.ts} +0 -0
  100. /package/dist/{package-addition.d.ts → src/package-addition.d.ts} +0 -0
  101. /package/dist/{renderer.d.ts → src/renderer.d.ts} +0 -0
@@ -0,0 +1,282 @@
1
+ import { existsSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { devcontainerNodeFeature } from "../../src/devcontainer.js";
5
+ import { editorCustomizationForCapabilities } from "../../src/editor-customization.js";
6
+ import { renderFixCommand, renderRootCheckCommand, } from "../../src/module-graph.js";
7
+ import { projectCheckWorkflow, projectDependabotConfig, } from "../../src/project-github.js";
8
+ import { renderNewProject } from "../../src/renderer.js";
9
+ const generatedBy = {
10
+ packageName: "@ykdz/template",
11
+ version: "0.0.0",
12
+ command: "template init --preset rust-bin",
13
+ };
14
+ export const rustBinPresetMetadata = {
15
+ name: "rust-bin",
16
+ title: "Rust binary",
17
+ description: "Single-package Rust native binary with rustfmt, clippy, and cargo tests.",
18
+ generation: "supported",
19
+ supportedPackageManagers: ["pnpm"],
20
+ supportedProjectKinds: ["single-package"],
21
+ features: [
22
+ "root-check",
23
+ "fix-command",
24
+ "devcontainer",
25
+ "github-actions",
26
+ "dependabot",
27
+ "rustfmt-clippy",
28
+ "cargo-test",
29
+ ],
30
+ };
31
+ const dependencyMaintenancePolicy = {
32
+ ecosystems: ["npm", "cargo", "github-actions"],
33
+ interval: "weekly",
34
+ };
35
+ const rustPackageBoundary = {
36
+ kind: "package-boundary",
37
+ path: ".",
38
+ };
39
+ function cargoPackageNameFromProjectName(projectName) {
40
+ const slug = projectName
41
+ .normalize("NFKD")
42
+ .replace(/[\u0300-\u036f]/g, "")
43
+ .toLowerCase()
44
+ .replace(/[^a-z0-9]+/g, "-")
45
+ .replace(/^-+|-+$/g, "");
46
+ return slug || "rust-bin";
47
+ }
48
+ export function planRustBinChecks() {
49
+ return {
50
+ components: [
51
+ { kind: "rustfmt-check", owner: rustPackageBoundary },
52
+ { kind: "cargo-clippy", owner: rustPackageBoundary },
53
+ { kind: "cargo-test", owner: rustPackageBoundary },
54
+ ],
55
+ environmentNeeds: [],
56
+ };
57
+ }
58
+ export function planRustBinFixes() {
59
+ return {
60
+ components: [{ kind: "rustfmt-write", owner: rustPackageBoundary }],
61
+ };
62
+ }
63
+ export function rustBinBlueprint() {
64
+ return {
65
+ schemaVersion: 1,
66
+ preset: "rust-bin",
67
+ packageManager: "pnpm",
68
+ projectKind: "single-package",
69
+ features: [...rustBinPresetMetadata.features],
70
+ };
71
+ }
72
+ export function projectRustBinPackageScripts() {
73
+ return {
74
+ check: renderRootCheckCommand(planRustBinChecks()),
75
+ fix: renderFixCommand(planRustBinFixes()),
76
+ };
77
+ }
78
+ function cargoToml(projectName) {
79
+ return [
80
+ "[package]",
81
+ `name = "${projectName}"`,
82
+ 'version = "0.1.0"',
83
+ 'edition = "2024"',
84
+ "",
85
+ "[dependencies]",
86
+ "",
87
+ "[lints]",
88
+ "workspace = true",
89
+ "",
90
+ "[workspace]",
91
+ 'members = ["."]',
92
+ 'resolver = "3"',
93
+ "",
94
+ "[workspace.lints.rust]",
95
+ 'unsafe_code = "forbid"',
96
+ "",
97
+ "[workspace.lints.clippy]",
98
+ 'all = "deny"',
99
+ 'pedantic = "deny"',
100
+ 'nursery = "deny"',
101
+ "",
102
+ "[profile.release]",
103
+ 'strip = "symbols"',
104
+ 'lto = "thin"',
105
+ "codegen-units = 1",
106
+ "",
107
+ ].join("\n");
108
+ }
109
+ function cargoLock(projectName) {
110
+ return [
111
+ "# This file is automatically @generated by Cargo.",
112
+ "# It is not intended for manual editing.",
113
+ "version = 4",
114
+ "",
115
+ "[[package]]",
116
+ `name = "${projectName}"`,
117
+ 'version = "0.1.0"',
118
+ "",
119
+ ].join("\n");
120
+ }
121
+ function packageJson(context, projectName, packageScripts) {
122
+ return {
123
+ name: projectName,
124
+ version: "0.0.0",
125
+ private: true,
126
+ scripts: packageScripts,
127
+ engines: {
128
+ node: context.toolchain.nodeLtsMajor.value,
129
+ },
130
+ packageManager: context.toolchain.packageManagerPin.value,
131
+ };
132
+ }
133
+ function generationRecord(context) {
134
+ return {
135
+ ...generatedBy,
136
+ toolchain: {
137
+ nodeLtsMajor: context.toolchain.nodeLtsMajor.value,
138
+ packageManagerPin: context.toolchain.packageManagerPin.value,
139
+ source: context.toolchain.source,
140
+ },
141
+ };
142
+ }
143
+ function operationsForRustBin(context, projectName, packageScripts, checkPlan) {
144
+ const editorCustomization = editorCustomizationForCapabilities([
145
+ "rust-tooling",
146
+ ]);
147
+ return [
148
+ {
149
+ kind: "writeJson",
150
+ to: "package.json",
151
+ value: packageJson(context, projectName, packageScripts),
152
+ },
153
+ {
154
+ kind: "writeText",
155
+ to: "pnpm-workspace.yaml",
156
+ text: ["packages:", " - .", ""].join("\n"),
157
+ },
158
+ {
159
+ kind: "writeText",
160
+ to: "Cargo.toml",
161
+ text: cargoToml(projectName),
162
+ },
163
+ {
164
+ kind: "writeText",
165
+ to: "Cargo.lock",
166
+ text: cargoLock(projectName),
167
+ },
168
+ {
169
+ kind: "writeText",
170
+ to: "rustfmt.toml",
171
+ text: ['edition = "2024"', "max_width = 100", ""].join("\n"),
172
+ },
173
+ {
174
+ kind: "writeText",
175
+ to: ".gitignore",
176
+ text: ["target", ".env", ""].join("\n"),
177
+ },
178
+ {
179
+ kind: "copyFile",
180
+ from: "src/main.rs",
181
+ to: "src/main.rs",
182
+ },
183
+ {
184
+ kind: "writeJson",
185
+ to: ".project-kit/blueprint.json",
186
+ value: rustBinBlueprint(),
187
+ },
188
+ {
189
+ kind: "writeJson",
190
+ to: ".project-kit/generated-by.json",
191
+ value: generationRecord(context),
192
+ },
193
+ {
194
+ kind: "writeJson",
195
+ to: ".devcontainer/devcontainer.json",
196
+ value: {
197
+ name: `${projectName} Rust development`,
198
+ image: "mcr.microsoft.com/devcontainers/rust:1",
199
+ features: devcontainerNodeFeature({
200
+ nodeVersion: context.toolchain.nodeLtsMajor.value,
201
+ packageManagerPin: context.toolchain.packageManagerPin.value,
202
+ }),
203
+ mounts: [
204
+ "source=${localWorkspaceFolderBasename}-cargo-registry,target=/usr/local/cargo/registry,type=volume",
205
+ "source=${localWorkspaceFolderBasename}-cargo-git,target=/usr/local/cargo/git,type=volume",
206
+ "source=${localWorkspaceFolderBasename}-target,target=${containerWorkspaceFolder}/target,type=volume",
207
+ ],
208
+ customizations: {
209
+ vscode: {
210
+ extensions: editorCustomization.extensions,
211
+ settings: editorCustomization.settings,
212
+ },
213
+ },
214
+ },
215
+ },
216
+ {
217
+ kind: "writeJson",
218
+ to: ".vscode/extensions.json",
219
+ value: {
220
+ recommendations: editorCustomization.extensions,
221
+ },
222
+ },
223
+ {
224
+ kind: "writeJson",
225
+ to: ".vscode/settings.json",
226
+ value: editorCustomization.settings,
227
+ },
228
+ {
229
+ kind: "writeText",
230
+ to: ".github/workflows/check.yml",
231
+ text: projectCheckWorkflow({
232
+ checkPlan,
233
+ environmentPreparation: { rustToolchain: true },
234
+ }),
235
+ },
236
+ {
237
+ kind: "writeText",
238
+ to: ".github/dependabot.yml",
239
+ text: projectDependabotConfig(dependencyMaintenancePolicy),
240
+ },
241
+ ];
242
+ }
243
+ function templateSourceRoot() {
244
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
245
+ const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "rust-bin");
246
+ return existsSync(path.join(publishedTemplateRoot, "src", "main.rs"))
247
+ ? publishedTemplateRoot
248
+ : projectionDir;
249
+ }
250
+ export const rustBinPresetProjection = {
251
+ metadata: rustBinPresetMetadata,
252
+ blueprint: rustBinBlueprint,
253
+ project(context) {
254
+ const checkPlan = planRustBinChecks();
255
+ const fixPlan = planRustBinFixes();
256
+ const packageScripts = projectRustBinPackageScripts();
257
+ const projectName = cargoPackageNameFromProjectName(context.projectName.value);
258
+ return {
259
+ sourceRoot: templateSourceRoot(),
260
+ operations: operationsForRustBin(context, projectName, packageScripts, checkPlan),
261
+ checkPlan,
262
+ fixPlan,
263
+ dependencyMaintenancePolicy,
264
+ packageScripts,
265
+ capabilities: {
266
+ rootCheck: true,
267
+ fixCommand: true,
268
+ githubActions: true,
269
+ dependabot: true,
270
+ devcontainer: true,
271
+ },
272
+ };
273
+ },
274
+ async render({ targetDir, plan }) {
275
+ await renderNewProject({
276
+ sourceRoot: plan.sourceRoot,
277
+ sourceRoots: plan.sourceRoots,
278
+ targetRoot: targetDir,
279
+ operations: [...plan.operations],
280
+ });
281
+ },
282
+ };
@@ -0,0 +1,7 @@
1
+ import type { BuiltInPreset, ProjectBlueprint } from "../../src/declarations.js";
2
+ import type { PresetProjection } from "../../src/preset-projection.js";
3
+ export declare const tsLibPresetMetadata: BuiltInPreset;
4
+ export declare function tsLibBlueprint(): ProjectBlueprint;
5
+ export declare function projectTsLibPackageScripts(): Record<string, string>;
6
+ export declare const tsLibPresetProjection: PresetProjection;
7
+ //# sourceMappingURL=projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../templates/ts-lib/projection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAYnC,OAAO,KAAK,EAGV,gBAAgB,EAEjB,MAAM,gCAAgC,CAAC;AAcxC,eAAO,MAAM,mBAAmB,EAAE,aAiBjC,CAAC;AAgCF,wBAAgB,cAAc,IAAI,gBAAgB,CAQjD;AAED,wBAAgB,0BAA0B,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcnE;AA0SD,eAAO,MAAM,qBAAqB,EAAE,gBA4CnC,CAAC"}
@@ -0,0 +1,372 @@
1
+ import { existsSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { renderGeneratedPnpmWorkspaceYaml } from "../../src/dependency-catalog.js";
5
+ import { nodePnpmDevcontainer } from "../../src/devcontainer.js";
6
+ import { editorCustomizationForCapabilities } from "../../src/editor-customization.js";
7
+ import { renderFixCommand, renderRootCheckCommand, } from "../../src/module-graph.js";
8
+ import { projectCheckWorkflow, projectDependabotConfig, } from "../../src/project-github.js";
9
+ import { renderNewProject } from "../../src/renderer.js";
10
+ const generatedBy = {
11
+ packageName: "@ykdz/template",
12
+ version: "0.0.0",
13
+ command: "template init --preset ts-lib",
14
+ };
15
+ export const tsLibPresetMetadata = {
16
+ name: "ts-lib",
17
+ title: "TypeScript library",
18
+ description: "Strict TypeScript package with pnpm catalog tooling.",
19
+ generation: "supported",
20
+ supportedPackageManagers: ["pnpm"],
21
+ supportedProjectKinds: ["single-package"],
22
+ features: [
23
+ "pnpm-catalog",
24
+ "oxc-format-lint",
25
+ "strict-typescript",
26
+ "root-check",
27
+ "fix-command",
28
+ "devcontainer",
29
+ "github-actions",
30
+ "dependabot",
31
+ ],
32
+ };
33
+ const dependencyMaintenancePolicy = {
34
+ ecosystems: ["npm", "github-actions"],
35
+ interval: "weekly",
36
+ };
37
+ const tsLibPackageBoundary = {
38
+ kind: "package-boundary",
39
+ path: ".",
40
+ };
41
+ function planTsLibChecks() {
42
+ return {
43
+ components: [
44
+ { kind: "typescript-typecheck", owner: tsLibPackageBoundary },
45
+ { kind: "oxc-lint", owner: tsLibPackageBoundary },
46
+ { kind: "oxc-format-check", owner: tsLibPackageBoundary },
47
+ ],
48
+ environmentNeeds: [],
49
+ };
50
+ }
51
+ function planTsLibFixes() {
52
+ return {
53
+ components: [
54
+ { kind: "oxc-format-write", owner: tsLibPackageBoundary },
55
+ { kind: "oxc-lint-fix", owner: tsLibPackageBoundary },
56
+ ],
57
+ };
58
+ }
59
+ export function tsLibBlueprint() {
60
+ return {
61
+ schemaVersion: 1,
62
+ preset: "ts-lib",
63
+ packageManager: "pnpm",
64
+ projectKind: "single-package",
65
+ features: [...tsLibPresetMetadata.features],
66
+ };
67
+ }
68
+ export function projectTsLibPackageScripts() {
69
+ const checkPlan = planTsLibChecks();
70
+ const fixPlan = planTsLibFixes();
71
+ return {
72
+ build: "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
73
+ check: renderRootCheckCommand(checkPlan),
74
+ fix: renderFixCommand(fixPlan),
75
+ "format:check": "oxfmt --check .",
76
+ "format:write": "oxfmt --write .",
77
+ lint: "oxlint . --deny-warnings",
78
+ "lint:fix": "oxlint . --fix --deny-warnings",
79
+ typecheck: "tsc -p tsconfig.json --noEmit",
80
+ };
81
+ }
82
+ function packageJson(context, packageScripts) {
83
+ return {
84
+ name: context.projectName.value,
85
+ version: "0.0.0",
86
+ private: true,
87
+ files: ["dist"],
88
+ type: "module",
89
+ exports: {
90
+ ".": {
91
+ default: "./dist/index.js",
92
+ types: "./dist/index.d.ts",
93
+ },
94
+ },
95
+ scripts: packageScripts,
96
+ devDependencies: {
97
+ "@types/node": "catalog:",
98
+ oxfmt: "catalog:",
99
+ oxlint: "catalog:",
100
+ "tsc-alias": "catalog:",
101
+ typescript: "catalog:",
102
+ },
103
+ engines: {
104
+ node: context.toolchain.nodeLtsMajor.value,
105
+ },
106
+ packageManager: context.toolchain.packageManagerPin.value,
107
+ };
108
+ }
109
+ function generationRecord(context) {
110
+ return {
111
+ ...generatedBy,
112
+ toolchain: {
113
+ nodeLtsMajor: context.toolchain.nodeLtsMajor.value,
114
+ packageManagerPin: context.toolchain.packageManagerPin.value,
115
+ source: context.toolchain.source,
116
+ },
117
+ };
118
+ }
119
+ function operationsForTsLib(context, packageScripts, checkPlan) {
120
+ const editorCustomization = editorCustomizationForCapabilities([
121
+ "oxc-format-lint",
122
+ ]);
123
+ return [
124
+ {
125
+ kind: "writeJson",
126
+ to: "package.json",
127
+ value: packageJson(context, packageScripts),
128
+ multilineArrays: ["files"],
129
+ },
130
+ {
131
+ kind: "writeText",
132
+ to: "pnpm-workspace.yaml",
133
+ text: renderGeneratedPnpmWorkspaceYaml({
134
+ dependencies: [
135
+ "@types/node",
136
+ "oxfmt",
137
+ "oxlint",
138
+ "tsc-alias",
139
+ "typescript",
140
+ ],
141
+ }),
142
+ },
143
+ {
144
+ kind: "writeJson",
145
+ to: "tsconfig.json",
146
+ value: {
147
+ compilerOptions: {
148
+ declaration: true,
149
+ declarationMap: true,
150
+ module: "NodeNext",
151
+ moduleResolution: "NodeNext",
152
+ noEmitOnError: true,
153
+ outDir: "dist",
154
+ paths: {
155
+ "@/*": ["./src/*"],
156
+ },
157
+ rootDir: "src",
158
+ skipLibCheck: false,
159
+ strict: true,
160
+ target: "ES2022",
161
+ types: ["node"],
162
+ },
163
+ include: ["src/**/*.ts"],
164
+ },
165
+ },
166
+ {
167
+ kind: "copyFile",
168
+ sourceRoot: "sharedOxc",
169
+ from: "node/oxlint.config.ts",
170
+ to: "oxlint.config.ts",
171
+ },
172
+ {
173
+ kind: "copyFile",
174
+ sourceRoot: "sharedOxc",
175
+ from: "oxfmt.config.ts",
176
+ to: "oxfmt.config.ts",
177
+ },
178
+ {
179
+ kind: "writeText",
180
+ to: ".gitignore",
181
+ text: ["node_modules", "dist", ".env", ""].join("\n"),
182
+ },
183
+ {
184
+ kind: "copyFile",
185
+ from: "src/index.ts",
186
+ to: "src/index.ts",
187
+ },
188
+ {
189
+ kind: "writeJson",
190
+ to: ".project-kit/blueprint.json",
191
+ value: tsLibBlueprint(),
192
+ },
193
+ {
194
+ kind: "writeJson",
195
+ to: ".project-kit/generated-by.json",
196
+ value: generationRecord(context),
197
+ },
198
+ {
199
+ kind: "writeJson",
200
+ to: ".devcontainer/devcontainer.json",
201
+ value: nodePnpmDevcontainer({
202
+ name: `${context.projectName.value} development`,
203
+ nodeVersion: context.toolchain.nodeLtsMajor.value,
204
+ packageManagerPin: context.toolchain.packageManagerPin.value,
205
+ extensions: editorCustomization.extensions,
206
+ settings: editorCustomization.settings,
207
+ }),
208
+ },
209
+ {
210
+ kind: "writeJson",
211
+ to: ".vscode/extensions.json",
212
+ value: {
213
+ recommendations: editorCustomization.extensions,
214
+ },
215
+ multilineArrays: ["recommendations"],
216
+ },
217
+ {
218
+ kind: "writeJson",
219
+ to: ".vscode/settings.json",
220
+ value: editorCustomization.settings,
221
+ },
222
+ {
223
+ kind: "writeText",
224
+ to: ".github/workflows/check.yml",
225
+ text: projectCheckWorkflow({ checkPlan }),
226
+ },
227
+ {
228
+ kind: "writeText",
229
+ to: ".github/dependabot.yml",
230
+ text: projectDependabotConfig(dependencyMaintenancePolicy),
231
+ },
232
+ ];
233
+ }
234
+ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
235
+ return [
236
+ {
237
+ kind: "writeJson",
238
+ to: `${packagePath}/package.json`,
239
+ value: {
240
+ name: packageName,
241
+ version: "0.0.0",
242
+ private: true,
243
+ files: ["dist"],
244
+ type: "module",
245
+ exports: {
246
+ ".": {
247
+ default: "./dist/index.js",
248
+ types: "./dist/index.d.ts",
249
+ },
250
+ },
251
+ scripts: projectTsLibPackageScripts(),
252
+ devDependencies: {
253
+ "@types/node": "catalog:",
254
+ oxfmt: "catalog:",
255
+ oxlint: "catalog:",
256
+ "tsc-alias": "catalog:",
257
+ typescript: "catalog:",
258
+ },
259
+ engines: {
260
+ node: nodeVersion,
261
+ },
262
+ },
263
+ multilineArrays: ["files"],
264
+ },
265
+ {
266
+ kind: "writeJson",
267
+ to: `${packagePath}/tsconfig.json`,
268
+ value: {
269
+ compilerOptions: {
270
+ composite: true,
271
+ declaration: true,
272
+ declarationMap: true,
273
+ module: "NodeNext",
274
+ moduleResolution: "NodeNext",
275
+ noEmitOnError: true,
276
+ outDir: "dist",
277
+ paths: {
278
+ "@/*": ["./src/*"],
279
+ },
280
+ rootDir: "src",
281
+ skipLibCheck: false,
282
+ strict: true,
283
+ target: "ES2022",
284
+ types: ["node"],
285
+ },
286
+ include: ["src/**/*.ts"],
287
+ },
288
+ },
289
+ {
290
+ kind: "copyFile",
291
+ sourceRoot: "sharedOxc",
292
+ from: "node/oxlint.config.ts",
293
+ to: `${packagePath}/oxlint.config.ts`,
294
+ },
295
+ {
296
+ kind: "copyFile",
297
+ sourceRoot: "sharedOxc",
298
+ from: "oxfmt.config.ts",
299
+ to: `${packagePath}/oxfmt.config.ts`,
300
+ },
301
+ {
302
+ kind: "copyFile",
303
+ from: "src/index.ts",
304
+ to: `${packagePath}/src/index.ts`,
305
+ },
306
+ ];
307
+ }
308
+ function packageAdditionPlan(packageLeafName, packageName, nodeVersion) {
309
+ const packagePath = `packages/${packageLeafName}`;
310
+ return {
311
+ packagePath,
312
+ workspacePackageGlob: "packages/*",
313
+ rootTsconfigReferences: [`./${packagePath}/tsconfig.json`],
314
+ sourceRoot: templateSourceRoot(),
315
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
316
+ operations: packageAdditionOperations(packagePath, packageName, nodeVersion),
317
+ };
318
+ }
319
+ function templateSourceRoot() {
320
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
321
+ const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "ts-lib");
322
+ return existsSync(path.join(publishedTemplateRoot, "src", "index.ts"))
323
+ ? publishedTemplateRoot
324
+ : projectionDir;
325
+ }
326
+ function sharedOxcSourceRoot() {
327
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
328
+ const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
329
+ return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
330
+ ? publishedSharedRoot
331
+ : path.join(projectionDir, "..", "shared", "oxc");
332
+ }
333
+ export const tsLibPresetProjection = {
334
+ metadata: tsLibPresetMetadata,
335
+ capabilities: {
336
+ packageAddition: {
337
+ planPackageAddition({ packageLeafName, packageName, nodeVersion, }) {
338
+ return packageAdditionPlan(packageLeafName, packageName, nodeVersion);
339
+ },
340
+ },
341
+ },
342
+ blueprint: tsLibBlueprint,
343
+ project(context) {
344
+ const checkPlan = planTsLibChecks();
345
+ const fixPlan = planTsLibFixes();
346
+ const packageScripts = projectTsLibPackageScripts();
347
+ return {
348
+ sourceRoot: templateSourceRoot(),
349
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
350
+ operations: operationsForTsLib(context, packageScripts, checkPlan),
351
+ checkPlan,
352
+ fixPlan,
353
+ dependencyMaintenancePolicy,
354
+ packageScripts,
355
+ capabilities: {
356
+ rootCheck: true,
357
+ fixCommand: true,
358
+ githubActions: true,
359
+ dependabot: true,
360
+ devcontainer: true,
361
+ },
362
+ };
363
+ },
364
+ async render({ targetDir, plan }) {
365
+ await renderNewProject({
366
+ sourceRoot: plan.sourceRoot,
367
+ sourceRoots: plan.sourceRoots,
368
+ targetRoot: targetDir,
369
+ operations: [...plan.operations],
370
+ });
371
+ },
372
+ };
@@ -0,0 +1,7 @@
1
+ import type { BuiltInPreset, ProjectBlueprint } from "../../src/declarations.js";
2
+ import type { PresetProjection } from "../../src/preset-projection.js";
3
+ export declare const vueAppPresetMetadata: BuiltInPreset;
4
+ export declare function vueAppBlueprint(): ProjectBlueprint;
5
+ export declare function projectVueAppPackageScripts(): Record<string, string>;
6
+ export declare const vueAppPresetProjection: PresetProjection;
7
+ //# sourceMappingURL=projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../templates/vue-app/projection.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAUnC,OAAO,KAAK,EAGV,gBAAgB,EAEjB,MAAM,gCAAgC,CAAC;AAexC,eAAO,MAAM,oBAAoB,EAAE,aAkBlC,CAAC;AAOF,wBAAgB,eAAe,IAAI,gBAAgB,CAQlD;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAepE;AAgjBD,eAAO,MAAM,sBAAsB,EAAE,gBAsCpC,CAAC"}