@ykdz/template 0.0.33 → 0.0.36

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 (98) hide show
  1. package/dist/application.d.ts +2 -1
  2. package/dist/application.js +64 -75
  3. package/dist/main.js +6 -2
  4. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.d.ts +50 -36
  5. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +970 -365
  6. package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.d.ts +24 -0
  7. package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.js +154 -0
  8. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.d.ts +2 -2
  9. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.js +1 -1
  10. package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.d.ts +31 -2
  11. package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.js +29 -33
  12. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/development-container.d.ts +1 -0
  13. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/development-container.js +17 -0
  14. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/typescript.d.ts +4 -3
  15. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/typescript.js +9 -5
  16. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.d.ts +1 -1
  17. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.js +1 -2
  18. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-cli/definition.d.ts +31 -2
  19. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-cli/definition.js +79 -58
  20. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.d.ts +31 -2
  21. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.js +31 -23
  22. package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.d.ts +22 -2
  23. package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.js +61 -35
  24. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.d.ts +26 -2
  25. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.js +19 -8
  26. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.d.ts +22 -2
  27. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.js +31 -21
  28. package/node_modules/@ykdz/template-builtin-presets/package.json +12 -11
  29. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-deployment-diagnostics.yml +1 -1
  30. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-deployment.yml +1 -1
  31. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.pnpmfile.mjs +19 -0
  32. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/gitignore +1 -0
  33. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/tsconfig.packing-hook.json +8 -0
  34. package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/github-cli.Dockerfile +9 -0
  35. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/CHANGELOG.md.template +17 -0
  36. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/RELEASING.md +17 -0
  37. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/artifact.ts +1271 -0
  38. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/changelog.ts +283 -0
  39. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/check-artifact.ts +99 -0
  40. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/check-readiness.ts +66 -0
  41. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/cli-command-identity.ts +4 -0
  42. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/handoff.ts +450 -0
  43. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/publish.ts +483 -0
  44. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/readiness.ts +1125 -0
  45. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/release.ts +819 -0
  46. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/release.yml +119 -0
  47. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/root-tsconfig.json +13 -0
  48. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/tsconfig.json +4 -0
  49. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/turbo.json +6 -0
  50. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/README.md +48 -0
  51. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/assets/CHANGELOG.md.template +17 -0
  52. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/assets/LICENSE-APACHE-2.0.txt +202 -0
  53. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/assets/LICENSE-MIT.txt +21 -0
  54. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/assets/README.md.template +5 -0
  55. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/bridge.ts +3336 -0
  56. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/setup.sh +221 -0
  57. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/cli-command-identity.ts +133 -0
  58. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/cli.ts +4 -3
  59. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/main.ts +5 -4
  60. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/integration/command.test.ts +14 -13
  61. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/unit/cli-command-identity.test.ts +76 -0
  62. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/tsconfig.build.json +2 -0
  63. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/src/readiness.ts +1 -1
  64. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/test/global-setup.ts +21 -0
  65. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/tsconfig.json +6 -1
  66. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/vitest.config.ts +7 -0
  67. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/drizzle.config.ts +5 -1
  68. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/playwright.config.ts +102 -22
  69. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/test/playwright-teardown.ts +12 -0
  70. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/vite.config.ts +39 -1
  71. package/node_modules/@ykdz/template-builtin-presets/templates/vue-app/playwright.config.ts +48 -7
  72. package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/playwright.config.ts +59 -8
  73. package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +15 -53
  74. package/node_modules/@ykdz/template-core/dist/module-graph.js +134 -101
  75. package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +13 -1
  76. package/node_modules/@ykdz/template-core/dist/package-contribution.js +92 -0
  77. package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +14 -10
  78. package/node_modules/@ykdz/template-core/dist/preset-definition.d.ts +71 -13
  79. package/node_modules/@ykdz/template-core/dist/preset-definition.js +16 -1
  80. package/node_modules/@ykdz/template-core/dist/project-blueprint.d.ts +56 -0
  81. package/node_modules/@ykdz/template-core/dist/project-blueprint.js +271 -0
  82. package/node_modules/@ykdz/template-core/dist/project-linking-v2.d.ts +2 -2
  83. package/node_modules/@ykdz/template-core/dist/project-linking-v2.js +2 -2
  84. package/node_modules/@ykdz/template-core/dist/project-projection.d.ts +2 -1
  85. package/node_modules/@ykdz/template-core/dist/project-projection.js +107 -20
  86. package/node_modules/@ykdz/template-core/dist/renderer.d.ts +0 -2
  87. package/node_modules/@ykdz/template-core/dist/renderer.js +17 -38
  88. package/node_modules/@ykdz/template-core/dist/template-boundary-check.d.ts +2 -2
  89. package/node_modules/@ykdz/template-core/dist/template-boundary-check.js +6 -0
  90. package/node_modules/@ykdz/template-core/dist/toolchain-resolution.d.ts +2 -0
  91. package/node_modules/@ykdz/template-core/dist/toolchain-resolution.js +9 -3
  92. package/package.json +3 -3
  93. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/scripts/prepare-database.ts +0 -45
  94. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/scripts/run-playwright.ts +0 -151
  95. package/node_modules/@ykdz/template-builtin-presets/templates/vue-app/scripts/run-playwright.ts +0 -62
  96. package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/scripts/run-playwright.ts +0 -103
  97. package/node_modules/@ykdz/template-core/dist/project-blueprint-v2.d.ts +0 -33
  98. package/node_modules/@ykdz/template-core/dist/project-blueprint-v2.js +0 -182
