@ykdz/template 0.0.12 → 0.0.14

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 (53) hide show
  1. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +7 -34
  2. package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +2 -0
  3. package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +5 -3
  4. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +5 -32
  5. package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.d.ts +5 -0
  6. package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +57 -0
  7. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +8 -36
  8. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +27 -74
  9. package/node_modules/@ykdz/template-builtin-source/templates/hono-api/turbo.json +8 -0
  10. package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +192 -4
  11. package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/turbo.json +3 -0
  12. package/node_modules/@ykdz/template-builtin-source/templates/ts-lib/turbo.json +3 -0
  13. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/+server.ts +12 -0
  14. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.env.example +1 -0
  15. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/dependabot.yml +23 -0
  16. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/workflows/check.yml +20 -0
  17. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/assets/logo.svg +1 -0
  18. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/components/CounterButton.vue +21 -0
  19. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/components/PageShell.vue +17 -0
  20. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/database/db.ts +14 -0
  21. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/database/queries/todos.ts +32 -0
  22. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/database/schema.ts +14 -0
  23. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/drizzle.config.ts +10 -0
  24. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/env.d.ts +6 -0
  25. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/global.d.ts +9 -0
  26. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+Head.vue +8 -0
  27. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+Layout.vue +9 -0
  28. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+config.ts +10 -0
  29. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/index/+Page.telefunc.ts +13 -0
  30. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/index/+Page.vue +89 -0
  31. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/tailwind.css +7 -0
  32. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/playwright.config.ts +22 -0
  33. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/server/api.ts +5 -0
  34. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/server/app.ts +25 -0
  35. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/test/e2e/app.spec.ts +10 -0
  36. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/test/todos.test.ts +20 -0
  37. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/vite.config.ts +12 -0
  38. package/node_modules/@ykdz/template-builtin-source/templates/vike-app/vitest.config.ts +8 -0
  39. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/turbo.json +11 -0
  40. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/api/turbo.json +8 -0
  41. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/playwright.config.ts +1 -1
  42. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/api.ts +1 -4
  43. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/turbo.json +11 -0
  44. package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +4 -0
  45. package/node_modules/@ykdz/template-core/dist/module-graph.js +64 -4
  46. package/node_modules/@ykdz/template-core/dist/package-addition.js +23 -34
  47. package/node_modules/@ykdz/template-core/dist/package-linking.js +14 -8
  48. package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +6 -0
  49. package/node_modules/@ykdz/template-core/dist/projection-capabilities.d.ts +1 -1
  50. package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +355 -104
  51. package/node_modules/@ykdz/template-shared/dist/index.d.ts +9 -9
  52. package/node_modules/@ykdz/template-shared/dist/index.js +29 -11
  53. package/package.json +3 -3
