@ykdz/template 0.0.4 → 0.0.5

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.
@@ -0,0 +1,116 @@
1
+ export function derivePackageExposure(definition) {
2
+ if (definition.role === "shared-library" &&
3
+ definition.sourcePreset === "ts-lib") {
4
+ return {
5
+ kind: "jit-source",
6
+ entrypoint: "./src/index.ts",
7
+ packageLocalImportPattern: "#/*",
8
+ packageLocalImportTarget: "./src/*.ts",
9
+ };
10
+ }
11
+ if (definition.role === "runtime-service" &&
12
+ definition.sourcePreset === "hono-api") {
13
+ return {
14
+ kind: "compiled",
15
+ entrypoint: "./dist/index.js",
16
+ sourceTypes: "./src/index.ts",
17
+ packageLocalImportPattern: "#/*",
18
+ packageLocalImportRuntimeTarget: "./dist/*.js",
19
+ packageLocalImportTypesTarget: "./src/*.ts",
20
+ };
21
+ }
22
+ throw new Error(`Unsupported Package Exposure for ${definition.name} at ${definition.path}`);
23
+ }
24
+ export function assertTypeScriptPackageBoundaryForLinkIntent(definition, direction) {
25
+ if (definition.role !== undefined && definition.sourcePreset !== undefined) {
26
+ return;
27
+ }
28
+ const relationship = direction === "consumer" ? "from native package" : "to native package";
29
+ throw new Error(`Package Link Intent ${relationship} ${definition.path} is unsupported in V1 TypeScript-only Project Linking`);
30
+ }
31
+ export function planPackageLinks(definitions, intents = []) {
32
+ const definitionsByPath = new Map(definitions.map((definition) => [definition.path, definition]));
33
+ const manifestDependenciesByPackagePath = new Map();
34
+ for (const intent of intents) {
35
+ const consumer = definitionsByPath.get(intent.consumerPackagePath);
36
+ const provider = definitionsByPath.get(intent.providerPackagePath);
37
+ if (consumer !== undefined) {
38
+ assertTypeScriptPackageBoundaryForLinkIntent(consumer, "consumer");
39
+ }
40
+ if (provider === undefined) {
41
+ throw new Error(`Package Link Intent references unknown provider package at ${intent.providerPackagePath}`);
42
+ }
43
+ assertTypeScriptPackageBoundaryForLinkIntent(provider, "provider");
44
+ }
45
+ const exposuresByPackagePath = new Map(definitions.map((definition) => [
46
+ definition.path,
47
+ derivePackageExposure(definition),
48
+ ]));
49
+ let dependencyBuildsRequired = false;
50
+ for (const intent of intents) {
51
+ const provider = definitionsByPath.get(intent.providerPackagePath);
52
+ if (provider === undefined) {
53
+ throw new Error(`Package Link Intent references unknown provider package at ${intent.providerPackagePath}`);
54
+ }
55
+ if (exposuresByPackagePath.get(provider.path)?.kind === "compiled") {
56
+ dependencyBuildsRequired = true;
57
+ }
58
+ const dependencies = manifestDependenciesByPackagePath.get(intent.consumerPackagePath) ?? {};
59
+ dependencies[provider.name] = "workspace:*";
60
+ manifestDependenciesByPackagePath.set(intent.consumerPackagePath, dependencies);
61
+ }
62
+ return {
63
+ exposuresByPackagePath,
64
+ manifestDependenciesByPackagePath,
65
+ turboTasks: packageTurboTasks({ dependencyBuildsRequired }),
66
+ };
67
+ }
68
+ export function packageTurboTasks({ dependencyBuildsRequired, }) {
69
+ return {
70
+ typecheck: { dependsOn: ["^typecheck"] },
71
+ build: dependencyBuildsRequired
72
+ ? { dependsOn: ["^build"], outputs: ["dist/**"] }
73
+ : { outputs: ["dist/**"] },
74
+ test: { dependsOn: ["^typecheck"] },
75
+ "test:e2e": {
76
+ dependsOn: dependencyBuildsRequired ? ["build", "^build"] : ["build"],
77
+ },
78
+ check: { dependsOn: ["typecheck", "build", "test", "test:e2e"] },
79
+ fix: { cache: false },
80
+ };
81
+ }
82
+ export function packageManifestExposureFields(exposure) {
83
+ switch (exposure.kind) {
84
+ case "jit-source":
85
+ return {
86
+ imports: {
87
+ [exposure.packageLocalImportPattern]: {
88
+ default: exposure.packageLocalImportTarget,
89
+ types: exposure.packageLocalImportTarget,
90
+ },
91
+ },
92
+ exports: {
93
+ ".": {
94
+ default: exposure.entrypoint,
95
+ types: exposure.entrypoint,
96
+ },
97
+ },
98
+ };
99
+ case "compiled":
100
+ return {
101
+ types: exposure.sourceTypes,
102
+ imports: {
103
+ [exposure.packageLocalImportPattern]: {
104
+ default: exposure.packageLocalImportRuntimeTarget,
105
+ types: exposure.packageLocalImportTypesTarget,
106
+ },
107
+ },
108
+ exports: {
109
+ ".": {
110
+ default: exposure.entrypoint,
111
+ types: exposure.sourceTypes,
112
+ },
113
+ },
114
+ };
115
+ }
116
+ }
@@ -2,6 +2,7 @@ import type { BuiltInPreset, ProjectBlueprint } from "./declarations.js";
2
2
  import type { GenerationContext } from "./generation-context.js";
