@ykdz/template 0.0.10 → 0.0.12

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 (48) hide show
  1. package/dist/cli.js +2 -2
  2. package/node_modules/@ykdz/template-builtin-source/dist/src/index.d.ts +4 -4
  3. package/node_modules/@ykdz/template-builtin-source/dist/src/index.js +12 -5
  4. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.d.ts +1 -1
  5. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +1 -1
  6. package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.js +9 -6
  7. package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.d.ts +1 -1
  8. package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +1 -1
  9. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.d.ts +1 -1
  10. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +1 -1
  11. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.d.ts +1 -1
  12. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +1 -1
  13. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.d.ts +1 -1
  14. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +10 -12
  15. package/node_modules/@ykdz/template-builtin-source/package.json +3 -2
  16. package/node_modules/@ykdz/template-builtin-source/templates/hono-api/vitest.config.ts +1 -0
  17. package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +35 -9
  18. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/api/vitest.config.ts +7 -0
  19. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/playwright.config.ts +23 -7
  20. package/node_modules/@ykdz/template-core/dist/declarations.d.ts +2 -203
  21. package/node_modules/@ykdz/template-core/dist/declarations.js +1 -303
  22. package/node_modules/@ykdz/template-core/dist/devcontainer.d.ts +17 -0
  23. package/node_modules/@ykdz/template-core/dist/devcontainer.js +22 -21
  24. package/node_modules/@ykdz/template-core/dist/editor-customization.d.ts +10 -1
  25. package/node_modules/@ykdz/template-core/dist/editor-customization.js +36 -26
  26. package/node_modules/@ykdz/template-core/dist/generated-scenarios.d.ts +4 -0
  27. package/node_modules/@ykdz/template-core/dist/generated-scenarios.js +32 -22
  28. package/node_modules/@ykdz/template-core/dist/generation-context.d.ts +1 -1
  29. package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +19 -1
  30. package/node_modules/@ykdz/template-core/dist/module-graph.js +42 -3
  31. package/node_modules/@ykdz/template-core/dist/next-step-instructions.d.ts +2 -0
  32. package/node_modules/@ykdz/template-core/dist/next-step-instructions.js +11 -22
  33. package/node_modules/@ykdz/template-core/dist/package-addition-support.d.ts +2 -1
  34. package/node_modules/@ykdz/template-core/dist/package-addition-support.js +2 -4
  35. package/node_modules/@ykdz/template-core/dist/package-addition.js +5 -22
  36. package/node_modules/@ykdz/template-core/dist/package-linking.d.ts +2 -6
  37. package/node_modules/@ykdz/template-core/dist/package-linking.js +1 -1
  38. package/node_modules/@ykdz/template-core/dist/preset-projection.d.ts +1 -2
  39. package/node_modules/@ykdz/template-core/dist/preset-source.d.ts +4 -418
  40. package/node_modules/@ykdz/template-core/dist/preset-source.js +81 -726
  41. package/node_modules/@ykdz/template-core/dist/project-github.js +2 -6
  42. package/node_modules/@ykdz/template-core/dist/projection-capabilities.d.ts +5 -53
  43. package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +103 -515
  44. package/node_modules/@ykdz/template-core/package.json +3 -2
  45. package/node_modules/@ykdz/template-shared/dist/index.d.ts +794 -0
  46. package/node_modules/@ykdz/template-shared/dist/index.js +1637 -0
  47. package/node_modules/@ykdz/template-shared/package.json +32 -0
  48. package/package.json +9 -6
package/dist/cli.js CHANGED
@@ -3,14 +3,14 @@ import { readFile } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { createInterface } from "node:readline/promises";
5
5
  import { builtInPresetProjectionSourceRoots, builtInPresets, findBuiltInPresetSourceManifestPreset, loadBuiltInPresetSourceManifest, projectBuiltInPresetSourcePreset, } from "@ykdz/template-builtin-source";
6
- import { blueprintJsonSchema, presetFileJsonSchema, validatePresetFile, validateProjectBlueprint, } from "@ykdz/template-core/declarations";
7
6
  import { assembleGenerationContext, } from "@ykdz/template-core/generation-context";
8
7
  import { addPackage } from "@ykdz/template-core/package-addition";
9
8
  import { planNextStepInstructionsForProjection, } from "@ykdz/template-core/preset-projection";