@@ -1,6 +1,10 @@
1
1
  import { fileURLToPath } from "node:url";
2
+ import { definePackageContributionReplayAdapter, } from "#template-core/preset-definition";
2
3
  import { typescriptConfigSourceOperation } from "../shared/typescript.js";
3
4
  import { templateSources } from "../template-sources.js";
5
+ function packagePathForLeaf(packageLeafName) {
6
+ return `packages/${packageLeafName}`;
7
+ }
4
8
  function packageScripts() {
5
9
  return {
6
10
  "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
@@ -16,27 +20,12 @@ function packageScripts() {
16
20
  };
17
21
  }
18
22
  function cliContribution(options) {
19
- const definition = {
20
- name: `@${options.context.scope}/${options.packageLeafName}`,
23
+ const definition = options.packageDefinition ?? {
24
+ name: `@${options.context.defaultPackageScope}/${options.packageLeafName}`,
21
25
  path: options.packagePath,
22
26
  role: "cli-tool",
23
27
  };
24
- const exposure = {
25
- exports: {
26
- ".": {
27
- source: "./src/main.ts",
28
- types: "./dist/main.d.ts",
29
- default: "./dist/main.js",
30
- },
31
- },
32
- imports: {
33
- "#main": {
34
- source: "./src/main.ts",
35
- types: "./src/main.ts",
36
- default: "./dist/main.js",
37
- },
38
- },
39
- };
28
+ const exposure = { exports: {}, imports: {} };
40
29
  const operations = [
41
30
  {
42
31
  kind: "writeJson",
@@ -71,16 +60,14 @@ function cliContribution(options) {
71
60
  {
72
61
  kind: "copyFile",
73
62
  source: templateSources.tsCli,
74
- from: "src/main.ts",
75
- to: `${definition.path}/src/main.ts`,
63
+ from: "src/cli-command-identity.ts",
64
+ to: `${definition.path}/src/cli-command-identity.ts`,
76
65
  },
77
66
  {
78
- kind: "replaceAnchors",
79
- path: `${definition.path}/src/main.ts`,
80
- language: "typescript",
81
- replacements: {
82
- "cli-command-name": `const commandName = ${JSON.stringify(options.packageLeafName)};`,
83
- },
67
+ kind: "copyFile",
68
+ source: templateSources.tsCli,
69
+ from: "src/main.ts",
70
+ to: `${definition.path}/src/main.ts`,
84
71
  },
85
72
  {
86
73
  kind: "copyFile",
@@ -91,16 +78,14 @@ function cliContribution(options) {
91
78
  {
92
79
  kind: "copyFile",
93
80
  source: templateSources.tsCli,
94
- from: "test/integration/command.test.ts",
95
- to: `${definition.path}/test/integration/command.test.ts`,
81
+ from: "test/unit/cli-command-identity.test.ts",
82
+ to: `${definition.path}/test/unit/cli-command-identity.test.ts`,
96
83
  },
97
84
  {
98
- kind: "replaceAnchors",
99
- path: `${definition.path}/test/integration/command.test.ts`,
100
- language: "typescript",
101
- replacements: {
102
- "cli-test-command-name": `commandName = ${JSON.stringify(options.packageLeafName)};`,
103
- },
85
+ kind: "copyFile",
86
+ source: templateSources.tsCli,
87
+ from: "test/integration/command.test.ts",
88
+ to: `${definition.path}/test/integration/command.test.ts`,
104
89
  },
105
90
  {
106
91
  kind: "copyFile",
@@ -126,12 +111,10 @@ function cliContribution(options) {
126
111
  exposure,
127
112
  manifest: {
128
113
  name: definition.name,
129
- version: "0.0.0",
130
- publishConfig: { access: "public" },
114
+ private: true,
131
115
  files: ["dist"],
132
116
  type: "module",
133
117
  bin: { [options.packageLeafName]: "./dist/cli.js" },
134
- ...exposure,
135
118
  scripts: packageScripts(),
136
119
  dependencies: { commander: "catalog:" },
137
120
  devDependencies: {
@@ -147,8 +130,12 @@ function cliContribution(options) {
147
130
  operations,
148
131
  environmentNeeds: [],
149
132
  foundation: {
133
+ ...(options.publicationCandidate
134
+ ? { npmPublication: { kind: "public-cli-candidate" } }
135
+ : {}),
150
136
  toolchains: {},
151
137
  editorCapabilities: ["oxc-format-lint"],
138
+ typescriptConfigurationPackage: { dependency: "required" },
152
139
  dependencyMaintenance: {
153
140
  ecosystems: ["npm", "github-actions", "docker"],
154
141
  interval: "weekly",
@@ -156,37 +143,71 @@ function cliContribution(options) {
156
143
  },
157
144
  };
158
145
  }
146
+ const cliPublicationCandidateReplayAdapter = definePackageContributionReplayAdapter({
147
+ identity: "cli-publication-candidate",
148
+ replay: ({ context, packageDefinition, packageLeafName, planningContribution, }) => {
149
+ if (planningContribution !== "planInitialization") {
150
+ throw new Error("cli-publication-candidate replay identity requires planInitialization provenance");
151
+ }
152
+ return cliContribution({
153
+ context,
154
+ packageLeafName,
155
+ packagePath: packageDefinition.path,
156
+ packageDefinition,
157
+ publicationCandidate: true,
158
+ });
159
+ },
160
+ });
161
+ const cliPackageAdditionReplayAdapter = definePackageContributionReplayAdapter({
162
+ identity: "cli-package-addition",
163
+ replay: ({ context, packageDefinition, packageLeafName, planningContribution, }) => {
164
+ if (planningContribution !== "planPackageAddition") {
165
+ throw new Error("cli-package-addition replay identity requires planPackageAddition provenance");
166
+ }
167
+ return cliContribution({
168
+ context,
169
+ packageLeafName,
170
+ packagePath: packageDefinition.path,
171
+ packageDefinition,
172
+ publicationCandidate: false,
173
+ });
174
+ },
175
+ });
159
176
  export const tsCliDefinition = {
160
177
  metadata: {
161
178
  name: "ts-cli",
162
179
  title: "TypeScript CLI",
163
- description: "Publishable TypeScript command-line package.",
180
+ description: "TypeScript command-line package.",
164
181
  },
165
182
  source: templateSources.tsCli,
166
183
  plannerSourceFile: fileURLToPath(import.meta.url),
167
- blueprint(context) {
168
- return {
169
- schemaVersion: 2,
170
- packages: [
171
- cliContribution({
172
- context,
173
- packageLeafName: context.projectName,
174
- packagePath: `packages/${context.projectName}`,
175
- }).definition,
176
- ],
177
- };
178
- },
179
- planInitialization(context) {
180
- return cliContribution({
181
- context,
182
- packageLeafName: context.projectName,
183
- packagePath: `packages/${context.projectName}`,
184
- });
184
+ packageContributionReplayAdapters: [
185
+ cliPublicationCandidateReplayAdapter,
186
+ cliPackageAdditionReplayAdapter,
187
+ ],
188
+ initialPrimaryPackage: {
189
+ defaultLeafName: "cli",
190
+ role: "cli-tool",
191
+ defaultPackagePath: ({ packageLeafName }) => packagePathForLeaf(packageLeafName),
192
+ planInitialContribution({ context, resolvedPackageIdentity }) {
193
+ return cliPublicationCandidateReplayAdapter.identify(cliContribution({
194
+ context,
195
+ packageLeafName: resolvedPackageIdentity.leafName,
196
+ packagePath: resolvedPackageIdentity.definition.path,
197
+ packageDefinition: resolvedPackageIdentity.definition,
198
+ publicationCandidate: true,
199
+ }));
200
+ },
185
201
  },
186
202
  defaultPackagePath({ packageLeafName }) {
187
- return `packages/${packageLeafName}`;
203
+ return packagePathForLeaf(packageLeafName);
188
204
  },
189
205
  planPackageAddition({ context, packageLeafName, packagePath }) {
190
- return cliContribution({ context, packageLeafName, packagePath });
206
+ return cliPackageAdditionReplayAdapter.identify(cliContribution({
207
+ context,
208
+ packageLeafName,
209
+ packagePath,
210
+ publicationCandidate: false,
211
+ }));
191
212
  },
192
213
  };
@@ -1,2 +1,31 @@
1
- import type { BuiltInPresetDefinition } from "#template-core/preset-definition";
2
- export declare const tsLibDefinition: BuiltInPresetDefinition;
1
+ import { type GenerationContext } from "#template-core/preset-definition";
2
+ export declare const tsLibDefinition: {
3
+ metadata: {
4
+ name: string;
5
+ title: string;
6
+ description: string;
7
+ };
8
+ source: import("@ykdz/template-core/renderer").TemplateSourceHandle;
9
+ plannerSourceFile: string;
10
+ packageContributionReplayAdapters: import("@ykdz/template-core/preset-definition").PackageContributionReplayAdapter[];
11
+ initialPrimaryPackage: {
12
+ defaultLeafName: string;
13
+ role: "shared-library";
14
+ defaultPackagePath: ({ packageLeafName }: {
15
+ readonly packageLeafName: string;
16
+ }) => string;
17
+ planInitialContribution({ context, resolvedPackageIdentity }: {
18
+ readonly context: GenerationContext;
19
+ readonly resolvedPackageIdentity: import("@ykdz/template-core/preset-definition").ResolvedPrimaryPackageIdentity;
20
+ }): import("@ykdz/template-core/preset-definition").PlannedPackageContribution;
21
+ };
22
+ defaultPackagePath({ packageLeafName }: {
23
+ readonly context: GenerationContext;
24
+ readonly packageLeafName: string;
25
+ }): string;
26
+ planPackageAddition({ context, packageLeafName, packagePath }: {
27
+ readonly context: GenerationContext;
28
+ readonly packageLeafName: string;
29
+ readonly packagePath: string;
30
+ }): import("@ykdz/template-core/preset-definition").PlannedPackageContribution;
31
+ };
@@ -1,6 +1,10 @@
1
1
  import { fileURLToPath } from "node:url";
2
+ import { definePackageContributionReplayAdapter, } from "#template-core/preset-definition";
2
3
  import { typescriptConfigSourceOperation } from "../shared/typescript.js";
3
4
  import { templateSources } from "../template-sources.js";
5
+ function packagePathForLeaf(packageLeafName) {
6
+ return `packages/${packageLeafName}`;
7
+ }
4
8
  function packageScripts() {
5
9
  return {
6
10
  "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
@@ -12,8 +16,8 @@ function packageScripts() {
12
16
  };
13
17
  }
14
18
  function libraryContribution(options) {
15
- const definition = {
16
- name: `@${options.context.scope}/${options.packageLeafName}`,
19
+ const definition = options.packageDefinition ?? {
20
+ name: `@${options.context.defaultPackageScope}/${options.packageLeafName}`,
17
21
  path: options.packagePath,
18
22
  role: "shared-library",
19
23
  };
@@ -71,7 +75,6 @@ function libraryContribution(options) {
71
75
  exposure,
72
76
  manifest: {
73
77
  name: definition.name,
74
- version: "0.0.0",
75
78
  private: true,
76
79
  type: "module",
77
80
  ...exposure,
@@ -91,6 +94,7 @@ function libraryContribution(options) {
91
94
  foundation: {
92
95
  toolchains: {},
93
96
  editorCapabilities: ["oxc-format-lint"],
97
+ typescriptConfigurationPackage: { dependency: "required" },
94
98
  dependencyMaintenance: {
95
99
  ecosystems: ["npm", "github-actions", "docker"],
96
100
  interval: "weekly",
@@ -98,6 +102,15 @@ function libraryContribution(options) {
98
102
  },
99
103
  };
100
104
  }
105
+ const libraryReplayAdapter = definePackageContributionReplayAdapter({
106
+ identity: "library",
107
+ replay: ({ context, packageDefinition, packageLeafName }) => libraryContribution({
108
+ context,
109
+ packageLeafName,
110
+ packagePath: packageDefinition.path,
111
+ packageDefinition,
112
+ }),
113
+ });
101
114
  export const tsLibDefinition = {
102
115
  metadata: {
103
116
  name: "ts-lib",
@@ -106,29 +119,24 @@ export const tsLibDefinition = {
106
119
  },
107
120
  source: templateSources.tsLib,
108
121
  plannerSourceFile: fileURLToPath(import.meta.url),
109
- blueprint(context) {
110
- return {
111
- schemaVersion: 2,
112
- packages: [
113
- libraryContribution({
114
- context,
115
- packageLeafName: context.projectName,
116
- packagePath: `packages/${context.projectName}`,
117
- }).definition,
118
- ],
119
- };
120
- },
121
- planInitialization(context) {
122
- return libraryContribution({
123
- context,
124
- packageLeafName: context.projectName,
125
- packagePath: `packages/${context.projectName}`,
126
- });
122
+ packageContributionReplayAdapters: [libraryReplayAdapter],
123
+ initialPrimaryPackage: {
124
+ defaultLeafName: "lib",
125
+ role: "shared-library",
126
+ defaultPackagePath: ({ packageLeafName }) => packagePathForLeaf(packageLeafName),
127
+ planInitialContribution({ context, resolvedPackageIdentity }) {
128
+ return libraryReplayAdapter.identify(libraryContribution({
129
+ context,
130
+ packageLeafName: resolvedPackageIdentity.leafName,
131
+ packagePath: resolvedPackageIdentity.definition.path,
132
+ packageDefinition: resolvedPackageIdentity.definition,
133
+ }));
134
+ },
127
135
  },
128
136
  defaultPackagePath({ packageLeafName }) {
129
- return `packages/${packageLeafName}`;
137
+ return packagePathForLeaf(packageLeafName);
130
138
  },
131
139
  planPackageAddition({ context, packageLeafName, packagePath }) {
132
- return libraryContribution({ context, packageLeafName, packagePath });
140
+ return libraryReplayAdapter.identify(libraryContribution({ context, packageLeafName, packagePath }));
133
141
  },
134
142
  };
@@ -1,2 +1,22 @@
1
- import type { BuiltInPresetDefinition } from "#template-core/preset-definition";
2
- export declare const vikeAppDefinition: BuiltInPresetDefinition;
1
+ import { type GenerationContext } from "#template-core/preset-definition";
2
+ import type { PackageDefinition } from "#template-core/project-blueprint";
3
+ export declare const vikeAppDefinition: {
4
+ metadata: {
5
+ name: string;
6
+ title: string;
7
+ description: string;
8
+ };
9
+ source: import("@ykdz/template-core/renderer").TemplateSourceHandle;
10
+ plannerSourceFile: string;
11
+ packageContributionReplayAdapters: import("@ykdz/template-core/preset-definition").PackageContributionReplayAdapter[];
12
+ blueprint(context: GenerationContext): {
13
+ schemaVersion: 3;
14
+ packages: PackageDefinition[];
15
+ packageLinkIntents: {
16
+ consumerPackagePath: string;
17
+ providerPackagePath: string;
18
+ }[];
19
+ };
20
+ planInitialization(context: GenerationContext): import("@ykdz/template-core/preset-definition").PlannedPackageContribution;
21
+ planInitializationContributions(context: GenerationContext): import("@ykdz/template-core/preset-definition").PlannedPackageContribution[];
22
+ };
@@ -1,5 +1,6 @@
1
1
  import { fileURLToPath } from "node:url";
2
2
  import { dockerEngineEnvironmentNeed, playwrightBrowserAssetsEnvironmentNeed, shellCheckEnvironmentNeed, } from "#template-core/module-graph";
3
+ import { definePackageContributionReplayAdapter, } from "#template-core/preset-definition";
3
4
  import { browserTestDevelopmentContainerToolLayer } from "../shared/development-container.js";
4
5
  import { typescriptConfigSourceOperation } from "../shared/typescript.js";
5
6
  import { vueTypecheckRunnerSourceOperation } from "../shared/vue.js";
@@ -7,33 +8,44 @@ import { templateSources } from "../template-sources.js";
7
8
  function definitions(context) {
8
9
  return {
9
10
  web: {
10
- name: `@${context.scope}/web`,
11
+ name: `@${context.defaultPackageScope}/web`,
11
12
  path: "apps/web",
12
13
  role: "runtime-service",
13
14
  },
14
15
  db: {
15
- name: `@${context.scope}/db`,
16
+ name: `@${context.defaultPackageScope}/db`,
16
17
  path: "packages/db",
17
18
  role: "shared-library",
18
19
  },
19
20
  migrations: {
20
- name: `@${context.scope}/db-migrations`,
21
+ name: `@${context.defaultPackageScope}/db-migrations`,
21
22
  path: "packages/db-migrations",
22
23
  role: "shared-library",
23
24
  },
24
25
  };
25
26
  }
26
- function foundation() {
27
+ function replayDefinitions(initialPackages) {
28
+ return {
29
+ web: initialPackages.require("web"),
30
+ db: initialPackages.require("database"),
31
+ migrations: initialPackages.require("migrations"),
32
+ };
33
+ }
34
+ function foundation(packageDefinitions) {
35
+ const workspacePackageGlobs = [
36
+ ...new Set(Object.values(packageDefinitions).map((definition) => `${definition.path.split("/")[0]}/*`)),
37
+ ];
27
38
  return {
28
39
  toolchains: {},
29
40
  editorCapabilities: ["oxc-format-lint", "vue", "tailwind", "vitest"],
41
+ typescriptConfigurationPackage: { dependency: "required" },
30
42
  dependencyMaintenance: {
31
43
  ecosystems: ["npm", "github-actions", "docker"],
32
44
  directories: { npm: "/", docker: "/.devcontainer" },
33
- extraDirectories: { docker: ["/apps/web"] },
45
+ extraDirectories: { docker: [`/${packageDefinitions.web.path}`] },
34
46
  interval: "weekly",
35
47
  },
36
- workspacePackageGlobs: ["apps/*", "packages/*"],
48
+ workspacePackageGlobs,
37
49
  };
38
50
  }
39
51
  function shellCheckDevelopmentContainerToolLayer() {
@@ -82,19 +94,18 @@ function dockerClientDevelopmentContainerToolLayer() {
82
94
  };
83
95
  }
84
96
  function webScripts() {
85
- const prepareDatabase = "DATABASE_FILE=../../apps/web/data/app.sqlite pnpm --dir ../../packages/db-migrations run db:prepare:dev";
86
97
  return {
87
98
  build: "vike build",
88
99
  deployment: "node --conditions=source scripts/check-standalone-deployment.ts",
89
- dev: `${prepareDatabase} && vike dev`,
100
+ dev: "vike dev",
90
101
  "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
91
102
  "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
92
103
  lint: "shellcheck scripts/container-entrypoint.sh && oxlint --quiet --format=unix --type-aware --config ../../oxlint.config.ts .",
93
104
  "lint:fix": "oxlint --type-aware --format=unix --config ../../oxlint.config.ts . --fix",
94
- preview: `${prepareDatabase} && vike preview`,
105
+ preview: "vike preview",
95
106
  start: "node ./dist/server/index.mjs",
96
107
  test: "vitest run --reporter=agent --silent=passed-only --passWithNoTests",
97
- "test:e2e": "node --conditions=source scripts/run-playwright.ts",
108
+ "test:e2e": "playwright test",
98
109
  typecheck: "node --conditions=source scripts/run-vue-tsc.ts --build --noEmit --pretty false",
99
110
  };
100
111
  }
@@ -106,7 +117,7 @@ function databaseScripts() {
106
117
  "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
107
118
  lint: "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
108
119
  "lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
109
- test: 'DATABASE_FILE="$(pwd)/node_modules/.tmp/test.sqlite" pnpm --dir ../db-migrations run db:prepare:test && DATABASE_FILE="$(pwd)/node_modules/.tmp/test.sqlite" vitest run --reporter=agent --silent=passed-only; status=$?; rm -f ./node_modules/.tmp/test.sqlite; exit $status',
120
+ test: "vitest run --reporter=agent --silent=passed-only",
110
121
  typecheck: "tsc -p tsconfig.json --noEmit --pretty false",
111
122
  };
112
123
  }
@@ -117,9 +128,7 @@ function migrationScripts(databasePackageName) {
117
128
  "db:generate": withDatabasePackage("drizzle-kit generate"),
118
129
  "db:migrate": withDatabasePackage("drizzle-kit migrate"),
119
130
  "db:prepare:deploy": "pnpm run db:migrate",
120
- "db:prepare:dev": `DATABASE_PACKAGE_NAME=${databasePackageName} node --conditions=source scripts/prepare-database.ts dev`,
121
- "db:prepare:test": `DATABASE_PACKAGE_NAME=${databasePackageName} node --conditions=source scripts/prepare-database.ts test`,
122
- "db:push": withDatabasePackage("mkdir -p data node_modules/.tmp && drizzle-kit push"),
131
+ "db:push": withDatabasePackage("drizzle-kit push"),
123
132
  "db:studio": withDatabasePackage("drizzle-kit studio"),
124
133
  "format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
125
134
  "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
@@ -152,8 +161,8 @@ function copyOperations(context, packagePath, sourceFiles) {
152
161
  };
153
162
  });
154
163
  }
155
- function webContribution(context) {
156
- const { web, db } = definitions(context);
164
+ function webContribution(context, packageDefinitions = definitions(context)) {
165
+ const { web, db, migrations } = packageDefinitions;
157
166
  const sourceFiles = [
158
167
  "web/+server.ts",
159
168
  "web/.env.example",
@@ -169,8 +178,8 @@ function webContribution(context) {
169
178
  "web/playwright.config.ts",
170
179
  "web/scripts/check-standalone-deployment.ts",
171
180
  "web/scripts/container-entrypoint.sh",
172
- "web/scripts/run-playwright.ts",
173
181
  "web/server/api.ts",
182
+ "web/test/playwright-teardown.ts",
174
183
  "web/test/e2e/app.spec.ts",
175
184
  "web/turbo.json",
176
185
  "web/types/env.d.ts",
@@ -197,8 +206,8 @@ function webContribution(context) {
197
206
  replacements: {
198
207
  NODE_VERSION: context.toolchain.nodeLtsMajor,
199
208
  PACKAGE_MANAGER_PIN: context.toolchain.packageManagerPin,
200
- DB_PACKAGE_NAME: definitions(context).db.name,
201
- DB_MIGRATIONS_PACKAGE_NAME: definitions(context).migrations.name,
209
+ DB_PACKAGE_NAME: db.name,
210
+ DB_MIGRATIONS_PACKAGE_NAME: migrations.name,
202
211
  WEB_PACKAGE_NAME: web.name,
203
212
  },
204
213
  },
@@ -268,7 +277,6 @@ function webContribution(context) {
268
277
  },
269
278
  manifest: {
270
279
  name: web.name,
271
- version: "0.0.0",
272
280
  private: true,
273
281
  type: "module",
274
282
  files: ["dist"],
@@ -318,7 +326,7 @@ function webContribution(context) {
318
326
  ciDiagnosticArtifacts: [{ kind: "playwright", owner }],
319
327
  deploymentEnvironmentNeeds: [dockerEngineEnvironmentNeed()],
320
328
  foundation: {
321
- ...foundation(),
329
+ ...foundation(packageDefinitions),
322
330
  developmentContainerToolLayers: [
323
331
  browserTestDevelopmentContainerToolLayer(),
324
332
  shellCheckDevelopmentContainerToolLayer(),
@@ -327,13 +335,15 @@ function webContribution(context) {
327
335
  },
328
336
  };
329
337
  }
330
- function databaseContribution(context) {
331
- const { db } = definitions(context);
338
+ function databaseContribution(context, packageDefinitions = definitions(context)) {
339
+ const { db } = packageDefinitions;
332
340
  const sourceFiles = [
333
341
  "db/turbo.json",
334
342
  "db/tsconfig.json",
335
343
  "db/tsconfig.build.json",
336
344
  "db/scripts/seed-example.ts",
345
+ "db/vitest.config.ts",
346
+ "db/test/global-setup.ts",
337
347
  "db/src/db.ts",
338
348
  "db/src/index.ts",
339
349
  "db/src/queries/todos.ts",
@@ -364,7 +374,6 @@ function databaseContribution(context) {
364
374
  exposure,
365
375
  manifest: {
366
376
  name: db.name,
367
- version: "0.0.0",
368
377
  private: true,
369
378
  type: "module",
370
379
  ...exposure,
@@ -385,18 +394,17 @@ function databaseContribution(context) {
385
394
  ...copyOperations(context, db.path, sourceFiles),
386
395
  ],
387
396
  environmentNeeds: [],
388
- foundation: foundation(),
397
+ foundation: foundation(packageDefinitions),
389
398
  };
390
399
  }
391
- function migrationsContribution(context) {
392
- const { db, migrations } = definitions(context);
400
+ function migrationsContribution(context, packageDefinitions = definitions(context)) {
401
+ const { db, migrations } = packageDefinitions;
393
402
  const sourceFiles = [
394
403
  "db-migrations/drizzle.config.ts",
395
404
  "db-migrations/tsconfig.json",
396
405
  "db-migrations/tsconfig.build.json",
397
406
  "db-migrations/drizzle/migrations/20260709120325_old_captain_flint/migration.sql",
398
407
  "db-migrations/drizzle/migrations/20260709120325_old_captain_flint/snapshot.json",
399
- "db-migrations/scripts/prepare-database.ts",
400
408
  "db-migrations/turbo.json",
401
409
  ];
402
410
  return {
@@ -404,7 +412,6 @@ function migrationsContribution(context) {
404
412
  exposure: { exports: {}, imports: {} },
405
413
  manifest: {
406
414
  name: migrations.name,
407
- version: "0.0.0",
408
415
  private: true,
409
416
  type: "module",
410
417
  files: ["drizzle.config.ts", "drizzle/migrations"],
@@ -429,9 +436,21 @@ function migrationsContribution(context) {
429
436
  ...copyOperations(context, migrations.path, sourceFiles),
430
437
  ],
431
438
  environmentNeeds: [],
432
- foundation: foundation(),
439
+ foundation: foundation(packageDefinitions),
433
440
  };
434
441
  }
442
+ const webReplayAdapter = definePackageContributionReplayAdapter({
443
+ identity: "web",
444
+ replay: ({ context, initialPackages }) => webContribution(context, replayDefinitions(initialPackages)),
445
+ });
446
+ const databaseReplayAdapter = definePackageContributionReplayAdapter({
447
+ identity: "database",
448
+ replay: ({ context, initialPackages }) => databaseContribution(context, replayDefinitions(initialPackages)),
449
+ });
450
+ const migrationsReplayAdapter = definePackageContributionReplayAdapter({
451
+ identity: "migrations",
452
+ replay: ({ context, initialPackages }) => migrationsContribution(context, replayDefinitions(initialPackages)),
453
+ });
435
454
  export const vikeAppDefinition = {
436
455
  metadata: {
437
456
  name: "vike-app",
@@ -440,10 +459,15 @@ export const vikeAppDefinition = {
440
459
  },
441
460
  source: templateSources.vikeApp,
442
461
  plannerSourceFile: fileURLToPath(import.meta.url),
462
+ packageContributionReplayAdapters: [
463
+ webReplayAdapter,
464
+ databaseReplayAdapter,
465
+ migrationsReplayAdapter,
466
+ ],
443
467
  blueprint(context) {
444
468
  const { web, db, migrations } = definitions(context);
445
469
  return {
446
- schemaVersion: 2,
470
+ schemaVersion: 3,
447
471
  packages: [web, db, migrations],
448
472
  packageLinkIntents: [
449
473
  { consumerPackagePath: web.path, providerPackagePath: db.path },
@@ -454,12 +478,14 @@ export const vikeAppDefinition = {
454
478
  ],
455
479
  };
456
480
  },
457
- planInitialization: webContribution,
481
+ planInitialization(context) {
482
+ return webReplayAdapter.identify(webContribution(context));
483
+ },
458
484
  planInitializationContributions(context) {
459
485
  return [
460
- webContribution(context),
461
- databaseContribution(context),
462
- migrationsContribution(context),
486
+ webReplayAdapter.identify(webContribution(context)),
487
+ databaseReplayAdapter.identify(databaseContribution(context)),
488
+ migrationsReplayAdapter.identify(migrationsContribution(context)),
463
489
  ];
464
490
  },
465
491
  };
@@ -1,2 +1,26 @@
1
- import type { BuiltInPresetDefinition } from "#template-core/preset-definition";
2
- export declare const vueAppDefinition: BuiltInPresetDefinition;
1
+ import { type GenerationContext } from "#template-core/preset-definition";
2
+ import type { PackageDefinition } from "#template-core/project-blueprint";
3
+ export declare const vueAppDefinition: {
4
+ metadata: {
5
+ name: string;
6
+ title: string;
7
+ description: string;
8
+ };
9
+ source: import("@ykdz/template-core/renderer").TemplateSourceHandle;
10
+ plannerSourceFile: string;
11
+ packageContributionReplayAdapters: import("@ykdz/template-core/preset-definition").PackageContributionReplayAdapter[];
12
+ blueprint(context: GenerationContext): {
13
+ schemaVersion: 3;
14
+ packages: PackageDefinition[];
15
+ };
16
+ planInitialization(context: GenerationContext): import("@ykdz/template-core/preset-definition").PlannedPackageContribution;
17
+ defaultPackagePath({ packageLeafName }: {
18
+ readonly context: GenerationContext;
19
+ readonly packageLeafName: string;
20
+ }): string;
21
+ planPackageAddition({ context, packageLeafName, packagePath }: {
22
+ readonly context: GenerationContext;
23
+ readonly packageLeafName: string;
24
+ readonly packagePath: string;
25
+ }): import("@ykdz/template-core/preset-definition").PlannedPackageContribution;
26
+ };