3
3
  import { type CheckPlan, type FixPlan } from "./module-graph.js";
4
4
  import { type NextStepInstruction } from "./next-step-instructions.js";
5
+ import type { PackageRole, PackageSourcePreset } from "./package-linking.js";
5
6
  import type { DependencyMaintenancePolicy } from "./project-github.js";
6
7
  import type { RenderOperation } from "./renderer.js";
7
8
  export type PresetPackageAdditionOptions = {
@@ -15,7 +16,8 @@ export type PresetPackageAdditionOptions = {
15
16
  export type PresetPackageAdditionPlan = {
16
17
  readonly packagePath: string;
17
18
  readonly workspacePackageGlob: string;
18
- readonly rootTsconfigReferences: readonly string[];
19
+ readonly packageRole: PackageRole;
20
+ readonly packageSourcePreset: PackageSourcePreset;
19
21
  readonly sourceRoot: string;
20
22
  readonly sourceRoots?: Record<string, string>;
21
23
  readonly operations: readonly RenderOperation[];
@@ -82,6 +82,7 @@ const packageJsonRootKeyOrder = [
82
82
  "files",
83
83
  "type",
84
84
  "types",
85
+ "imports",
85
86
  "exports",
86
87
  "scripts",
87
88
  "dependencies",
@@ -5,6 +5,8 @@ import { collectGeneratedManifestCatalogDependencies, renderGeneratedPnpmWorkspa
5
5
  import { checkedDockerfileFirstNodePnpmDevcontainer, nodePnpmToolLayer, } from "../../src/devcontainer.js";
6
6
  import { editorCustomizationForCapabilities } from "../../src/editor-customization.js";
7
7
  import { renderFixCommand, renderRootCheckCommand, } from "../../src/module-graph.js";
8
+ import { PackageAdditionSupport } from "../../src/package-addition-support.js";
9
+ import { packageManifestExposureFields, planPackageLinks, packageTurboTasks, } from "../../src/package-linking.js";
8
10
  import { renderNewProject } from "../../src/renderer.js";
9
11
  const generatedBy = {
10
12
  packageName: "@ykdz/template",
@@ -18,6 +20,7 @@ export const honoApiPresetMetadata = {
18
20
  generation: "supported",
19
21
  supportedPackageManagers: ["pnpm"],
20
22
  supportedProjectKinds: ["multi-package"],
23
+ packageAdditionSupport: PackageAdditionSupport.Supported,
21
24
  features: [
22
25
  "pnpm-catalog",
23
26
  "oxc-format-lint",
@@ -63,6 +66,9 @@ function planHonoApiRootChecks() {
63
66
  { kind: "oxc-format-check", owner: rootBoundary },
64
67
  { kind: "oxc-lint", owner: rootBoundary },
65
68
  { kind: "typescript-typecheck", owner: rootBoundary },
69
+ { kind: "turbo-package-typecheck", owner: workspacePackageBoundary },
70
+ { kind: "turbo-package-build", owner: workspacePackageBoundary },
71
+ { kind: "turbo-package-test", owner: workspacePackageBoundary },
66
72
  { kind: "turbo-package-check", owner: workspacePackageBoundary },
67
73
  ],
68
74
  environmentNeeds: [],
@@ -159,6 +165,12 @@ function apiPackageJson(context) {
159
165
  version: "0.0.0",
160
166
  private: true,
161
167
  type: "module",
168
+ imports: {
169
+ "#/*": {
170
+ default: "./dist/*.js",
171
+ types: "./src/*.ts",
172
+ },
173
+ },
162
174
  scripts: projectHonoApiPackageScripts(),
163
175
  dependencies: {
164
176
  "@hono/node-server": "catalog:",
@@ -203,6 +215,7 @@ function operationsForHonoApi(context, packageScripts, checkPlan) {
203
215
  });
204
216
  const rootManifest = rootPackageJson(context, packageScripts);
205
217
  const apiManifest = apiPackageJson(context);
218
+ const turboTasks = packageTurboTasks({ dependencyBuildsRequired: false });
206
219
  return [
207
220
  {
208
221
  kind: "writeJson",
@@ -225,13 +238,11 @@ function operationsForHonoApi(context, packageScripts, checkPlan) {
225
238
  to: "turbo.json",
226
239
  value: {
227
240
  tasks: {
228
- build: {
229
- dependsOn: ["^build"],
230
- outputs: ["dist/**"],
231
- },
232
- check: {
233
- dependsOn: ["^build"],
234
- },
241
+ build: turboTasks.build,
242
+ check: turboTasks.check,
243
+ typecheck: turboTasks.typecheck,
244
+ test: turboTasks.test,
245
+ "test:e2e": turboTasks["test:e2e"],
235
246
  fix: {
236
247
  cache: false,
237
248
  },
@@ -275,9 +286,6 @@ function operationsForHonoApi(context, packageScripts, checkPlan) {
275
286
  module: "NodeNext",
276
287
  moduleResolution: "NodeNext",
277
288
  noEmitOnError: true,
278
- paths: {
279
- "@/*": ["./src/*"],
280
- },
281
289
  skipLibCheck: false,
282
290
  strict: true,
283
291
  target: "ES2022",
@@ -383,6 +391,18 @@ function operationsForHonoApi(context, packageScripts, checkPlan) {
383
391
  ];
384
392
  }
385
393
  function packageAdditionOperations(packagePath, packageName, nodeVersion) {
394
+ const packageExposure = planPackageLinks([
395
+ {
396
+ name: packageName,
397
+ path: packagePath,
398
+ role: "runtime-service",
399
+ sourcePreset: "hono-api",
400
+ },
401
+ ]).exposuresByPackagePath.get(packagePath);
402
+ if (packageExposure === undefined) {
403
+ throw new Error(`Missing Package Exposure for ${packagePath}`);
404
+ }
405
+ const exposureFields = packageManifestExposureFields(packageExposure);
386
406
  return [
387
407
  {
388
408
  kind: "writeJson",
@@ -392,6 +412,9 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
392
412
  version: "0.0.0",
393
413
  private: true,
394
414
  type: "module",
415
+ types: exposureFields.types,
416
+ exports: exposureFields.exports,
417
+ imports: exposureFields.imports,
395
418
  scripts: projectHonoApiPackageScripts(),
396
419
  dependencies: {
397
420
  "@hono/node-server": "catalog:",
@@ -419,9 +442,6 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
419
442
  module: "NodeNext",
420
443
  moduleResolution: "NodeNext",
421
444
  noEmitOnError: true,
422
- paths: {
423
- "@/*": ["./src/*"],
424
- },
425
445
  skipLibCheck: false,
426
446
  strict: true,
427
447
  target: "ES2022",
@@ -466,7 +486,8 @@ function packageAdditionPlan(packageName, packagePath, nodeVersion) {
466
486
  return {
467
487
  packagePath,
468
488
  workspacePackageGlob: `${workspaceCollection}/*`,
469
- rootTsconfigReferences: [`./${packagePath}/tsconfig.json`],
489
+ packageRole: "runtime-service",
490
+ packageSourcePreset: "hono-api",
470
491
  sourceRoot: templateSourceRoot(),
471
492
  sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
472
493
  operations: packageAdditionOperations(packagePath, packageName, nodeVersion),
@@ -1,3 +1,4 @@
1
+ import { PackageAdditionSupport } from "../src/package-addition-support.js";
1
2
  import { honoApiPresetProjection } from "./hono-api/projection.js";
2
3
  import { rustBinPresetProjection } from "./rust-bin/projection.js";
3
4
  import { tsLibPresetProjection } from "./ts-lib/projection.js";
@@ -11,6 +12,7 @@ const futurePresetMetadata = [
11
12
  generation: "future",
12
13
  supportedPackageManagers: ["pnpm"],
13
14
  supportedProjectKinds: ["multi-package"],
15
+ packageAdditionSupport: PackageAdditionSupport.Unsupported,
14
16
  features: [],
15
17
  },
16
18
  {
@@ -20,6 +22,7 @@ const futurePresetMetadata = [
20
22
  generation: "future",
21
23
  supportedPackageManagers: ["pnpm"],
22
24
  supportedProjectKinds: ["multi-package"],
25
+ packageAdditionSupport: PackageAdditionSupport.Unsupported,
23
26
  features: [],
24
27
  },
25
28
  ];
@@ -5,6 +5,7 @@ import { collectGeneratedManifestCatalogDependencies, renderGeneratedPnpmWorkspa
5
5
  import { dockerfileFirstRustPnpmDevcontainer, nodePnpmToolLayer, rustToolLayer, } from "../../src/devcontainer.js";
6
6
  import { editorCustomizationForCapabilities } from "../../src/editor-customization.js";
7
7
  import { renderFixCommand, renderRootCheckCommand, } from "../../src/module-graph.js";
8
+ import { PackageAdditionSupport } from "../../src/package-addition-support.js";
8
9
  import { renderNewProject } from "../../src/renderer.js";
9
10
  const generatedBy = {
10
11
  packageName: "@ykdz/template",
@@ -18,6 +19,7 @@ export const rustBinPresetMetadata = {
18
19
  generation: "supported",
19
20
  supportedPackageManagers: ["pnpm"],
20
21
  supportedProjectKinds: ["multi-package"],
22
+ packageAdditionSupport: PackageAdditionSupport.Unsupported,
21
23
  features: [
22
24
  "root-check",
23
25
  "fix-command",
@@ -283,7 +285,15 @@ function operationsForRustBin(context, devcontainerName, projectName, packageScr
283
285
  {
284
286
  kind: "writeText",
285
287
  to: ".gitignore",
286
- text: ["target", ".env", ".template/", ".pnpm-store/", ""].join("\n"),
288
+ text: [
289
+ "target",
290
+ "node_modules",
291
+ "dist",
292
+ ".env",
293
+ ".template/",
294
+ ".pnpm-store/",
295
+ "",
296
+ ].join("\n"),
287
297
  },
288
298
  {
289
299
  kind: "copyFile",
@@ -5,6 +5,8 @@ import { collectGeneratedManifestCatalogDependencies, renderGeneratedPnpmWorkspa
5
5
  import { checkedDockerfileFirstNodePnpmDevcontainer, nodePnpmToolLayer, } from "../../src/devcontainer.js";
6
6
  import { editorCustomizationForCapabilities } from "../../src/editor-customization.js";
7
7
  import { renderFixCommand, renderRootCheckCommand, } from "../../src/module-graph.js";
8
+ import { PackageAdditionSupport } from "../../src/package-addition-support.js";
9
+ import { packageManifestExposureFields, planPackageLinks, } from "../../src/package-linking.js";
8
10
  import { renderNewProject } from "../../src/renderer.js";
9
11
  const generatedBy = {
10
12
  packageName: "@ykdz/template",
@@ -18,6 +20,7 @@ export const tsLibPresetMetadata = {
18
20
  generation: "supported",
19
21
  supportedPackageManagers: ["pnpm"],
20
22
  supportedProjectKinds: ["multi-package"],
23
+ packageAdditionSupport: PackageAdditionSupport.Supported,
21
24
  features: [
22
25
  "pnpm-catalog",
23
26
  "oxc-format-lint",
@@ -51,7 +54,6 @@ function planTsLibPackageChecks() {
51
54
  { kind: "typescript-typecheck", owner: tsLibPackageBoundary },
52
55
  { kind: "oxc-lint", owner: tsLibPackageBoundary },
53
56
  { kind: "oxc-format-check", owner: tsLibPackageBoundary },
54
- { kind: "build", owner: tsLibPackageBoundary },
55
57
  ],
56
58
  environmentNeeds: [],
57
59
  };
@@ -62,6 +64,7 @@ function planTsLibRootChecks() {
62
64
  { kind: "oxc-format-check", owner: tsLibRootBoundary },
63
65
  { kind: "oxc-lint", owner: tsLibRootBoundary },
64
66
  { kind: "typescript-typecheck", owner: tsLibRootBoundary },
67
+ { kind: "turbo-package-typecheck", owner: tsLibWorkspacePackageBoundary },
65
68
  { kind: "turbo-package-check", owner: tsLibWorkspacePackageBoundary },
66
69
  ],
67
70
  environmentNeeds: [],
@@ -133,7 +136,6 @@ export function projectTsLibPackageScripts() {
133
136
  const checkPlan = planTsLibPackageChecks();
134
137
  const fixPlan = planTsLibPackageFixes();
135
138
  return {
136
- build: "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
137
139
  check: renderRootCheckCommand(checkPlan),
138
140
  fix: renderFixCommand(fixPlan),
139
141
  "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
@@ -162,19 +164,15 @@ function rootPackageJson(context, packageScripts) {
162
164
  packageManager: context.toolchain.packageManagerPin.value,
163
165
  };
164
166
  }
165
- function libraryPackageJson(context) {
167
+ function libraryPackageJson(context, exposure) {
168
+ const exposureFields = packageManifestExposureFields(exposure);
166
169
  return {
167
170
  name: workspacePackageName(context),
168
171
  version: "0.0.0",
169
172
  private: true,
170
- files: ["dist"],
171
173
  type: "module",
172
- exports: {
173
- ".": {
174
- default: "./dist/index.js",
175
- types: "./dist/index.d.ts",
176
- },
177
- },
174
+ imports: exposureFields.imports,
175
+ exports: exposureFields.exports,
178
176
  dependencies: {
179
177
  valibot: "catalog:",
180
178
  },
@@ -183,7 +181,6 @@ function libraryPackageJson(context) {
183
181
  "@types/node": "catalog:",
184
182
  oxfmt: "catalog:",
185
183
  oxlint: "catalog:",
186
- "tsc-alias": "catalog:",
187
184
  typescript: "catalog:",
188
185
  },
189
186
  engines: {
@@ -215,7 +212,19 @@ function operationsForTsLib(context, packageScripts, checkPlan) {
215
212
  settings: editorCustomization.settings,
216
213
  });
217
214
  const rootManifest = rootPackageJson(context, packageScripts);
218
- const packageManifest = libraryPackageJson(context);
215
+ const packageLinkPlan = planPackageLinks([
216
+ {
217
+ name: workspacePackageName(context),
218
+ path: workspacePackagePath(context),
219
+ role: "shared-library",
220
+ sourcePreset: "ts-lib",
221
+ },
222
+ ]);
223
+ const packageExposure = packageLinkPlan.exposuresByPackagePath.get(workspacePackagePath(context));
224
+ if (packageExposure === undefined) {
225
+ throw new Error(`Missing Package Exposure for ${workspacePackagePath(context)}`);
226
+ }
227
+ const packageManifest = libraryPackageJson(context, packageExposure);
219
228
  return [
220
229
  {
221
230
  kind: "writeJson",
@@ -238,13 +247,11 @@ function operationsForTsLib(context, packageScripts, checkPlan) {
238
247
  to: "turbo.json",
239
248
  value: {
240
249
  tasks: {
241
- build: {
242
- dependsOn: ["^build"],
243
- outputs: ["dist/**"],
244
- },
245
- check: {
246
- dependsOn: ["^build"],
247
- },
250
+ build: packageLinkPlan.turboTasks.build,
251
+ check: packageLinkPlan.turboTasks.check,
252
+ typecheck: packageLinkPlan.turboTasks.typecheck,
253
+ test: packageLinkPlan.turboTasks.test,
254
+ "test:e2e": packageLinkPlan.turboTasks["test:e2e"],
248
255
  fix: {
249
256
  cache: false,
250
257
  },
@@ -256,9 +263,6 @@ function operationsForTsLib(context, packageScripts, checkPlan) {
256
263
  to: "tsconfig.json",
257
264
  value: {
258
265
  files: [],
259
- references: [
260
- { path: `./${workspacePackagePath(context)}/tsconfig.json` },
261
- ],
262
266
  },
263
267
  },
264
268
  {
@@ -293,10 +297,6 @@ function operationsForTsLib(context, packageScripts, checkPlan) {
293
297
  module: "NodeNext",
294
298
  moduleResolution: "NodeNext",
295
299
  noEmitOnError: true,
296
- outDir: "dist",
297
- paths: {
298
- "@/*": ["./src/*"],
299
- },
300
300
  rootDir: "src",
301
301
  skipLibCheck: false,
302
302
  strict: true,
@@ -335,6 +335,11 @@ function operationsForTsLib(context, packageScripts, checkPlan) {
335
335
  from: "src/index.ts",
336
336
  to: `${workspacePackagePath(context)}/src/index.ts`,
337
337
  },
338
+ {
339
+ kind: "copyFile",
340
+ from: "src/name-schema.ts",
341
+ to: `${workspacePackagePath(context)}/src/name-schema.ts`,
342
+ },
338
343
  {
339
344
  kind: "writeJson",
340
345
  to: ".template/blueprint.json",
@@ -382,6 +387,18 @@ function operationsForTsLib(context, packageScripts, checkPlan) {
382
387
  ];
383
388
  }
384
389
  function packageAdditionOperations(packagePath, packageName, nodeVersion) {
390
+ const packageExposure = planPackageLinks([
391
+ {
392
+ name: packageName,
393
+ path: packagePath,
394
+ role: "shared-library",
395
+ sourcePreset: "ts-lib",
396
+ },
397
+ ]).exposuresByPackagePath.get(packagePath);
398
+ if (packageExposure === undefined) {
399
+ throw new Error(`Missing Package Exposure for ${packagePath}`);
400
+ }
401
+ const exposureFields = packageManifestExposureFields(packageExposure);
385
402
  return [
386
403
  {
387
404
  kind: "writeJson",
@@ -390,14 +407,9 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
390
407
  name: packageName,
391
408
  version: "0.0.0",
392
409
  private: true,
393
- files: ["dist"],
394
410
  type: "module",
395
- exports: {
396
- ".": {
397
- default: "./dist/index.js",
398
- types: "./dist/index.d.ts",
399
- },
400
- },
411
+ imports: exposureFields.imports,
412
+ exports: exposureFields.exports,
401
413
  dependencies: {
402
414
  valibot: "catalog:",
403
415
  },
@@ -406,7 +418,6 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
406
418
  "@types/node": "catalog:",
407
419
  oxfmt: "catalog:",
408
420
  oxlint: "catalog:",
409
- "tsc-alias": "catalog:",
410
421
  typescript: "catalog:",
411
422
  },
412
423
  engines: {
@@ -426,10 +437,6 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
426
437
  module: "NodeNext",
427
438
  moduleResolution: "NodeNext",
428
439
  noEmitOnError: true,
429
- outDir: "dist",
430
- paths: {
431
- "@/*": ["./src/*"],
432
- },
433
440
  rootDir: "src",
434
441
  skipLibCheck: false,
435
442
  strict: true,
@@ -444,6 +451,11 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
444
451
  from: "src/index.ts",
445
452
  to: `${packagePath}/src/index.ts`,
446
453
  },
454
+ {
455
+ kind: "copyFile",
456
+ from: "src/name-schema.ts",
457
+ to: `${packagePath}/src/name-schema.ts`,
458
+ },
447
459
  ];
448
460
  }
449
461
  function packageAdditionPlan(packageName, packagePath, nodeVersion) {
@@ -451,7 +463,8 @@ function packageAdditionPlan(packageName, packagePath, nodeVersion) {
451
463
  return {
452
464
  packagePath,
453
465
  workspacePackageGlob: `${workspaceCollection}/*`,
454
- rootTsconfigReferences: [`./${packagePath}/tsconfig.json`],
466
+ packageRole: "shared-library",
467
+ packageSourcePreset: "ts-lib",
455
468
  sourceRoot: templateSourceRoot(),
456
469
  sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
457
470
  operations: packageAdditionOperations(packagePath, packageName, nodeVersion),
@@ -6,6 +6,8 @@ import { collectGeneratedManifestCatalogDependencies, renderGeneratedPnpmWorkspa
6
6
  import { browserTestToolLayer, checkedDockerfileFirstNodePnpmDevcontainer, nodePnpmToolLayer, } from "../../src/devcontainer.js";
7
7
  import { editorCustomizationForCapabilities } from "../../src/editor-customization.js";
8
8
  import { renderFixCommand, renderRootCheckCommand, } from "../../src/module-graph.js";
9
+ import { PackageAdditionSupport } from "../../src/package-addition-support.js";
10
+ import { packageTurboTasks } from "../../src/package-linking.js";
9
11
  import { renderNewProject } from "../../src/renderer.js";
10
12
  const generatedBy = {
11
13
  packageName: "@ykdz/template",
@@ -19,6 +21,7 @@ export const vueAppPresetMetadata = {
19
21
  generation: "supported",
20
22
  supportedPackageManagers: ["pnpm"],
21
23
  supportedProjectKinds: ["multi-package"],
24
+ packageAdditionSupport: PackageAdditionSupport.Supported,
22
25
  features: [
23
26
  "pnpm-catalog",
24
27
  "oxc-format-lint",
@@ -69,6 +72,10 @@ function planVueAppRootChecks() {
69
72
  { kind: "oxc-format-check", owner: rootBoundary },
70
73
  { kind: "oxc-lint", owner: rootBoundary },
71
74
  { kind: "typescript-typecheck", owner: rootBoundary },
75
+ { kind: "turbo-package-typecheck", owner: workspacePackageBoundary },
76
+ { kind: "turbo-package-build", owner: workspacePackageBoundary },
77
+ { kind: "turbo-package-test", owner: workspacePackageBoundary },
78
+ { kind: "turbo-package-e2e-test", owner: workspacePackageBoundary },
72
79
  { kind: "turbo-package-check", owner: workspacePackageBoundary },
73
80
  ],
74
81
  environmentNeeds: [
@@ -173,6 +180,12 @@ function webPackageJson(context) {
173
180
  version: "0.0.0",
174
181
  private: true,
175
182
  type: "module",
183
+ imports: {
184
+ "#/*": {
185
+ default: "./src/*.ts",
186
+ types: "./src/*.ts",
187
+ },
188
+ },
176
189
  scripts: projectVueAppPackageScripts(),
177
190
  dependencies: {
178
191
  "@vueuse/core": "catalog:",
@@ -228,6 +241,7 @@ function operationsForVueApp(context, packageScripts, checkPlan) {
228
241
  });
229
242
  const rootManifest = rootPackageJson(context, packageScripts);
230
243
  const webManifest = webPackageJson(context);
244
+ const turboTasks = packageTurboTasks({ dependencyBuildsRequired: false });
231
245
  return [
232
246
  {
233
247
  kind: "writeJson",
@@ -253,13 +267,11 @@ function operationsForVueApp(context, packageScripts, checkPlan) {
253
267
  to: "turbo.json",
254
268
  value: {
255
269
  tasks: {
256
- build: {
257
- dependsOn: ["^build"],
258
- outputs: ["dist/**"],
259
- },
260
- check: {
261
- dependsOn: ["^build"],
262
- },
270
+ build: turboTasks.build,
271
+ check: turboTasks.check,
272
+ typecheck: turboTasks.typecheck,
273
+ test: turboTasks.test,
274
+ "test:e2e": turboTasks["test:e2e"],
263
275
  dev: {
264
276
  cache: false,
265
277
  persistent: true,
@@ -324,9 +336,6 @@ function operationsForVueApp(context, packageScripts, checkPlan) {
324
336
  module: "ESNext",
325
337
  moduleResolution: "Bundler",
326
338
  noEmitOnError: true,
327
- paths: {
328
- "@/*": ["./src/*"],
329
- },
330
339
  skipLibCheck: false,
331
340
  strict: true,
332
341
  target: "ES2022",
@@ -538,6 +547,12 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
538
547
  version: "0.0.0",
539
548
  private: true,
540
549
  type: "module",
550
+ imports: {
551
+ "#/*": {
552
+ default: "./src/*.ts",
553
+ types: "./src/*.ts",
554
+ },
555
+ },
541
556
  scripts: projectVueAppPackageScripts(),
542
557
  dependencies: {
543
558
  "@vueuse/core": "catalog:",
@@ -586,9 +601,6 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
586
601
  module: "ESNext",
587
602
  moduleResolution: "Bundler",
588
603
  noEmitOnError: true,
589
- paths: {
590
- "@/*": ["./src/*"],
591
- },
592
604
  skipLibCheck: false,
593
605
  strict: true,
594
606
  target: "ES2022",
@@ -677,11 +689,8 @@ async function packageAdditionPlan({ root, blueprint, packageName, packagePath,
677
689
  return {
678
690
  packagePath,
679
691
  workspacePackageGlob: `${workspaceCollection}/*`,
680
- rootTsconfigReferences: [
681
- `./${packagePath}/tsconfig.app.json`,
682
- `./${packagePath}/tsconfig.test.json`,
683
- `./${packagePath}/tsconfig.node.json`,
684
- ],
692
+ packageRole: "runtime-service",
693
+ packageSourcePreset: "vue-app",
685
694
  sourceRoot: templateSourceRoot(),
686
695
  sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
687
696
  operations: packageAdditionOperations(packagePath, packageName, nodeVersion),