10
- import { presetSourceManifestJsonSchema, validateBuiltInPresetSourceManifest, validatePresetSourceManifest, } from "@ykdz/template-core/preset-source";
9
+ import { validateBuiltInPresetSourceManifest, validatePresetSourceManifest, } from "@ykdz/template-core/preset-source";
11
10
  import { blueprintForPresetSourcePreset } from "@ykdz/template-core/projection-capabilities";
12
11
  import { renderNewProject } from "@ykdz/template-core/renderer";
13
12
  import { resolveToolchainVersions, } from "@ykdz/template-core/toolchain-resolution";
13
+ import { blueprintJsonSchema, presetSourceManifestJsonSchema, presetFileJsonSchema, validatePresetFile, validateProjectBlueprint, } from "@ykdz/template-shared";
14
14
  function usage() {
15
15
  return [
16
16
  "Project Kit template CLI",
@@ -1,9 +1,9 @@
1
- import type { BuiltInPreset } from "@ykdz/template-core/declarations";
2
1
  import type { GenerationContext } from "@ykdz/template-core/generation-context";
3
2
  import type { PresetPackageAdditionOptions } from "@ykdz/template-core/preset-projection";
4
- import { type PresetSourceManifest, type PresetSourceManifestPreset } from "@ykdz/template-core/preset-source";
5
- import { type PresetProjectionSourceRoots, type PresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
6
- export { findPresetSourceManifestPreset, loadPresetSourceManifestFile, manifestReferencedSourceFiles, presetSourceManifestJsonSchema, validateBuiltInPresetSourceManifest, validatePresetSourceManifest, type PresetSourceManifest, type PresetSourceManifestPreset, } from "@ykdz/template-core/preset-source";
3
+ import { type PresetProjectionSourceRoots } from "@ykdz/template-core/projection-capabilities";
4
+ import { type BuiltInPreset, type PresetProjectionDeclaration, type PresetSourceManifest, type PresetSourceManifestPreset } from "@ykdz/template-shared";
5
+ export { findPresetSourceManifestPreset, loadPresetSourceManifestFile, manifestReferencedSourceFiles, validateBuiltInPresetSourceManifest, validatePresetSourceManifest, } from "@ykdz/template-core/preset-source";
6
+ export { presetSourceManifestJsonSchema, type PresetSourceManifest, type PresetSourceManifestPreset, } from "@ykdz/template-shared";
7
7
  export declare function builtInPresetSourceRoot(...segments: string[]): string;
8
8
  export declare function builtInPresetProjectionSourceRoots(): PresetProjectionSourceRoots;
9
9
  export declare function loadBuiltInPresetSourceManifest(): PresetSourceManifest;
@@ -2,8 +2,10 @@ import { readFileSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { findPresetSourceManifestPreset, validateBuiltInPresetSourceManifest, } from "@ykdz/template-core/preset-source";
5
- import { defaultPackagePathForPresetSourcePackageAddition, planPresetSourcePackageAddition, projectPresetSourcePreset, validateProjectionCapabilities, } from "@ykdz/template-core/projection-capabilities";
6
- export { findPresetSourceManifestPreset, loadPresetSourceManifestFile, manifestReferencedSourceFiles, presetSourceManifestJsonSchema, validateBuiltInPresetSourceManifest, validatePresetSourceManifest, } from "@ykdz/template-core/preset-source";
5
+ import { defaultPackagePathForPresetSourcePackageAddition, planPresetSourcePackageAddition, projectPresetSourcePreset, } from "@ykdz/template-core/projection-capabilities";
6
+ import { validatePresetProjectionDeclaration, } from "@ykdz/template-shared";
7
+ export { findPresetSourceManifestPreset, loadPresetSourceManifestFile, manifestReferencedSourceFiles, validateBuiltInPresetSourceManifest, validatePresetSourceManifest, } from "@ykdz/template-core/preset-source";
8
+ export { presetSourceManifestJsonSchema, } from "@ykdz/template-shared";
7
9
  export function builtInPresetSourceRoot(...segments) {
8
10
  const moduleDir = path.dirname(fileURLToPath(import.meta.url));
9
11
  const candidates = [
@@ -37,6 +39,8 @@ function errorCode(error) {
37
39
  return undefined;
38
40
  }
39
41
  export function builtInPresetProjectionSourceRoots() {
42
+ const manifest = loadBuiltInPresetSourceManifest();
43
+ const sharedResources = new Map(manifest.sharedResources.map((resource) => [resource.id, resource.path]));
40
44
  return {
41
45
  preset(sourcePreset) {
42
46
  return builtInPresetSourceRoot(sourcePreset);
@@ -44,8 +48,11 @@ export function builtInPresetProjectionSourceRoots() {
44
48
  sharedOxc() {
45
49
  return builtInPresetSourceRoot("shared", "oxc");
46
50
  },
47
- sharedDevcontainer() {
48
- return builtInPresetSourceRoot("shared", "devcontainer");
51
+ sharedResource(resourceId) {
52
+ const resourcePath = sharedResources.get(resourceId);
53
+ return resourcePath === undefined
54
+ ? undefined
55
+ : builtInPresetSourceRoot(resourcePath);
49
56
  },
50
57
  };
51
58
  }
@@ -71,7 +78,7 @@ export function loadBuiltInPresetProjectionDeclaration(presetName) {
71
78
  if (!preset?.projection) {
72
79
  throw new Error(`Built-in Preset ${presetName} must declare a Projection Declaration`);
73
80
  }
74
- const result = validateProjectionCapabilities(preset.projection);
81
+ const result = validatePresetProjectionDeclaration(preset.projection);
75
82
  if (!result.ok) {
76
83
  throw new Error(`Built-in Preset ${presetName} Projection Declaration is invalid:\n${result.issues
77
84
  .map((issue) => ` - ${issue.path}: ${issue.message}`)
@@ -1,5 +1,5 @@
1
- import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
2
1
  import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
2
+ import { type BuiltInPreset, type ProjectBlueprint } from "@ykdz/template-shared";
3
3
  export declare const honoApiPresetMetadata: BuiltInPreset;
4
4
  export declare function honoApiBlueprint(options?: PresetBlueprintOptions): ProjectBlueprint;
5
5
  export declare function projectHonoApiPackageScripts(): Record<string, string>;
@@ -3,10 +3,10 @@ import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
5
5
  import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
6
- import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
7
6
  import { packageManifestExposureFields, planPackageLinks, } from "@ykdz/template-core/package-linking";
8
7
  import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
9
8
  import { renderNewProject, } from "@ykdz/template-core/renderer";
9
+ import { PackageAdditionSupport, } from "@ykdz/template-shared";
10
10
  export const honoApiPresetMetadata = {
11
11
  name: "hono-api",
12
12
  title: "Hono API",
@@ -1,3 +1,4 @@
1
+ import { playwrightBrowserAssetsEnvironmentNeed } from "@ykdz/template-core/module-graph";
1
2
  const rootPackageBoundary = {
2
3
  kind: "package-boundary",
3
4
  path: ".",
@@ -65,20 +66,22 @@ export function selectNodeFixComponents(target) {
65
66
  function checkEnvironmentNeeds(target) {
66
67
  if (target === "vue-app") {
67
68
  return [
68
- {
69
- kind: "playwright-browser-assets",
69
+ playwrightBrowserAssetsEnvironmentNeed({
70
70
  browser: "chromium",
71
71
  owner: rootPackageBoundary,
72
- },
72
+ id: "install-playwright-browsers",
73
+ label: "Install Playwright browser assets",
74
+ }),
73
75
  ];
74
76
  }
75
77
  if (target === "vue-hono-root" || target === "vue-hono-web") {
76
78
  return [
77
- {
78
- kind: "playwright-browser-assets",
79
+ playwrightBrowserAssetsEnvironmentNeed({
79
80
  browser: "chromium",
80
81
  owner: webPackageBoundary,
81
- },
82
+ id: "install-web-playwright-browsers",
83
+ label: "Install Playwright browser assets for web workspace",
84
+ }),
82
85
  ];
83
86
  }
84
87
  return [];
@@ -1,6 +1,6 @@
1
- import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
2
1
  import { type CheckPlan, type FixPlan } from "@ykdz/template-core/module-graph";
3
2
  import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
3
+ import { type BuiltInPreset, type ProjectBlueprint } from "@ykdz/template-shared";
4
4
  export declare const rustBinPresetMetadata: BuiltInPreset;
5
5
  export declare function planRustBinChecks(): CheckPlan;
6
6
  export declare function planRustBinFixes(): FixPlan;
@@ -1,9 +1,9 @@
1
1
  import path from "node:path";
2
2
  import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
3
3
  import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
4
- import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
5
4
  import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
6
5
  import { renderNewProject } from "@ykdz/template-core/renderer";
6
+ import { PackageAdditionSupport, } from "@ykdz/template-shared";
7
7
  export const rustBinPresetMetadata = {
8
8
  name: "rust-bin",
9
9
  title: "Rust binary",
@@ -1,5 +1,5 @@
1
- import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
2
1
  import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
2
+ import { type BuiltInPreset, type ProjectBlueprint } from "@ykdz/template-shared";
3
3
  export declare const tsLibPresetMetadata: BuiltInPreset;
4
4
  export declare function tsLibBlueprint(options?: PresetBlueprintOptions): ProjectBlueprint;
5
5
  export declare function projectTsLibPackageScripts(): Record<string, string>;
@@ -3,10 +3,10 @@ import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
5
5
  import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
6
- import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
7
6
  import { packageManifestExposureFields, planPackageLinks, } from "@ykdz/template-core/package-linking";
8
7
  import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
9
8
  import { renderNewProject, } from "@ykdz/template-core/renderer";
9
+ import { PackageAdditionSupport, } from "@ykdz/template-shared";
10
10
  export const tsLibPresetMetadata = {
11
11
  name: "ts-lib",
12
12
  title: "TypeScript library",
@@ -1,5 +1,5 @@
1
- import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
2
1
  import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
2
+ import { type BuiltInPreset, type ProjectBlueprint } from "@ykdz/template-shared";
3
3
  export declare const vueAppPresetMetadata: BuiltInPreset;
4
4
  export declare function vueAppBlueprint(options?: PresetBlueprintOptions): ProjectBlueprint;
5
5
  export declare function projectVueAppPackageScripts(): Record<string, string>;
@@ -4,9 +4,9 @@ import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
6
6
  import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
7
- import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
8
7
  import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
9
8
  import { renderNewProject, } from "@ykdz/template-core/renderer";
9
+ import { PackageAdditionSupport, } from "@ykdz/template-shared";
10
10
  export const vueAppPresetMetadata = {
11
11
  name: "vue-app",
12
12
  title: "Vue app",
@@ -1,5 +1,5 @@
1
- import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
2
1
  import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
2
+ import { type BuiltInPreset, type ProjectBlueprint } from "@ykdz/template-shared";
3
3
  export declare const vueHonoAppPresetMetadata: BuiltInPreset;
4
4
  export declare function vueHonoAppBlueprint(options: PresetBlueprintOptions): ProjectBlueprint;
5
5
  export declare function projectVueHonoRootPackageScripts(): Record<string, string>;
@@ -1,9 +1,9 @@
1
1
  import path from "node:path";
2
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";
3
+ import { playwrightBrowserAssetsEnvironmentNeed, renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
5
4
  import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
6
5
  import { renderNewProject } from "@ykdz/template-core/renderer";
6
+ import { PackageAdditionSupport, } from "@ykdz/template-shared";
7
7
  export const vueHonoAppPresetMetadata = {
8
8
  name: "vue-hono-app",
9
9
  title: "Vue Hono app",
@@ -74,17 +74,15 @@ function planVueHonoRootChecks() {
74
74
  { kind: "oxc-format-check", owner: rootBoundary },
75
75
  { kind: "oxc-lint", owner: rootBoundary },
76
76
  { kind: "typescript-typecheck", owner: rootBoundary },
77
- { kind: "turbo-package-typecheck", owner: workspacePackageBoundary },
78
- { kind: "turbo-package-build", owner: workspacePackageBoundary },
79
- { kind: "turbo-package-test", owner: workspacePackageBoundary },
80
77
  { kind: "turbo-package-check", owner: workspacePackageBoundary },
81
78
  ],
82
79
  environmentNeeds: [
83
- {
84
- kind: "playwright-browser-assets",
80
+ playwrightBrowserAssetsEnvironmentNeed({
85
81
  browser: "chromium",
86
82
  owner: webWorkspaceBoundary,
87
- },
83
+ id: "install-web-playwright-browsers",
84
+ label: "Install Playwright browser assets for web workspace",
85
+ }),
88
86
  ],
89
87
  };
90
88
  }
@@ -142,10 +140,10 @@ export function projectVueHonoRootPackageScripts() {
142
140
  check: renderRootCheckCommand(planVueHonoRootChecks()),
143
141
  dev: "turbo run dev --parallel",
144
142
  fix: renderFixCommand(planVueHonoRootFixes()),
145
- "format:check": "oxfmt --check --config oxfmt.config.ts oxlint.config.ts oxfmt.config.ts",
146
- "format:write": "oxfmt --write --config oxfmt.config.ts oxlint.config.ts oxfmt.config.ts",
147
- lint: "oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts",
148
- "lint:fix": "oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --fix",
143
+ "format:check": "oxfmt --check oxlint.config.ts oxfmt.config.ts",
144
+ "format:write": "oxfmt --write oxlint.config.ts oxfmt.config.ts",
145
+ lint: "oxlint oxlint.config.ts oxfmt.config.ts",
146
+ "lint:fix": "oxlint oxlint.config.ts oxfmt.config.ts --fix",
149
147
  typecheck: "tsc -p tsconfig.config.json --noEmit",
150
148
  };
151
149
  }
@@ -39,14 +39,15 @@
39
39
  "check:templates:shared-oxc:lint": "oxlint --config templates/shared/oxc/node/oxlint.config.ts templates/shared/oxc",
40
40
  "check:templates:shared-oxc:typecheck": "tsc -p templates/shared/oxc/tsconfig.json --noEmit",
41
41
  "check:templates:static-source": "rustup run stable rustfmt --check templates/rust-bin/src/main.rs",
42
- "format:check": "oxfmt --check --config ../../oxfmt.config.ts --ignore-path ../../.oxfmtignore .",
43
- "format:write": "oxfmt --write --config ../../oxfmt.config.ts --ignore-path ../../.oxfmtignore .",
42
+ "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
43
+ "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
44
44
  "lint": "oxlint --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts",
45
45
  "lint:fix": "oxlint --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts --fix",
46
46
  "typecheck": "tsc -p tsconfig.json --noEmit"
47
47
  },
48
48
  "dependencies": {
49
49
  "@ykdz/template-core": "workspace:*",
50
+ "@ykdz/template-shared": "workspace:*",
50
51
  "typescript": "catalog:",
51
52
  "valibot": "catalog:"
52
53
  },
@@ -5,6 +5,7 @@ import { defineConfig } from "vitest/config";
5
5
  export default defineConfig({
6
6
  resolve: {
7
7
  alias: {
8
+ "#": fileURLToPath(new URL("./src", import.meta.url)),
8
9
  "@": fileURLToPath(new URL("./src", import.meta.url)),
9
10
  },
10
11
  },
@@ -164,8 +164,14 @@
164
164
  "sourceFiles": ["src/index.ts", "src/name-schema.ts"]
165
165
  },
166
166
  { "kind": "strict-typescript-root" },
167
- { "kind": "oxc-format-lint" },
168
- { "kind": "node-pnpm-devcontainer" },
167
+ {
168
+ "kind": "oxc-format-lint",
169
+ "editorCustomizationResourceId": "shared-editor-customization"
170
+ },
171
+ {
172
+ "kind": "node-pnpm-devcontainer",
173
+ "devcontainerResourceId": "shared-devcontainer"
174
+ },
169
175
  { "kind": "github-maintenance" }
170
176
  ]
171
177
  },
@@ -229,8 +235,14 @@
229
235
  ]
230
236
  },
231
237
  { "kind": "strict-typescript-root" },
232
- { "kind": "oxc-format-lint" },
233
- { "kind": "node-pnpm-devcontainer" },
238
+ {
239
+ "kind": "oxc-format-lint",
240
+ "editorCustomizationResourceId": "shared-editor-customization"
241
+ },
242
+ {
243
+ "kind": "node-pnpm-devcontainer",
244
+ "devcontainerResourceId": "shared-devcontainer"
245
+ },
234
246
  { "kind": "github-maintenance" }
235
247
  ]
236
248
  },
@@ -310,8 +322,14 @@
310
322
  ]
311
323
  },
312
324
  { "kind": "strict-typescript-root" },
313
- { "kind": "oxc-format-lint" },
314
- { "kind": "node-pnpm-devcontainer" },
325
+ {
326
+ "kind": "oxc-format-lint",
327
+ "editorCustomizationResourceId": "shared-editor-customization"
328
+ },
329
+ {
330
+ "kind": "node-pnpm-devcontainer",
331
+ "devcontainerResourceId": "shared-devcontainer"
332
+ },
315
333
  { "kind": "github-maintenance" }
316
334
  ]
317
335
  },
@@ -421,8 +439,14 @@
421
439
  ]
422
440
  },
423
441
  { "kind": "strict-typescript-root" },
424
- { "kind": "oxc-format-lint" },
425
- { "kind": "node-pnpm-devcontainer" },
442
+ {
443
+ "kind": "oxc-format-lint",
444
+ "editorCustomizationResourceId": "shared-editor-customization"
445
+ },
446
+ {
447
+ "kind": "node-pnpm-devcontainer",
448
+ "devcontainerResourceId": "shared-devcontainer"
449
+ },
426
450
  { "kind": "github-maintenance" }
427
451
  ]
428
452
  },
@@ -476,7 +500,9 @@
476
500
  {
477
501
  "kind": "rust-binary-workspace",
478
502
  "workspacePackageGlob": "packages/*",
479
- "sourceFiles": ["src/main.rs"]
503
+ "sourceFiles": ["src/main.rs"],
504
+ "devcontainerResourceId": "shared-devcontainer",
505
+ "editorCustomizationResourceId": "shared-editor-customization"
480
506
  }
481
507
  ]
482
508
  },
@@ -1,6 +1,13 @@
1
+ import { fileURLToPath, URL } from "node:url";
2
+
1
3
  import { defineConfig } from "vitest/config";
2
4
 
3
5
  export default defineConfig({
6
+ resolve: {
7
+ alias: {
8
+ "#": fileURLToPath(new URL("./src", import.meta.url)),
9
+ },
10
+ },
4
11
  test: {
5
12
  globals: true,
6
13
  },
@@ -1,22 +1,38 @@
1
1
  import { defineConfig, devices } from "@playwright/test";
2
2
 
3
+ function workspacePortOffset(): number {
4
+ let hash = 0;
5
+
6
+ for (const character of process.cwd()) {
7
+ hash = (hash * 31 + character.charCodeAt(0)) % 5_000;
8
+ }
9
+
10
+ return hash * 2;
11
+ }
12
+
13
+ const fallbackApiPort = 43_000 + workspacePortOffset();
14
+ const fallbackWebPort = fallbackApiPort + 1;
15
+ const apiPort = Number(process.env.PLAYWRIGHT_API_PORT ?? fallbackApiPort);
16
+ const webPort = Number(process.env.PLAYWRIGHT_WEB_PORT ?? fallbackWebPort);
17
+ const apiBaseUrl = `http://127.0.0.1:${apiPort}`;
18
+ const apiHealthUrl = `${apiBaseUrl}/api/health`;
19
+ const webBaseUrl = `http://127.0.0.1:${webPort}`;
20
+
3
21
  export default defineConfig({
4
22
  testDir: "./test/e2e",
5
23
  use: {
6
- baseURL: "http://localhost:4173",
24
+ baseURL: webBaseUrl,
7
25
  ...devices["Desktop Chrome"],
8
26
  },
9
27
  webServer: [
10
28
  {
11
- command:
12
- "pnpm --dir ../api run build && PORT=8787 pnpm --dir ../api run start",
13
- port: 8787,
29
+ command: `pnpm --dir ../api run build && PORT=${apiPort} pnpm --dir ../api run start`,
30
+ url: apiHealthUrl,
14
31
  reuseExistingServer: false,
15
32
  },
16
33
  {
17
- command:
18
- "VITE_API_BASE_URL=http://localhost:8787 pnpm run preview -- --host 127.0.0.1",
19
- port: 4173,
34
+ command: `VITE_API_BASE_URL=${apiBaseUrl} pnpm run preview --host 127.0.0.1 --port ${webPort}`,
35
+ url: webBaseUrl,
20
36
  reuseExistingServer: false,
21
37
  },
22
38
  ],
@@ -1,203 +1,2 @@
1
- import * as v from "valibot";
2
- import type { PackageAdditionSupport } from "./package-addition-support.js";
3
- import type { PackageLinkIntent, PackageRole, PackageSourcePreset } from "./package-linking.js";
4
- export type BuiltInPreset = {
5
- name: string;
6
- title: string;
7
- description: string;
8
- generation: "supported" | "future";
9
- supportedPackageManagers: readonly PackageManager[];
10
- supportedProjectKinds: readonly ProjectKind[];
11
- packageAdditionSupport: PackageAdditionSupport;
12
- features: readonly FeatureName[];
13
- };
14
- export type PackageManager = "pnpm";
15
- export type ProjectKind = "single-package" | "multi-package";
16
- 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";
17
- export type PresetFile = {
18
- schemaVersion: 1;
19
- name: string;
20
- title: string;
21
- description: string;
22
- supportedPackageManagers: PackageManager[];
23
- supportedProjectKinds: ProjectKind[];
24
- features: FeatureName[];
25
- };
26
- export type ProjectPackage = {
27
- name: string;
28
- path: string;
29
- role?: PackageRole;
30
- sourcePreset?: PackageSourcePreset;
31
- };
32
- export type ProjectBlueprint = {
33
- schemaVersion: 1;
34
- preset: string;
35
- packageManager?: PackageManager;
36
- projectKind: ProjectKind;
37
- features: FeatureName[];
38
- packages?: ProjectPackage[];
39
- packageLinkIntents?: PackageLinkIntent[];
40
- };
41
- export declare const presetFileJsonSchema: {
42
- readonly $schema: "https://json-schema.org/draft/2020-12/schema";
43
- readonly $id: "https://ykdz.dev/schemas/project-kit/preset-file.schema.json";
44
- readonly title: "Project Kit Preset File";
45
- readonly type: "object";
46
- readonly additionalProperties: false;
47
- readonly required: readonly ["schemaVersion", "name", "title", "description", "supportedPackageManagers", "supportedProjectKinds", "features"];
48
- readonly properties: {
49
- readonly schemaVersion: {
50
- readonly const: 1;
51
- };
52
- readonly name: {
53
- readonly type: "string";
54
- readonly minLength: 1;
55
- };
56
- readonly title: {
57
- readonly type: "string";
58
- readonly minLength: 1;
59
- };
60
- readonly description: {
61
- readonly type: "string";
62
- readonly minLength: 1;
63
- };
64
- readonly supportedPackageManagers: {
65
- readonly type: "array";
66
- readonly items: {
67
- readonly enum: readonly ["pnpm"];
68
- };
69
- readonly uniqueItems: true;
70
- };
71
- readonly supportedProjectKinds: {
72
- readonly type: "array";
73
- readonly minItems: 1;
74
- readonly items: {
75
- readonly enum: readonly ["multi-package"];
76
- };
77
- readonly uniqueItems: true;
78
- };
79
- readonly features: {
80
- readonly type: "array";
81
- readonly items: {
82
- readonly enum: FeatureName[];
83
- };
84
- readonly uniqueItems: true;
85
- };
86
- };
87
- };
88
- export declare const blueprintJsonSchema: {
89
- readonly $schema: "https://json-schema.org/draft/2020-12/schema";
90
- readonly $id: "https://ykdz.dev/schemas/project-kit/blueprint.schema.json";
91
- readonly title: "Project Kit Blueprint";
92
- readonly type: "object";
93
- readonly additionalProperties: false;
94
- readonly required: readonly ["schemaVersion", "preset", "projectKind", "features"];
95
- readonly properties: {
96
- readonly schemaVersion: {
97
- readonly const: 1;
98
- };
99
- readonly preset: {
100
- readonly type: "string";
101
- readonly minLength: 1;
102
- };
103
- readonly packageManager: {
104
- readonly enum: readonly ["pnpm"];
105
- };
106
- readonly projectKind: {
107
- readonly enum: readonly ["multi-package"];
108
- };
109
- readonly features: {
110
- readonly type: "array";
111
- readonly items: {
112
- readonly enum: FeatureName[];
113
- };
114
- readonly uniqueItems: true;
115
- };
116
- readonly packages: {
117
- readonly type: "array";
118
- readonly items: {
119
- readonly type: "object";
120
- readonly additionalProperties: false;
121
- readonly required: readonly ["name", "path"];
122
- readonly properties: {
123
- readonly name: {
124
- readonly type: "string";
125
- readonly minLength: 1;
126
- };
127
- readonly path: {
128
- readonly type: "string";
129
- readonly minLength: 1;
130
- };
131
- readonly role: {
132
- readonly enum: readonly ["runtime-service", "shared-library"];
133
- };
134
- readonly sourcePreset: {
135
- readonly enum: readonly ["hono-api", "ts-lib", "vue-app"];
136
- };
137
- };
138
- };
139
- };
140
- readonly packageLinkIntents: {
141
- readonly type: "array";
142
- readonly items: {
143
- readonly type: "object";
144
- readonly additionalProperties: false;
145
- readonly required: readonly ["consumerPackagePath", "providerPackagePath"];
146
- readonly properties: {
147
- readonly consumerPackagePath: {
148
- readonly type: "string";
149
- readonly minLength: 1;
150
- };
151
- readonly providerPackagePath: {
152
- readonly type: "string";
153
- readonly minLength: 1;
154
- };
155
- };
156
- };
157
- };
158
- };
159
- };
160
- export declare const presetFileSchema: v.StrictObjectSchema<{
161
- readonly schemaVersion: v.LiteralSchema<1, undefined>;
162
- readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
163
- readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
164
- readonly description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
165
- readonly supportedPackageManagers: v.ArraySchema<v.PicklistSchema<["pnpm"], undefined>, undefined>;
166
- readonly supportedProjectKinds: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<["single-package", "multi-package"], undefined>, undefined>, v.MinLengthAction<("single-package" | "multi-package")[], 1, undefined>]>;
167
- readonly features: v.ArraySchema<v.PicklistSchema<FeatureName[], undefined>, undefined>;
168
- }, undefined>;
169
- export declare const projectBlueprintSchema: v.StrictObjectSchema<{
170
- readonly schemaVersion: v.LiteralSchema<1, undefined>;
171
- readonly preset: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
172
- readonly packageManager: v.OptionalSchema<v.PicklistSchema<["pnpm"], undefined>, undefined>;
173
- readonly projectKind: v.PicklistSchema<["single-package", "multi-package"], undefined>;
174
- readonly features: v.ArraySchema<v.PicklistSchema<FeatureName[], undefined>, undefined>;
175
- readonly packages: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
176
- readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
177
- readonly path: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
178
- readonly role: v.OptionalSchema<v.PicklistSchema<["runtime-service", "shared-library"], undefined>, undefined>;
179
- readonly sourcePreset: v.OptionalSchema<v.PicklistSchema<["hono-api", "ts-lib", "vue-app"], undefined>, undefined>;
180
- }, undefined>, undefined>, undefined>;
181
- readonly packageLinkIntents: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
182
- readonly consumerPackagePath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
183
- readonly providerPackagePath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
184
- }, undefined>, undefined>, undefined>;
185
- }, undefined>;
186
- export type ValidationIssue = {
187
- path: string;
188
- message: string;
189
- };
190
- export type ValidationResult<T> = {
191
- ok: true;
192
- value: T;
193
- } | {
194
- ok: false;
195
- issues: ValidationIssue[];
196
- };
197
- export type PresetCatalogValidationOptions = {
198
- readonly presets?: readonly BuiltInPreset[];
199
- readonly presetLabel?: string;
200
- };
201
- export declare function validatePresetFile(input: unknown, options?: PresetCatalogValidationOptions): ValidationResult<PresetFile>;
202
- export declare function findPreset(presets: readonly BuiltInPreset[], name: string): BuiltInPreset | undefined;
203
- export declare function validateProjectBlueprint(input: unknown, options?: PresetCatalogValidationOptions): ValidationResult<ProjectBlueprint>;
1
+ export { blueprintJsonSchema, findPreset, presetFileJsonSchema, presetFileSchema, projectBlueprintSchema, validatePresetFile, validateProjectBlueprint, } from "@ykdz/template-shared";
2
+ export type { BuiltInPreset, FeatureName, PackageManager, PresetCatalogValidationOptions, PresetFile, ProjectBlueprint, ProjectKind, ProjectPackage, ValidationIssue, ValidationResult, } from "@ykdz/template-shared";