@@ -5,8 +5,8 @@ import { normalizePresetProjectionDeclaration, projectionCapabilityIssues, valid
5
5
  import { collectGeneratedManifestCatalogDependencies, collectGeneratedManifestCatalogReferences, renderGeneratedPnpmWorkspaceYaml, } from "./dependency-catalog.js";
6
6
  import { browserTestToolLayer, checkedDockerfileFirstNodePnpmDevcontainer, dockerfileFirstRustPnpmDevcontainer, nodePnpmToolLayer, rustToolLayer, } from "./devcontainer.js";
7
7
  import { editorCustomizationForCapabilities, loadEditorCustomizationDeclarations, } from "./editor-customization.js";
8
- import { playwrightBrowserAssetsEnvironmentNeed, renderFixCommand, renderRootCheckCommand, } from "./module-graph.js";
9
- import { packageManifestExposureFields, planPackageLinks, } from "./package-linking.js";
8
+ import { playwrightBrowserAssetsEnvironmentNeed, renderCheckLeafCommand, renderFixCommand, renderFixLeafCommand, renderRootCheckCommand, } from "./module-graph.js";
9
+ import { packageManifestExposureFields, packageTurboTasks, planPackageLinks, } from "./package-linking.js";
10
10
  export { normalizePresetProjectionDeclaration, projectionCapabilityIssues, validateProjectionCapabilities, };
11
11
  const strictTypescriptRootBoundary = {
12
12
  kind: "workspace-orchestration",
@@ -78,7 +78,11 @@ const capabilityInterpreters = {
78
78
  state.nodeWorkspace = capability;
79
79
  state.sourceRoot = templateSourceRootForPreset(state, sourceRootPreset(capability));
80
80
  state.operationFactories.push(workspaceNodePackagesOperations);
81
- if (capability.packages.length > 1) {
81
+ if (isRootNodeWorkspace(capability)) {
82
+ state.rootScriptFragments.dev = "vike dev";
83
+ state.rootCheckComponents.push({ kind: "build", owner: strictTypescriptRootBoundary }, { kind: "unit-test", owner: strictTypescriptRootBoundary }, { kind: "e2e-test", owner: strictTypescriptRootBoundary });
84
+ }
85
+ else if (capability.packages.length > 1) {
82
86
  state.rootScriptFragments.dev = "turbo run dev --parallel";
83
87
  }
84
88
  const vuePackage = findVuePackage(capability);
@@ -129,11 +133,13 @@ const capabilityInterpreters = {
129
133
  kind: "typescript-typecheck",
130
134
  owner: strictTypescriptRootBoundary,
131
135
  });
132
- const workspaceBoundary = workspaceBoundaryForState(state);
133
- state.rootCheckComponents.push({
134
- kind: "turbo-package-check",
135
- owner: workspaceBoundary,
136
- });
136
+ if (!isRootNodeWorkspace(state.nodeWorkspace)) {
137
+ const workspaceBoundary = workspaceBoundaryForState(state);
138
+ state.rootCheckComponents.push({
139
+ kind: "turbo-package-check",
140
+ owner: workspaceBoundary,
141
+ });
142
+ }
137
143
  state.packageCheckComponents.push({
138
144
  kind: "typescript-typecheck",
139
145
  owner: workspacePackageBoundary,
@@ -167,10 +173,14 @@ const capabilityInterpreters = {
167
173
  }, {
168
174
  kind: "oxc-lint-fix",
169
175
  owner: strictTypescriptRootBoundary,
170
- }, {
171
- kind: "turbo-package-fix",
172
- owner: workspaceBoundaryForState(state),
173
- });
176
+ }, ...(!isRootNodeWorkspace(state.nodeWorkspace)
177
+ ? [
178
+ {
179
+ kind: "turbo-package-fix",
180
+ owner: workspaceBoundaryForState(state),
181
+ },
182
+ ]
183
+ : []));
174
184
  state.packageFixComponents.push({ kind: "oxc-format-write", owner: workspacePackageBoundary }, { kind: "oxc-lint-fix", owner: workspacePackageBoundary });
175
185
  state.rootScriptFragments["format:check"] =
176
186
  "oxfmt --check oxlint.config.ts oxfmt.config.ts";
@@ -458,9 +468,11 @@ function blueprintPackagesForCapabilities(capabilities, packageScope, projectNam
458
468
  }
459
469
  if (capability.kind === "workspace-node-packages") {
460
470
  return capability.packages.map((nodePackage) => {
461
- const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
471
+ const leaf = nodePackage.path === "."
472
+ ? projectName
473
+ : (nodePackage.path.split("/").at(-1) ?? nodePackage.path);
462
474
  return {
463
- name: `@${packageScope}/${leaf}`,
475
+ name: nodePackage.path === "." ? projectName : `@${packageScope}/${leaf}`,
464
476
  path: nodePackage.path,
465
477
  };
466
478
  });
@@ -539,6 +551,8 @@ function packageAdditionOperationsForCapability(options) {
539
551
  return libraryPackageAdditionOperations(options);
540
552
  case "hono-api":
541
553
  return honoApiPackageAdditionOperations(options);
554
+ case "vike-app":
555
+ throw new Error("vike-app cannot be used for Package Addition");
542
556
  case "vue-app":
543
557
  return vueAppPackageAdditionOperations(options);
544
558
  }
@@ -776,11 +790,16 @@ function workspaceGlobBoundary(workspacePackageGlob) {
776
790
  path: workspacePackageGlob,
777
791
  };
778
792
  }
793
+ function isRootNodeWorkspace(workspace) {
794
+ return (workspace?.workspacePackageGlob === "." &&
795
+ workspace.packages.length === 1 &&
796
+ workspace.packages[0]?.path === ".");
797
+ }
779
798
  function hasVuePackage(capability) {
780
799
  return findVuePackage(capability) !== undefined;
781
800
  }
782
801
  function findVuePackage(capability) {
783
- return capability.packages.find((nodePackage) => nodePackage.kind === "vue-app");
802
+ return capability.packages.find((nodePackage) => nodePackage.kind === "vue-app" || nodePackage.kind === "vike-app");
784
803
  }
785
804
  function sourceRootPreset(capability) {
786
805
  if (capability.packages.length === 1) {
@@ -793,20 +812,110 @@ function sourceRootPreset(capability) {
793
812
  return "vue-hono-app";
794
813
  }
795
814
  function projectRootPackageScripts(checkPlan, fixPlan, fragments) {
815
+ const leafFragments = leafScriptFragments(fragments);
816
+ const directFragments = directScriptFragments(fragments);
796
817
  return {
797
818
  check: renderRootCheckCommand(checkPlan),
798
819
  fix: renderFixCommand(fixPlan),
799
- ...fragments,
820
+ ...rootTaskEntrypoints(checkPlan, fixPlan),
821
+ ...directFragments,
822
+ ...leafFragments,
823
+ "check:run": noopTaskCommand(),
824
+ "fix:run": noopTaskCommand(),
800
825
  };
801
826
  }
802
827
  function projectPackageScripts(checkPlan, fixPlan, fragments) {
828
+ void checkPlan;
829
+ void fixPlan;
803
830
  return {
804
- check: renderRootCheckCommand(checkPlan),
805
- fix: renderFixCommand(fixPlan),
806
- ...fragments,
831
+ ...directScriptFragments(fragments),
832
+ ...leafScriptFragments(fragments),
807
833
  };
808
834
  }
835
+ const leafEntrypointNames = new Set([
836
+ "format:check",
837
+ "format:write",
838
+ "lint",
839
+ "lint:fix",
840
+ "typecheck",
841
+ "build",
842
+ "test",
843
+ "test:e2e",
844
+ ]);
845
+ function leafScriptName(scriptName) {
846
+ return leafEntrypointNames.has(scriptName) ? `${scriptName}:run` : scriptName;
847
+ }
848
+ function leafScriptFragments(fragments) {
849
+ return Object.fromEntries(Object.entries(fragments)
850
+ .filter(([scriptName]) => leafEntrypointNames.has(scriptName))
851
+ .map(([scriptName, command]) => [leafScriptName(scriptName), command]));
852
+ }
853
+ function directScriptFragments(fragments) {
854
+ return Object.fromEntries(Object.entries(fragments).filter(([scriptName]) => !leafEntrypointNames.has(scriptName)));
855
+ }
856
+ function rootEntrypointScriptsFromRootPackageScripts(scripts) {
857
+ return Object.fromEntries(Object.entries(scripts).filter(([scriptName]) => !scriptName.endsWith(":run") ||
858
+ scriptName === "check:run" ||
859
+ scriptName === "fix:run"));
860
+ }
861
+ function rootTaskEntrypoints(checkPlan, fixPlan) {
862
+ const taskNames = new Set([
863
+ ...checkPlan.components.map((component) => renderCheckLeafCommand(component).startsWith("turbo run ")
864
+ ? undefined
865
+ : leafEntrypointFromRunTask(component.kind)),
866
+ ...fixPlan.components.map((component) => renderFixLeafCommand(component).startsWith("turbo run ")
867
+ ? undefined
868
+ : leafEntrypointFromRunTask(component.kind)),
869
+ ]);
870
+ const entries = [];
871
+ for (const taskName of taskNames) {
872
+ if (taskName === undefined) {
873
+ continue;
874
+ }
875
+ entries.push([taskName, `turbo run ${taskName}:run`]);
876
+ }
877
+ return Object.fromEntries(entries);
878
+ }
879
+ function leafEntrypointFromRunTask(kind) {
880
+ switch (kind) {
881
+ case "oxc-format-check":
882
+ case "rustfmt-check":
883
+ return "format:check";
884
+ case "oxc-format-write":
885
+ case "rustfmt-write":
886
+ return "format:write";
887
+ case "oxc-lint":
888
+ case "cargo-clippy":
889
+ return "lint";
890
+ case "oxc-lint-fix":
891
+ return "lint:fix";
892
+ case "typescript-typecheck":
893
+ return "typecheck";
894
+ case "build":
895
+ return "build";
896
+ case "unit-test":
897
+ case "cargo-test":
898
+ return "test";
899
+ case "e2e-test":
900
+ return "test:e2e";
901
+ case "turbo-check":
902
+ case "turbo-package-typecheck":
903
+ case "turbo-package-build":
904
+ case "turbo-package-test":
905
+ case "turbo-package-e2e-test":
906
+ case "turbo-package-check":
907
+ case "turbo-fix":
908
+ case "turbo-package-fix":
909
+ return undefined;
910
+ }
911
+ }
912
+ function noopTaskCommand() {
913
+ return 'node -e ""';
914
+ }
809
915
  function packageCollection(workspacePackageGlob) {
916
+ if (workspacePackageGlob === ".") {
917
+ return ".";
918
+ }
810
919
  return workspacePackageGlob.slice(0, -"/*".length);
811
920
  }
812
921
  function workspacePackagePath(context, capability) {
@@ -860,6 +969,9 @@ function nodePackageName(context, nodePackage) {
860
969
  if (packageDefinition !== undefined) {
861
970
  return packageDefinition.name;
862
971
  }
972
+ if (nodePackage.path === ".") {
973
+ return context.projectName.value;
974
+ }
863
975
  const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
864
976
  return `@${context.projectName.value}/${leaf}`;
865
977
  }
@@ -991,6 +1103,51 @@ function vuePackageJson(context, packageName, scripts, packageLinkDependencies =
991
1103
  },
992
1104
  };
993
1105
  }
1106
+ function vikePackageJson(context, packageName, scripts) {
1107
+ return {
1108
+ name: packageName,
1109
+ version: "0.0.0",
1110
+ private: true,
1111
+ type: "module",
1112
+ imports: {
1113
+ "#/*": {
1114
+ default: "./*.ts",
1115
+ types: "./*.ts",
1116
+ },
1117
+ },
1118
+ scripts,
1119
+ dependencies: {
1120
+ "@vikejs/hono": "catalog:",
1121
+ "drizzle-orm": "catalog:",
1122
+ hono: "catalog:",
1123
+ telefunc: "catalog:",
1124
+ vike: "catalog:",
1125
+ "vike-vue": "catalog:",
1126
+ vue: "catalog:",
1127
+ },
1128
+ devDependencies: {
1129
+ "@playwright/test": "catalog:",
1130
+ "@tailwindcss/vite": "catalog:",
1131
+ "@types/node": "catalog:",
1132
+ "@vitejs/plugin-vue": "catalog:",
1133
+ "@vue/tsconfig": "catalog:",
1134
+ "drizzle-kit": "catalog:",
1135
+ oxfmt: "catalog:",
1136
+ oxlint: "catalog:",
1137
+ "oxlint-tsgolint": "catalog:",
1138
+ tailwindcss: "catalog:",
1139
+ turbo: "catalog:",
1140
+ typescript: "catalog:",
1141
+ vite: "catalog:",
1142
+ vitest: "catalog:",
1143
+ "vue-tsc": "catalog:",
1144
+ },
1145
+ engines: {
1146
+ node: context.toolchain.nodeLtsMajor.value,
1147
+ },
1148
+ packageManager: context.toolchain.packageManagerPin.value,
1149
+ };
1150
+ }
994
1151
  function catalogDependencies(dependencies) {
995
1152
  return Object.fromEntries([...dependencies].toSorted().map((dependency) => [dependency, "catalog:"]));
996
1153
  }
@@ -1062,17 +1219,25 @@ function rustRootPackageJson(context, packageScripts, state) {
1062
1219
  packageManager: context.toolchain.packageManagerPin.value,
1063
1220
  };
1064
1221
  }
1065
- function rustWorkspacePackageJson(context, scripts) {
1222
+ function rustWorkspacePackageJson(context) {
1066
1223
  return {
1067
1224
  name: rustWorkspacePackageName(context),
1068
1225
  version: "0.0.0",
1069
1226
  private: true,
1070
- scripts,
1227
+ scripts: rustWorkspacePackageScripts(),
1071
1228
  engines: {
1072
1229
  node: context.toolchain.nodeLtsMajor.value,
1073
1230
  },
1074
1231
  };
1075
1232
  }
1233
+ function rustWorkspacePackageScripts() {
1234
+ return {
1235
+ "format:check:run": "cargo fmt --all -- --check",
1236
+ "format:write:run": "cargo fmt --all",
1237
+ "lint:run": "cargo clippy --workspace --all-targets -- -D warnings",
1238
+ "test:run": "cargo test --workspace",
1239
+ };
1240
+ }
1076
1241
  function workspaceLibraryPackageOperations({ context, state, packageScripts, packageScriptsByPath, }) {
1077
1242
  if (state.package === undefined) {
1078
1243
  throw new Error("workspace-library-package capability state is missing");
@@ -1108,14 +1273,7 @@ function workspaceLibraryPackageOperations({ context, state, packageScripts, pac
1108
1273
  to: "turbo.json",
1109
1274
  value: {
1110
1275
  tasks: {
1111
- build: packageLinkPlan.turboTasks.build,
1112
- check: packageLinkPlan.turboTasks.check,
1113
- typecheck: packageLinkPlan.turboTasks.typecheck,
1114
- test: packageLinkPlan.turboTasks.test,
1115
- "test:e2e": packageLinkPlan.turboTasks["test:e2e"],
1116
- fix: {
1117
- cache: false,
1118
- },
1276
+ ...packageLinkPlan.turboTasks,
1119
1277
  },
1120
1278
  },
1121
1279
  },
@@ -1154,18 +1312,14 @@ function workspaceLibraryPackageOperations({ context, state, packageScripts, pac
1154
1312
  },
1155
1313
  ];
1156
1314
  }
1157
- function rustBinaryWorkspaceOperations({ context, state, packageScripts, packageScriptsByPath, }) {
1315
+ function rustBinaryWorkspaceOperations({ context, state, packageScripts, }) {
1158
1316
  if (state.rustWorkspace === undefined) {
1159
1317
  throw new Error("rust-binary-workspace capability state is missing");
1160
1318
  }
1161
1319
  const capability = state.rustWorkspace;
1162
1320
  const packagePath = rustWorkspacePackagePath(context);
1163
- const workspacePackageScripts = packageScriptsByPath.get(capability.workspacePackageGlob);
1164
- if (workspacePackageScripts === undefined) {
1165
- throw new Error(`Missing package scripts for ${capability.workspacePackageGlob}`);
1166
- }
1167
1321
  const rootManifest = rustRootPackageJson(context, packageScripts, state);
1168
- const packageManifest = rustWorkspacePackageJson(context, workspacePackageScripts);
1322
+ const packageManifest = rustWorkspacePackageJson(context);
1169
1323
  const rustLayer = rustToolLayer();
1170
1324
  const dockerfileFragments = readDevelopmentContainerDockerfileFragments(state, ["rust"]);
1171
1325
  const editorCustomization = editorCustomizationForCapabilities(state.editorCustomizationCapabilities, editorCustomizationDeclarationsForState(state));
@@ -1201,12 +1355,7 @@ function rustBinaryWorkspaceOperations({ context, state, packageScripts, package
1201
1355
  kind: "writeJson",
1202
1356
  to: "turbo.json",
1203
1357
  value: {
1204
- tasks: {
1205
- check: {},
1206
- fix: {
1207
- cache: false,
1208
- },
1209
- },
1358
+ tasks: packageTurboTasks({ dependencyBuildsRequired: false }),
1210
1359
  },
1211
1360
  },
1212
1361
  {
@@ -1269,6 +1418,7 @@ function rustBinaryWorkspaceOperations({ context, state, packageScripts, package
1269
1418
  kind: "writeJson",
1270
1419
  to: ".devcontainer/devcontainer.json",
1271
1420
  value: developmentContainer.devcontainer,
1421
+ multilineArrays: ["customizations.vscode.extensions"],
1272
1422
  },
1273
1423
  {
1274
1424
  ...developmentContainer.dockerfileOperation,
@@ -1315,9 +1465,17 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
1315
1465
  ? undefined
1316
1466
  : packageManifestExposureFields(exposure));
1317
1467
  }
1468
+ if (nodePackage.kind === "vike-app") {
1469
+ return vikePackageJson(context, packageName, scripts);
1470
+ }
1318
1471
  return vuePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
1319
1472
  });
1320
- const rootManifest = rootPackageJson(context, packageScripts, state);
1473
+ const rootManifest = isRootNodeWorkspace(capability)
1474
+ ? rootNodePackageManifest(packageManifests[0], packageScripts)
1475
+ : rootPackageJson(context, packageScripts, state);
1476
+ if (rootManifest === undefined) {
1477
+ throw new Error("workspace-node-packages rendered no package manifests");
1478
+ }
1321
1479
  return [
1322
1480
  {
1323
1481
  kind: "writeJson",
@@ -1352,11 +1510,7 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
1352
1510
  to: "turbo.json",
1353
1511
  value: {
1354
1512
  tasks: {
1355
- build: packageLinkPlan.turboTasks.build,
1356
- check: packageLinkPlan.turboTasks.check,
1357
- typecheck: packageLinkPlan.turboTasks.typecheck,
1358
- test: packageLinkPlan.turboTasks.test,
1359
- "test:e2e": packageLinkPlan.turboTasks["test:e2e"],
1513
+ ...packageLinkPlan.turboTasks,
1360
1514
  ...(hasVuePackage(capability)
1361
1515
  ? {
1362
1516
  dev: {
@@ -1365,9 +1519,6 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
1365
1519
  },
1366
1520
  }
1367
1521
  : {}),
1368
- fix: {
1369
- cache: false,
1370
- },
1371
1522
  },
1372
1523
  },
1373
1524
  },
@@ -1377,16 +1528,20 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
1377
1528
  text: gitignoreForNodeWorkspace(capability),
1378
1529
  },
1379
1530
  ...capability.packages.flatMap((nodePackage, index) => [
1380
- {
1381
- kind: "writeJson",
1382
- to: `${nodePackage.path}/package.json`,
1383
- value: packageManifests[index],
1384
- },
1531
+ ...(nodePackage.path === "."
1532
+ ? []
1533
+ : [
1534
+ {
1535
+ kind: "writeJson",
1536
+ to: `${nodePackage.path}/package.json`,
1537
+ value: packageManifests[index],
1538
+ },
1539
+ ]),
1385
1540
  ...nodePackageTsconfigOperations(nodePackage, capability),
1386
1541
  ...nodePackage.sourceFiles.map((sourceFile) => ({
1387
1542
  kind: "copyFile",
1388
1543
  from: sourceFile,
1389
- to: `${nodePackage.path}/${sourcePathWithinNodePackage(sourceFile, capability)}`,
1544
+ to: nodePackageTargetPath(nodePackage, sourceFile, capability),
1390
1545
  })),
1391
1546
  ]),
1392
1547
  ...fullStackApiAnchorOperations(context, capability),
@@ -1402,6 +1557,33 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
1402
1557
  },
1403
1558
  ];
1404
1559
  }
1560
+ function rootNodePackageManifest(packageManifest, rootPackageScripts) {
1561
+ if (packageManifest === undefined) {
1562
+ return undefined;
1563
+ }
1564
+ const packageScripts = packageManifest.scripts;
1565
+ if (packageScripts === undefined ||
1566
+ typeof packageScripts !== "object" ||
1567
+ packageScripts === null ||
1568
+ Array.isArray(packageScripts)) {
1569
+ throw new Error("Root node package manifest rendered invalid scripts");
1570
+ }
1571
+ const checkedPackageScripts = {};
1572
+ for (const scriptName of Object.keys(packageScripts)) {
1573
+ const command = Reflect.get(packageScripts, scriptName);
1574
+ if (typeof command !== "string") {
1575
+ throw new Error("Root node package manifest rendered non-string scripts");
1576
+ }
1577
+ checkedPackageScripts[scriptName] = command;
1578
+ }
1579
+ return {
1580
+ ...packageManifest,
1581
+ scripts: {
1582
+ ...rootEntrypointScriptsFromRootPackageScripts(rootPackageScripts),
1583
+ ...checkedPackageScripts,
1584
+ },
1585
+ };
1586
+ }
1405
1587
  function nodePackageScripts(nodePackage, workspace) {
1406
1588
  const oxcScripts = {
1407
1589
  "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
@@ -1410,67 +1592,122 @@ function nodePackageScripts(nodePackage, workspace) {
1410
1592
  "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix",
1411
1593
  };
1412
1594
  if (nodePackage.kind === "hono-api") {
1413
- const checks = {
1414
- components: [
1415
- { kind: "oxc-format-check", owner: workspacePackageBoundary },
1416
- { kind: "oxc-lint", owner: workspacePackageBoundary },
1417
- { kind: "typescript-typecheck", owner: workspacePackageBoundary },
1418
- { kind: "build", owner: workspacePackageBoundary },
1419
- { kind: "unit-test", owner: workspacePackageBoundary },
1420
- ],
1421
- environmentNeeds: [],
1422
- };
1423
- const fixes = {
1424
- components: [
1425
- { kind: "oxc-format-write", owner: workspacePackageBoundary },
1426
- { kind: "oxc-lint-fix", owner: workspacePackageBoundary },
1427
- ],
1428
- };
1429
1595
  return {
1430
- build: "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
1431
- check: renderRootCheckCommand(checks),
1596
+ "build:run": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
1432
1597
  ...(workspace.packages.length > 1
1433
1598
  ? { dev: "tsx watch src/server.ts" }
1434
1599
  : {}),
1435
- fix: renderFixCommand(fixes),
1436
- ...oxcScripts,
1600
+ ...leafScriptFragments(oxcScripts),
1437
1601
  start: "node dist/server.js",
1438
- test: "vitest run",
1439
- typecheck: "tsc -p tsconfig.json --noEmit",
1602
+ "test:run": "vitest run",
1603
+ "typecheck:run": "tsc -p tsconfig.json --noEmit",
1604
+ };
1605
+ }
1606
+ if (nodePackage.kind === "vike-app") {
1607
+ return {
1608
+ "build:run": "vike build",
1609
+ dev: "vike dev",
1610
+ "drizzle:generate": "drizzle-kit generate",
1611
+ "drizzle:migrate": "drizzle-kit migrate",
1612
+ "drizzle:studio": "drizzle-kit studio",
1613
+ "format:check:run": "oxfmt --check --config oxfmt.config.ts .",
1614
+ "format:write:run": "oxfmt --write --config oxfmt.config.ts .",
1615
+ "lint:run": "oxlint --type-aware --config oxlint.config.ts .",
1616
+ "lint:fix:run": "oxlint --type-aware --config oxlint.config.ts . --fix",
1617
+ preview: "vike preview",
1618
+ start: "node ./dist/server/index.mjs",
1619
+ "test:run": "vitest run",
1620
+ "test:e2e:run": "playwright test --config playwright.config.ts",
1621
+ "typecheck:run": "vue-tsc --build --noEmit",
1440
1622
  };
1441
1623
  }
1442
- const checks = {
1443
- components: [
1444
- { kind: "oxc-format-check", owner: workspacePackageBoundary },
1445
- { kind: "oxc-lint", owner: workspacePackageBoundary },
1446
- { kind: "typescript-typecheck", owner: workspacePackageBoundary },
1447
- { kind: "build", owner: workspacePackageBoundary },
1448
- { kind: "unit-test", owner: workspacePackageBoundary },
1449
- { kind: "e2e-test", owner: workspacePackageBoundary },
1450
- ],
1451
- environmentNeeds: [],
1452
- };
1453
- const fixes = {
1454
- components: [
1455
- { kind: "oxc-format-write", owner: workspacePackageBoundary },
1456
- { kind: "oxc-lint-fix", owner: workspacePackageBoundary },
1457
- ],
1458
- };
1459
1624
  return {
1460
- build: "vite build",
1461
- check: renderRootCheckCommand(checks),
1625
+ "build:run": "vite build",
1462
1626
  dev: "vite",
1463
- fix: renderFixCommand(fixes),
1464
- ...oxcScripts,
1627
+ ...leafScriptFragments(oxcScripts),
1465
1628
  preview: "vite preview",
1466
- test: "vitest run",
1467
- "test:e2e": "pnpm run build && node --experimental-strip-types scripts/run-playwright.ts",
1468
- typecheck: workspace.packages.length > 1
1629
+ "test:run": "vitest run",
1630
+ "test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
1631
+ "typecheck:run": workspace.packages.length > 1
1469
1632
  ? "vue-tsc --build"
1470
1633
  : "vue-tsc --build --noEmit",
1471
1634
  };
1472
1635
  }
1473
1636
  function nodePackageTsconfigOperations(nodePackage, workspace) {
1637
+ if (nodePackage.kind === "vike-app") {
1638
+ return [
1639
+ {
1640
+ kind: "writeJson",
1641
+ to: "tsconfig.app.json",
1642
+ value: {
1643
+ extends: "@vue/tsconfig/tsconfig.dom.json",
1644
+ compilerOptions: {
1645
+ ...strictTypeScriptCompilerOptions({
1646
+ composite: true,
1647
+ module: "ESNext",
1648
+ moduleResolution: "Bundler",
1649
+ paths: { "#/*": ["./*"] },
1650
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
1651
+ types: ["node"],
1652
+ }),
1653
+ skipLibCheck: true,
1654
+ },
1655
+ include: [
1656
+ "+server.ts",
1657
+ "assets/**/*.svg",
1658
+ "components/**/*.vue",
1659
+ "database/**/*.ts",
1660
+ "env.d.ts",
1661
+ "global.d.ts",
1662
+ "pages/**/*.ts",
1663
+ "pages/**/*.vue",
1664
+ "server/**/*.ts",
1665
+ ],
1666
+ },
1667
+ },
1668
+ {
1669
+ kind: "writeJson",
1670
+ to: "tsconfig.test.json",
1671
+ value: {
1672
+ extends: "./tsconfig.app.json",
1673
+ compilerOptions: {
1674
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
1675
+ paths: { "#/*": ["./*"] },
1676
+ skipLibCheck: true,
1677
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
1678
+ types: ["node", "vitest/globals"],
1679
+ },
1680
+ include: ["database/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
1681
+ },
1682
+ },
1683
+ {
1684
+ kind: "writeJson",
1685
+ to: "tsconfig.node.json",
1686
+ multilineArrays: ["include"],
1687
+ value: {
1688
+ compilerOptions: {
1689
+ ...strictTypeScriptCompilerOptions({
1690
+ composite: true,
1691
+ module: "ESNext",
1692
+ moduleResolution: "Bundler",
1693
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
1694
+ paths: { "#/*": ["./*"] },
1695
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
1696
+ types: ["node"],
1697
+ }),
1698
+ skipLibCheck: true,
1699
+ },
1700
+ include: [
1701
+ "drizzle.config.ts",
1702
+ "playwright.config.ts",
1703
+ "scripts/**/*.ts",
1704
+ "vite.config.ts",
1705
+ "vitest.config.ts",
1706
+ ],
1707
+ },
1708
+ },
1709
+ ];
1710
+ }
1474
1711
  if (nodePackage.kind === "hono-api") {
1475
1712
  return [
1476
1713
  {
@@ -1619,6 +1856,13 @@ function sourcePathWithinNodePackage(sourceFile, workspace) {
1619
1856
  }
1620
1857
  return sourceFile.replace(/^(api|web)\//, "");
1621
1858
  }
1859
+ function nodePackageTargetPath(nodePackage, sourceFile, workspace) {
1860
+ const packageRelativePath = sourcePathWithinNodePackage(sourceFile, workspace);
1861
+ if (nodePackage.path === ".") {
1862
+ return packageRelativePath;
1863
+ }
1864
+ return `${nodePackage.path}/${packageRelativePath}`;
1865
+ }
1622
1866
  function gitignoreForNodeWorkspace(workspace) {
1623
1867
  return [
1624
1868
  "node_modules",
@@ -1642,8 +1886,7 @@ function fullStackApiAnchorOperations(context, workspace) {
1642
1886
  path: "apps/web/src/api.ts",
1643
1887
  language: "typescript",
1644
1888
  replacements: {
1645
- "api-type-import-start": `import type { AppType } from "@${packageScope}/api";\nimport { hc } from "hono/client";\n/*`,
1646
- "api-type-import-end": "*/",
1889
+ "api-type-imports": `import type { AppType } from "@${packageScope}/api";\nimport { hc } from "hono/client";`,
1647
1890
  },
1648
1891
  },
1649
1892
  ];
@@ -1700,6 +1943,13 @@ function rootTsconfigReferences(workspace) {
1700
1943
  ? []
1701
1944
  : [{ path: `./${nodePackage.path}/tsconfig.json` }];
1702
1945
  }
1946
+ if (nodePackage.kind === "vike-app") {
1947
+ return [
1948
+ { path: "./tsconfig.app.json" },
1949
+ { path: "./tsconfig.test.json" },
1950
+ { path: "./tsconfig.node.json" },
1951
+ ];
1952
+ }
1703
1953
  return [
1704
1954
  { path: `./${nodePackage.path}/tsconfig.app.json` },
1705
1955
  { path: `./${nodePackage.path}/tsconfig.test.json` },
@@ -1761,6 +2011,7 @@ function nodePnpmDevcontainerOperations({ context, state, }) {
1761
2011
  kind: "writeJson",
1762
2012
  to: ".devcontainer/devcontainer.json",
1763
2013
  value: developmentContainer.devcontainer,
2014
+ multilineArrays: ["customizations.vscode.extensions"],
1764
2015
  },
1765
2016
  {
1766
2017
  ...developmentContainer.dockerfileOperation,