@ykdz/template 0.0.0

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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +353 -0
  6. package/dist/declarations.d.ts +166 -0
  7. package/dist/declarations.d.ts.map +1 -0
  8. package/dist/declarations.js +340 -0
  9. package/dist/hono-api.d.ts +2 -0
  10. package/dist/hono-api.d.ts.map +1 -0
  11. package/dist/hono-api.js +247 -0
  12. package/dist/package-addition.d.ts +7 -0
  13. package/dist/package-addition.d.ts.map +1 -0
  14. package/dist/package-addition.js +580 -0
  15. package/dist/renderer.d.ts +44 -0
  16. package/dist/renderer.d.ts.map +1 -0
  17. package/dist/renderer.js +379 -0
  18. package/dist/rust-bin.d.ts +2 -0
  19. package/dist/rust-bin.d.ts.map +1 -0
  20. package/dist/rust-bin.js +206 -0
  21. package/dist/ts-lib.d.ts +2 -0
  22. package/dist/ts-lib.d.ts.map +1 -0
  23. package/dist/ts-lib.js +220 -0
  24. package/dist/vue-app.d.ts +2 -0
  25. package/dist/vue-app.d.ts.map +1 -0
  26. package/dist/vue-app.js +339 -0
  27. package/dist/vue-hono-app.d.ts +4 -0
  28. package/dist/vue-hono-app.d.ts.map +1 -0
  29. package/dist/vue-hono-app.js +484 -0
  30. package/package.json +54 -0
  31. package/templates/hono-api/src/app.ts +5 -0
  32. package/templates/hono-api/src/server.ts +14 -0
  33. package/templates/hono-api/test/app.test.ts +10 -0
  34. package/templates/hono-api/vitest.config.ts +13 -0
  35. package/templates/rust-bin/src/main.rs +18 -0
  36. package/templates/ts-lib/src/index.ts +7 -0
  37. package/templates/vue-app/env.d.ts +1 -0
  38. package/templates/vue-app/index.html +12 -0
  39. package/templates/vue-app/playwright.config.ts +20 -0
  40. package/templates/vue-app/src/App.vue +33 -0
  41. package/templates/vue-app/src/main.ts +6 -0
  42. package/templates/vue-app/src/stores/counter.ts +12 -0
  43. package/templates/vue-app/src/style.css +1 -0
  44. package/templates/vue-app/test/app.test.ts +13 -0
  45. package/templates/vue-app/test/e2e/app.spec.ts +9 -0
  46. package/templates/vue-app/vite.config.ts +13 -0
  47. package/templates/vue-app/vitest.config.ts +14 -0
  48. package/templates/vue-hono-app/api/src/index.ts +3 -0
  49. package/templates/vue-hono-app/api/src/runtime.ts +5 -0
  50. package/templates/vue-hono-app/api/src/server.ts +14 -0
  51. package/templates/vue-hono-app/api/test/app.test.ts +10 -0
  52. package/templates/vue-hono-app/api/vitest.config.ts +7 -0
  53. package/templates/vue-hono-app/web/env.d.ts +9 -0
  54. package/templates/vue-hono-app/web/index.html +12 -0
  55. package/templates/vue-hono-app/web/playwright.config.ts +21 -0
  56. package/templates/vue-hono-app/web/src/App.vue +42 -0
  57. package/templates/vue-hono-app/web/src/api.ts +8 -0
  58. package/templates/vue-hono-app/web/src/main.ts +6 -0
  59. package/templates/vue-hono-app/web/src/stores/counter.ts +12 -0
  60. package/templates/vue-hono-app/web/src/style.css +1 -0
  61. package/templates/vue-hono-app/web/test/app.test.ts +13 -0
  62. package/templates/vue-hono-app/web/test/e2e/app.spec.ts +10 -0
  63. package/templates/vue-hono-app/web/vite.config.ts +29 -0
  64. package/templates/vue-hono-app/web/vitest.config.ts +16 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 YKDZ
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # @ykdz/template
2
+
3
+ Project template generator for YKDZ starter projects.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ pnpm dlx @ykdz/template init my-project --preset ts-lib --yes
9
+ ```
10
+
11
+ Available commands:
12
+
13
+ ```sh
14
+ template init <dir> --preset <name> --yes
15
+ template add package --preset <name> --name <name>
16
+ template presets
17
+ template schema preset
18
+ template schema blueprint
19
+ template preset validate <path>
20
+ template blueprint validate <path>
21
+ ```
22
+
23
+ Supported presets are `ts-lib`, `hono-api`, `vue-app`, `vue-hono-app`, and
24
+ `rust-bin`.
25
+
26
+ ## Publishing
27
+
28
+ This package is intended to publish through npm Trusted Publishing from the
29
+ GitHub Actions release workflow. Maintainers should complete
30
+ [the Trusted Publishing checklist](docs/npm-trusted-publishing.md) before the
31
+ first public release.
32
+
33
+ ## License
34
+
35
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,353 @@
1
+ #!/usr/bin/env node
2
+ import { readFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { createInterface } from "node:readline/promises";
5
+ import { initHonoApiProject } from "./hono-api.js";
6
+ import { initRustBinProject } from "./rust-bin.js";
7
+ import { initTsLibProject } from "./ts-lib.js";
8
+ import { initVueHonoAppProject } from "./vue-hono-app.js";
9
+ import { initVueAppProject } from "./vue-app.js";
10
+ import { addPackage } from "./package-addition.js";
11
+ import { blueprintJsonSchema, builtInPresets, presetFileJsonSchema, validatePresetFile, validateProjectBlueprint } from "./declarations.js";
12
+ function usage() {
13
+ return [
14
+ "Usage:",
15
+ " template init <dir> --preset <name> --yes",
16
+ " template add package --preset <name> --name <name>",
17
+ " template presets",
18
+ " template schema preset",
19
+ " template schema blueprint",
20
+ " template preset validate <path>",
21
+ " template blueprint validate <path>",
22
+ "",
23
+ "Options:",
24
+ " --preset <name> Project preset to generate",
25
+ " --name <name> Package name to add",
26
+ " --scope <name> Package scope for workspace package names",
27
+ " --yes Accept defaults for non-interactive generation",
28
+ " --dry-run Print the planned generation without writing files",
29
+ " --json Print machine-readable output"
30
+ ].join("\n");
31
+ }
32
+ function printJson(value) {
33
+ console.log(JSON.stringify(value, null, 2));
34
+ }
35
+ async function readJsonDeclaration(filePath) {
36
+ if (path.extname(filePath) !== ".json") {
37
+ throw new Error(`Declaration files must be JSON: ${filePath}`);
38
+ }
39
+ try {
40
+ return JSON.parse(await readFile(filePath, "utf8"));
41
+ }
42
+ catch (error) {
43
+ if (error instanceof SyntaxError) {
44
+ throw new Error(`Invalid JSON in ${filePath}: ${error.message}`);
45
+ }
46
+ throw error;
47
+ }
48
+ }
49
+ function formatValidationIssues(issues) {
50
+ return issues.map((issue) => ` - ${issue.path}: ${issue.message}`).join("\n");
51
+ }
52
+ function formatPresetCatalog() {
53
+ return [
54
+ "Built-in presets",
55
+ ...builtInPresets.map((preset) => ` ${preset.name.padEnd(8)} ${preset.title} (${preset.generation}) - ${preset.description}`)
56
+ ].join("\n");
57
+ }
58
+ function parseInitOptions(args) {
59
+ const dir = args[1];
60
+ let preset = "";
61
+ let yes = false;
62
+ let dryRun = false;
63
+ let json = false;
64
+ let scope;
65
+ for (let index = 2; index < args.length; index += 1) {
66
+ const arg = args[index];
67
+ if (arg === "--yes" || arg === "-y") {
68
+ yes = true;
69
+ continue;
70
+ }
71
+ if (arg === "--dry-run") {
72
+ dryRun = true;
73
+ continue;
74
+ }
75
+ if (arg === "--json") {
76
+ json = true;
77
+ continue;
78
+ }
79
+ if (arg === "--scope") {
80
+ const value = args[index + 1];
81
+ if (!value) {
82
+ throw new Error("--scope requires a value");
83
+ }
84
+ scope = normalizeNpmScope(value);
85
+ index += 1;
86
+ continue;
87
+ }
88
+ if (arg === "--preset") {
89
+ const value = args[index + 1];
90
+ if (!value) {
91
+ throw new Error("--preset requires a value");
92
+ }
93
+ preset = value;
94
+ index += 1;
95
+ continue;
96
+ }
97
+ throw new Error(`Unknown option: ${arg}`);
98
+ }
99
+ if (!dir) {
100
+ throw new Error("init requires a target directory");
101
+ }
102
+ return { dir, preset, yes, dryRun, json, scope };
103
+ }
104
+ function normalizeNpmScope(value) {
105
+ if (value !== value.trim() || /\s/.test(value)) {
106
+ throw new Error("--scope must be a valid npm scope without whitespace");
107
+ }
108
+ const scope = value.startsWith("@") ? value.slice(1) : value;
109
+ if (!/^[a-z0-9][a-z0-9._-]*$/.test(scope)) {
110
+ throw new Error("--scope must be a valid npm scope");
111
+ }
112
+ return scope;
113
+ }
114
+ function supportedPreset(name) {
115
+ const preset = builtInPresets.find((candidate) => candidate.name === name && candidate.generation === "supported");
116
+ if (!preset) {
117
+ throw new Error("Only the ts-lib, hono-api, vue-app, vue-hono-app, and rust-bin presets are supported in this version");
118
+ }
119
+ return preset;
120
+ }
121
+ function projectNameFromDir(targetDir) {
122
+ return path.basename(path.resolve(targetDir));
123
+ }
124
+ function scopeFromOptions(projectName, scope) {
125
+ return scope ?? projectName;
126
+ }
127
+ function blueprintForInit(options) {
128
+ const preset = supportedPreset(options.preset);
129
+ const projectName = projectNameFromDir(options.dir);
130
+ const packageScope = scopeFromOptions(projectName, options.scope);
131
+ const blueprint = {
132
+ schemaVersion: 1,
133
+ preset: preset.name,
134
+ projectKind: preset.supportedProjectKinds[0],
135
+ features: [...preset.features]
136
+ };
137
+ if (preset.supportedPackageManagers[0]) {
138
+ blueprint.packageManager = preset.supportedPackageManagers[0];
139
+ }
140
+ if (preset.name === "vue-hono-app") {
141
+ blueprint.packages = [
142
+ { name: `@${packageScope}/web`, path: "apps/web" },
143
+ { name: `@${packageScope}/api`, path: "apps/api" }
144
+ ];
145
+ }
146
+ return blueprint;
147
+ }
148
+ function formatBlueprintSummary(targetDir, blueprint) {
149
+ const lines = [
150
+ "Project Blueprint",
151
+ ` Target: ${targetDir}`,
152
+ ` Preset: ${blueprint.preset}`,
153
+ ` Project kind: ${blueprint.projectKind}`
154
+ ];
155
+ if (blueprint.packageManager) {
156
+ lines.push(` Package manager: ${blueprint.packageManager}`);
157
+ }
158
+ if (blueprint.packages) {
159
+ lines.push(" Packages:");
160
+ for (const pkg of blueprint.packages) {
161
+ lines.push(` - ${pkg.name} (${pkg.path})`);
162
+ }
163
+ }
164
+ lines.push(` Features: ${blueprint.features.join(", ")}`);
165
+ return lines.join("\n");
166
+ }
167
+ function nextStepsForPreset(preset) {
168
+ if (preset === "rust-bin") {
169
+ return ["cd <target>", "./scripts/check"];
170
+ }
171
+ return ["cd <target>", "pnpm install", "pnpm run check"];
172
+ }
173
+ function formatNextSteps(targetDir, preset) {
174
+ return [
175
+ "Next steps:",
176
+ ...nextStepsForPreset(preset).map((step) => ` ${step.replace("<target>", targetDir)}`)
177
+ ].join("\n");
178
+ }
179
+ function printInitComplete(options, blueprint) {
180
+ const preset = blueprint.preset;
181
+ if (options.json) {
182
+ printJson({
183
+ command: "init",
184
+ dryRun: false,
185
+ targetDir: options.dir,
186
+ blueprint,
187
+ nextSteps: nextStepsForPreset(preset).map((step) => step.replace("<target>", options.dir))
188
+ });
189
+ return;
190
+ }
191
+ console.log(`Initialized ${options.preset} project in ${options.dir}`);
192
+ console.log(formatNextSteps(options.dir, preset));
193
+ }
194
+ function isInteractiveTerminal() {
195
+ return Boolean(process.stdin.isTTY && process.stdout.isTTY);
196
+ }
197
+ async function confirmInit(targetDir, blueprint) {
198
+ console.log(formatBlueprintSummary(targetDir, blueprint));
199
+ const readline = createInterface({
200
+ input: process.stdin,
201
+ output: process.stdout
202
+ });
203
+ try {
204
+ const answer = await readline.question("Generate this project? [y/N] ");
205
+ return answer.trim().toLowerCase() === "y" || answer.trim().toLowerCase() === "yes";
206
+ }
207
+ finally {
208
+ readline.close();
209
+ }
210
+ }
211
+ function parseAddPackageOptions(args) {
212
+ let preset = "";
213
+ let name = "";
214
+ for (let index = 2; index < args.length; index += 1) {
215
+ const arg = args[index];
216
+ if (arg === "--preset") {
217
+ const value = args[index + 1];
218
+ if (!value) {
219
+ throw new Error("--preset requires a value");
220
+ }
221
+ preset = value;
222
+ index += 1;
223
+ continue;
224
+ }
225
+ if (arg === "--name") {
226
+ const value = args[index + 1];
227
+ if (!value) {
228
+ throw new Error("--name requires a value");
229
+ }
230
+ name = value;
231
+ index += 1;
232
+ continue;
233
+ }
234
+ throw new Error(`Unknown option: ${arg}`);
235
+ }
236
+ if (!preset) {
237
+ throw new Error("add package requires --preset");
238
+ }
239
+ if (!name) {
240
+ throw new Error("add package requires --name");
241
+ }
242
+ return { preset, name };
243
+ }
244
+ async function main(args) {
245
+ const command = args[0];
246
+ if (command === "presets") {
247
+ console.log(formatPresetCatalog());
248
+ return;
249
+ }
250
+ if (command === "schema") {
251
+ const schemaName = args[1];
252
+ if (schemaName === "preset") {
253
+ printJson(presetFileJsonSchema);
254
+ return;
255
+ }
256
+ if (schemaName === "blueprint") {
257
+ printJson(blueprintJsonSchema);
258
+ return;
259
+ }
260
+ throw new Error("schema requires preset or blueprint");
261
+ }
262
+ if (command === "preset" && args[1] === "validate") {
263
+ const filePath = args[2];
264
+ if (!filePath) {
265
+ throw new Error("preset validate requires a path");
266
+ }
267
+ const result = validatePresetFile(await readJsonDeclaration(filePath));
268
+ if (!result.ok) {
269
+ throw new Error(`Preset file is invalid:\n${formatValidationIssues(result.issues)}`);
270
+ }
271
+ console.log(`Preset file is valid: ${result.value.name}`);
272
+ return;
273
+ }
274
+ if (command === "blueprint" && args[1] === "validate") {
275
+ const filePath = args[2];
276
+ if (!filePath) {
277
+ throw new Error("blueprint validate requires a path");
278
+ }
279
+ const result = validateProjectBlueprint(await readJsonDeclaration(filePath));
280
+ if (!result.ok) {
281
+ throw new Error(`Blueprint is invalid:\n${formatValidationIssues(result.issues)}`);
282
+ }
283
+ console.log(`Blueprint is valid: ${result.value.preset}`);
284
+ return;
285
+ }
286
+ if (command === "init") {
287
+ const options = parseInitOptions(args);
288
+ const blueprint = blueprintForInit(options);
289
+ if (options.dryRun) {
290
+ if (options.json) {
291
+ printJson({
292
+ command: "init",
293
+ dryRun: true,
294
+ targetDir: options.dir,
295
+ blueprint
296
+ });
297
+ return;
298
+ }
299
+ console.log(formatBlueprintSummary(options.dir, blueprint));
300
+ return;
301
+ }
302
+ if (!options.yes && (options.json || !isInteractiveTerminal())) {
303
+ throw new Error("Non-interactive init requires --yes");
304
+ }
305
+ if (!options.yes && !(await confirmInit(options.dir, blueprint))) {
306
+ throw new Error("Init cancelled");
307
+ }
308
+ if (options.preset === "ts-lib") {
309
+ await initTsLibProject(options.dir);
310
+ printInitComplete(options, blueprint);
311
+ return;
312
+ }
313
+ if (options.preset === "hono-api") {
314
+ await initHonoApiProject(options.dir);
315
+ printInitComplete(options, blueprint);
316
+ return;
317
+ }
318
+ if (options.preset === "vue-app") {
319
+ await initVueAppProject(options.dir);
320
+ printInitComplete(options, blueprint);
321
+ return;
322
+ }
323
+ if (options.preset === "vue-hono-app") {
324
+ await initVueHonoAppProject(options.dir, { scope: options.scope });
325
+ printInitComplete(options, blueprint);
326
+ return;
327
+ }
328
+ if (options.preset === "rust-bin") {
329
+ await initRustBinProject(options.dir);
330
+ printInitComplete(options, blueprint);
331
+ return;
332
+ }
333
+ throw new Error("Only the ts-lib, hono-api, vue-app, vue-hono-app, and rust-bin presets are supported in this version");
334
+ }
335
+ if (command === "add" && args[1] === "package") {
336
+ const options = parseAddPackageOptions(args);
337
+ await addPackage({ cwd: process.cwd(), preset: options.preset, name: options.name });
338
+ console.log(`Added ${options.preset} package ${options.name}`);
339
+ return;
340
+ }
341
+ if (command === "--help" || command === "-h") {
342
+ console.log(usage());
343
+ return;
344
+ }
345
+ throw new Error(command ? `Unknown command: ${command}` : "Missing command");
346
+ }
347
+ main(process.argv.slice(2)).catch((error) => {
348
+ const message = error instanceof Error ? error.message : String(error);
349
+ console.error(message);
350
+ console.error("");
351
+ console.error(usage());
352
+ process.exitCode = 1;
353
+ });
@@ -0,0 +1,166 @@
1
+ import * as v from "valibot";
2
+ export type PresetName = "ts-lib" | "hono-api" | "vue-app" | "vue-hono-app" | "rust-bin" | "ts-app" | "node-cli";
3
+ export type BuiltInPreset = {
4
+ name: PresetName;
5
+ title: string;
6
+ description: string;
7
+ generation: "supported" | "future";
8
+ supportedPackageManagers: readonly PackageManager[];
9
+ supportedProjectKinds: readonly ProjectKind[];
10
+ features: readonly FeatureName[];
11
+ };
12
+ export type PackageManager = "pnpm";
13
+ export type ProjectKind = "single-package" | "multi-package";
14
+ export type FeatureName = "pnpm-catalog" | "oxc-format-lint" | "strict-typescript" | "root-check" | "fix-command" | "devcontainer" | "github-actions" | "dependabot" | "rustfmt-clippy" | "cargo-test" | "native-binary-release";
15
+ export type PresetFile = {
16
+ schemaVersion: 1;
17
+ name: string;
18
+ title: string;
19
+ description: string;
20
+ supportedPackageManagers: PackageManager[];
21
+ supportedProjectKinds: ProjectKind[];
22
+ features: FeatureName[];
23
+ };
24
+ export type ProjectPackage = {
25
+ name: string;
26
+ path: string;
27
+ };
28
+ export type ProjectBlueprint = {
29
+ schemaVersion: 1;
30
+ preset: string;
31
+ packageManager?: PackageManager;
32
+ projectKind: ProjectKind;
33
+ features: FeatureName[];
34
+ packages?: ProjectPackage[];
35
+ };
36
+ export declare const builtInPresets: readonly BuiltInPreset[];
37
+ export declare const presetFileJsonSchema: {
38
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
39
+ readonly $id: "https://ykdz.dev/schemas/project-kit/preset-file.schema.json";
40
+ readonly title: "Project Kit Preset File";
41
+ readonly type: "object";
42
+ readonly additionalProperties: false;
43
+ readonly required: readonly ["schemaVersion", "name", "title", "description", "supportedPackageManagers", "supportedProjectKinds", "features"];
44
+ readonly properties: {
45
+ readonly schemaVersion: {
46
+ readonly const: 1;
47
+ };
48
+ readonly name: {
49
+ readonly type: "string";
50
+ readonly minLength: 1;
51
+ };
52
+ readonly title: {
53
+ readonly type: "string";
54
+ readonly minLength: 1;
55
+ };
56
+ readonly description: {
57
+ readonly type: "string";
58
+ readonly minLength: 1;
59
+ };
60
+ readonly supportedPackageManagers: {
61
+ readonly type: "array";
62
+ readonly items: {
63
+ readonly enum: readonly ["pnpm"];
64
+ };
65
+ readonly uniqueItems: true;
66
+ };
67
+ readonly supportedProjectKinds: {
68
+ readonly type: "array";
69
+ readonly minItems: 1;
70
+ readonly items: {
71
+ readonly enum: readonly ["single-package", "multi-package"];
72
+ };
73
+ readonly uniqueItems: true;
74
+ };
75
+ readonly features: {
76
+ readonly type: "array";
77
+ readonly items: {
78
+ readonly enum: FeatureName[];
79
+ };
80
+ readonly uniqueItems: true;
81
+ };
82
+ };
83
+ };
84
+ export declare const blueprintJsonSchema: {
85
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
86
+ readonly $id: "https://ykdz.dev/schemas/project-kit/blueprint.schema.json";
87
+ readonly title: "Project Kit Blueprint";
88
+ readonly type: "object";
89
+ readonly additionalProperties: false;
90
+ readonly required: readonly ["schemaVersion", "preset", "projectKind", "features"];
91
+ readonly properties: {
92
+ readonly schemaVersion: {
93
+ readonly const: 1;
94
+ };
95
+ readonly preset: {
96
+ readonly type: "string";
97
+ readonly minLength: 1;
98
+ };
99
+ readonly packageManager: {
100
+ readonly enum: readonly ["pnpm"];
101
+ };
102
+ readonly projectKind: {
103
+ readonly enum: readonly ["single-package", "multi-package"];
104
+ };
105
+ readonly features: {
106
+ readonly type: "array";
107
+ readonly items: {
108
+ readonly enum: FeatureName[];
109
+ };
110
+ readonly uniqueItems: true;
111
+ };
112
+ readonly packages: {
113
+ readonly type: "array";
114
+ readonly items: {
115
+ readonly type: "object";
116
+ readonly additionalProperties: false;
117
+ readonly required: readonly ["name", "path"];
118
+ readonly properties: {
119
+ readonly name: {
120
+ readonly type: "string";
121
+ readonly minLength: 1;
122
+ };
123
+ readonly path: {
124
+ readonly type: "string";
125
+ readonly minLength: 1;
126
+ };
127
+ };
128
+ };
129
+ };
130
+ };
131
+ };
132
+ export declare const presetFileSchema: v.StrictObjectSchema<{
133
+ readonly schemaVersion: v.LiteralSchema<1, undefined>;
134
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
135
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
136
+ readonly description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
137
+ readonly supportedPackageManagers: v.ArraySchema<v.PicklistSchema<["pnpm"], undefined>, undefined>;
138
+ readonly supportedProjectKinds: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["single-package", "multi-package"], undefined>, undefined>, v.MinLengthAction<("single-package" | "multi-package")[], 1, undefined>]>;
139
+ readonly features: v.ArraySchema<v.PicklistSchema<FeatureName[], undefined>, undefined>;
140
+ }, undefined>;
141
+ export declare const projectBlueprintSchema: v.StrictObjectSchema<{
142
+ readonly schemaVersion: v.LiteralSchema<1, undefined>;
143
+ readonly preset: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
144
+ readonly packageManager: v.OptionalSchema<v.PicklistSchema<["pnpm"], undefined>, undefined>;
145
+ readonly projectKind: v.PicklistSchema<["single-package", "multi-package"], undefined>;
146
+ readonly features: v.ArraySchema<v.PicklistSchema<FeatureName[], undefined>, undefined>;
147
+ readonly packages: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
148
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
149
+ readonly path: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
150
+ }, undefined>, undefined>, undefined>;
151
+ }, undefined>;
152
+ export type ValidationIssue = {
153
+ path: string;
154
+ message: string;
155
+ };
156
+ export type ValidationResult<T> = {
157
+ ok: true;
158
+ value: T;
159
+ } | {
160
+ ok: false;
161
+ issues: ValidationIssue[];
162
+ };
163
+ export declare function validatePresetFile(input: unknown): ValidationResult<PresetFile>;
164
+ export declare function findBuiltInPreset(name: string): BuiltInPreset | undefined;
165
+ export declare function validateProjectBlueprint(input: unknown): ValidationResult<ProjectBlueprint>;
166
+ //# sourceMappingURL=declarations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,UAAU,GACV,SAAS,GACT,cAAc,GACd,UAAU,GACV,QAAQ,GACR,UAAU,CAAC;AAEf,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,WAAW,GAAG,QAAQ,CAAC;IACnC,wBAAwB,EAAE,SAAS,cAAc,EAAE,CAAC;IACpD,qBAAqB,EAAE,SAAS,WAAW,EAAE,CAAC;IAC9C,QAAQ,EAAE,SAAS,WAAW,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG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