@ykdz/template 0.0.17 → 0.0.19
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.
- package/dist/cli.js +61 -24
- package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +0 -2
- package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +4 -4
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +13 -2
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +6 -74
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +23 -22
- package/node_modules/@ykdz/template-builtin-source/package.json +41 -8
- package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +69 -282
- package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/src/main.rs +5 -2
- package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/turbo.json +2 -1
- package/node_modules/@ykdz/template-builtin-source/templates/ts-lib/turbo.json +2 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{drizzle.config.ts → db/drizzle.config.ts} +2 -2
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{database → db/src}/db.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/db/src/index.ts +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{database → db/src}/queries/todos.ts +4 -8
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{test → db/test}/todos.test.ts +2 -2
- package/node_modules/@ykdz/template-builtin-source/templates/{hono-api → vike-app/db}/turbo.json +2 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/index/+Page.telefunc.ts +3 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/index/+Page.vue +1 -2
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/playwright.config.ts +43 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/scripts/run-playwright.ts +62 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{server → web/server}/app.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{test → web/test}/e2e/app.spec.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/turbo.json +12 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{types → web/types}/global.d.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{vite.config.ts → web/vite.config.ts} +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/playwright.config.ts +16 -3
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/scripts/run-playwright.ts +38 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/turbo.json +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/api/turbo.json +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/playwright.config.ts +7 -9
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/scripts/run-playwright.ts +79 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/App.vue +4 -5
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/api.ts +9 -3
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/test/e2e/app.spec.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/turbo.json +1 -0
- package/node_modules/@ykdz/template-core/dist/Cargo.lock +16 -0
- package/node_modules/@ykdz/template-core/dist/Cargo.toml +12 -0
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +8 -0
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +63 -2
- package/node_modules/@ykdz/template-core/dist/generated-scenarios.d.ts +1 -1
- package/node_modules/@ykdz/template-core/dist/generated-scenarios.js +104 -26
- package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +1 -0
- package/node_modules/@ykdz/template-core/dist/module-graph.js +19 -12
- package/node_modules/@ykdz/template-core/dist/next-step-instructions.d.ts +8 -0
- package/node_modules/@ykdz/template-core/dist/next-step-instructions.js +65 -0
- package/node_modules/@ykdz/template-core/dist/package-addition.js +6 -12
- package/node_modules/@ykdz/template-core/dist/package-linking.d.ts +24 -0
- package/node_modules/@ykdz/template-core/dist/package-linking.js +35 -0
- package/node_modules/@ykdz/template-core/dist/preset-source.d.ts +2 -2
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +240 -153
- package/node_modules/@ykdz/template-core/dist/template-boundary-check.js +46 -10
- package/node_modules/@ykdz/template-core/package.json +9 -5
- package/node_modules/@ykdz/template-shared/dist/index.d.ts +3 -152
- package/node_modules/@ykdz/template-shared/dist/index.js +49 -305
- package/node_modules/@ykdz/template-shared/package.json +8 -4
- package/package.json +5 -5
- package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.d.ts +0 -6
- package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +0 -213
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/.github/dependabot.yml +0 -23
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/.github/workflows/check.yml +0 -19
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/src/app.ts +0 -5
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/src/server.ts +0 -15
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/test/app.test.ts +0 -10
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/vitest.config.ts +0 -15
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/playwright.config.ts +0 -23
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/playwright.package-addition.config.ts +0 -22
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{database → db/src}/schema.ts +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{+server.ts → web/+server.ts} +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{.env.example → web/.env.example} +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{assets → web/assets}/logo.svg +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{components → web/components}/CounterButton.vue +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{components → web/components}/PageShell.vue +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/+Head.vue +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/+Layout.vue +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/+config.ts +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/tailwind.css +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{server → web/server}/api.ts +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{types → web/types}/env.d.ts +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{vitest.config.ts → web/vitest.config.ts} +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { normalizePresetProjectionDeclaration, projectionCapabilityIssues, validatePresetProjectionDeclaration as validateProjectionCapabilities, } from "@ykdz/template-shared";
|
|
5
|
-
import { collectGeneratedManifestCatalogDependencies, collectGeneratedManifestCatalogReferences, renderGeneratedPnpmWorkspaceYaml, } from "./dependency-catalog.js";
|
|
4
|
+
import { collectGeneratedManifestCatalogDependencies, collectGeneratedManifestCatalogReferences, renderCargoLockForPackage, renderGeneratedPnpmWorkspaceYaml, renderCargoDependencyTomlEntries, } from "./dependency-catalog.js";
|
|
6
5
|
import { browserTestToolLayer, checkedDockerfileFirstNodePnpmDevcontainer, dockerfileFirstRustPnpmDevcontainer, nodePnpmToolLayer, rustToolLayer, } from "./devcontainer.js";
|
|
7
6
|
import { editorCustomizationForCapabilities, loadEditorCustomizationDeclarations, } from "./editor-customization.js";
|
|
8
|
-
import { playwrightBrowserAssetsEnvironmentNeed, renderCheckLeafCommand, renderFixCommand, renderFixLeafCommand, renderRootCheckCommand, } from "./module-graph.js";
|
|
9
|
-
import { packageManifestExposureFields,
|
|
7
|
+
import { playwrightBrowserAssetsEnvironmentNeed, renderCheckLeafCommand, renderFixCommand, renderFixLeafCommand, renderRootCheckCommand, renderTurboRunCommand, } from "./module-graph.js";
|
|
8
|
+
import { packageManifestExposureFields, packageTurboConfig, planPackageLinks, } from "./package-linking.js";
|
|
10
9
|
export { normalizePresetProjectionDeclaration, projectionCapabilityIssues, validateProjectionCapabilities, };
|
|
11
10
|
const strictTypescriptRootBoundary = {
|
|
12
11
|
kind: "workspace-orchestration",
|
|
@@ -139,8 +138,9 @@ const capabilityInterpreters = {
|
|
|
139
138
|
owner: workspacePackageBoundary,
|
|
140
139
|
});
|
|
141
140
|
state.rootScriptFragments.typecheck =
|
|
142
|
-
"tsc -p tsconfig.config.json --noEmit";
|
|
143
|
-
state.packageScriptFragments.typecheck =
|
|
141
|
+
"tsc -p tsconfig.config.json --noEmit --pretty false";
|
|
142
|
+
state.packageScriptFragments.typecheck =
|
|
143
|
+
"tsc -p tsconfig.json --noEmit --pretty false";
|
|
144
144
|
state.rootDevDependencies.add("typescript");
|
|
145
145
|
state.packageDevDependencies.add("@types/node");
|
|
146
146
|
state.packageDevDependencies.add("typescript");
|
|
@@ -173,21 +173,21 @@ const capabilityInterpreters = {
|
|
|
173
173
|
});
|
|
174
174
|
state.packageFixComponents.push({ kind: "oxc-format-write", owner: workspacePackageBoundary }, { kind: "oxc-lint-fix", owner: workspacePackageBoundary });
|
|
175
175
|
state.rootScriptFragments["format:check"] =
|
|
176
|
-
"oxfmt --
|
|
176
|
+
"oxfmt --list-different oxlint.config.ts oxfmt.config.ts";
|
|
177
177
|
state.rootScriptFragments["format:write"] =
|
|
178
178
|
"oxfmt --write oxlint.config.ts oxfmt.config.ts";
|
|
179
179
|
state.rootScriptFragments.lint =
|
|
180
|
-
"oxlint oxlint.config.ts oxfmt.config.ts";
|
|
180
|
+
"oxlint --quiet --format=unix oxlint.config.ts oxfmt.config.ts";
|
|
181
181
|
state.rootScriptFragments["lint:fix"] =
|
|
182
|
-
"oxlint oxlint.config.ts oxfmt.config.ts --fix";
|
|
182
|
+
"oxlint --format=unix oxlint.config.ts oxfmt.config.ts --fix";
|
|
183
183
|
state.packageScriptFragments["format:check"] =
|
|
184
|
-
"oxfmt --
|
|
184
|
+
"oxfmt --list-different --config ../../oxfmt.config.ts .";
|
|
185
185
|
state.packageScriptFragments["format:write"] =
|
|
186
186
|
"oxfmt --write --config ../../oxfmt.config.ts .";
|
|
187
187
|
state.packageScriptFragments.lint =
|
|
188
|
-
"oxlint --config ../../oxlint.config.ts .";
|
|
188
|
+
"oxlint --quiet --format=unix --config ../../oxlint.config.ts .";
|
|
189
189
|
state.packageScriptFragments["lint:fix"] =
|
|
190
|
-
"oxlint --config ../../oxlint.config.ts . --fix";
|
|
190
|
+
"oxlint --format=unix --config ../../oxlint.config.ts . --fix";
|
|
191
191
|
state.rootDevDependencies.add("oxfmt");
|
|
192
192
|
state.rootDevDependencies.add("oxlint");
|
|
193
193
|
state.rootDevDependencies.add("oxlint-tsgolint");
|
|
@@ -361,26 +361,12 @@ export async function planPresetSourcePackageAddition(options) {
|
|
|
361
361
|
packageSourcePreset: additionCapability.packageSourcePreset,
|
|
362
362
|
sourceRoot: templateSourceRootForPreset(state, additionCapability.sourcePreset),
|
|
363
363
|
sourceRoots: state.sourceRoots,
|
|
364
|
-
operations:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}),
|
|
371
|
-
...(additionCapability.packageSourcePreset === "vue-app"
|
|
372
|
-
? [
|
|
373
|
-
{
|
|
374
|
-
kind: "writeTextTemplate",
|
|
375
|
-
from: "playwright.package-addition.config.ts",
|
|
376
|
-
to: `${options.addition.packagePath}/playwright.config.ts`,
|
|
377
|
-
replacements: {
|
|
378
|
-
VUE_PREVIEW_PORT: String(await nextVuePreviewPort(options.addition.root, options.addition.blueprint)),
|
|
379
|
-
},
|
|
380
|
-
},
|
|
381
|
-
]
|
|
382
|
-
: []),
|
|
383
|
-
],
|
|
364
|
+
operations: packageAdditionOperationsForCapability({
|
|
365
|
+
capability: additionCapability,
|
|
366
|
+
packageName: options.addition.packageName,
|
|
367
|
+
packagePath: options.addition.packagePath,
|
|
368
|
+
nodeVersion: options.addition.nodeVersion,
|
|
369
|
+
}),
|
|
384
370
|
};
|
|
385
371
|
}
|
|
386
372
|
export function defaultPackagePathForPresetSourcePackageAddition(preset, packageLeafName, sourceRoots) {
|
|
@@ -679,49 +665,13 @@ function vueAppPackageAdditionOperations(options) {
|
|
|
679
665
|
}), options.packageName, options.capability.packageScripts),
|
|
680
666
|
},
|
|
681
667
|
...vueAppTsconfigOperations(options.packagePath),
|
|
682
|
-
...options.capability.sourceFiles
|
|
683
|
-
.filter((sourceFile) => path.basename(sourceFile) !== "playwright.config.ts")
|
|
684
|
-
.map((sourceFile) => ({
|
|
668
|
+
...options.capability.sourceFiles.map((sourceFile) => ({
|
|
685
669
|
kind: "copyFile",
|
|
686
670
|
from: sourceFile,
|
|
687
671
|
to: `${options.packagePath}/${sourceFile}`,
|
|
688
672
|
})),
|
|
689
673
|
];
|
|
690
674
|
}
|
|
691
|
-
function localPortsFromText(text) {
|
|
692
|
-
return [
|
|
693
|
-
...text.matchAll(/--port\s+(\d+)/g),
|
|
694
|
-
...text.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1):(\d+)/g),
|
|
695
|
-
].map((match) => Number(match[1]));
|
|
696
|
-
}
|
|
697
|
-
async function usedPlaywrightPorts(root, blueprint) {
|
|
698
|
-
const ports = new Set();
|
|
699
|
-
for (const projectPackage of blueprint.packages ?? []) {
|
|
700
|
-
try {
|
|
701
|
-
const configText = await readFile(path.join(root, projectPackage.path, "playwright.config.ts"), "utf8");
|
|
702
|
-
for (const port of localPortsFromText(configText)) {
|
|
703
|
-
ports.add(port);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
catch (error) {
|
|
707
|
-
if (!isNodeError(error) || error.code !== "ENOENT") {
|
|
708
|
-
throw error;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
return ports;
|
|
713
|
-
}
|
|
714
|
-
async function nextVuePreviewPort(root, blueprint) {
|
|
715
|
-
const usedPorts = await usedPlaywrightPorts(root, blueprint);
|
|
716
|
-
let port = 4173;
|
|
717
|
-
while (usedPorts.has(port)) {
|
|
718
|
-
port += 1;
|
|
719
|
-
}
|
|
720
|
-
return port;
|
|
721
|
-
}
|
|
722
|
-
function isNodeError(error) {
|
|
723
|
-
return error instanceof Error && "code" in error;
|
|
724
|
-
}
|
|
725
675
|
function completePlanCapabilityFlags(flags) {
|
|
726
676
|
const missing = requiredPlanCapabilityProviders.filter((requirement) => flags[requirement.flag] !== true);
|
|
727
677
|
if (missing.length > 0) {
|
|
@@ -781,6 +731,9 @@ function workspaceGlobBoundary(workspacePackageGlob) {
|
|
|
781
731
|
function hasVuePackage(capability) {
|
|
782
732
|
return findVuePackage(capability) !== undefined;
|
|
783
733
|
}
|
|
734
|
+
function hasVikePackage(capability) {
|
|
735
|
+
return capability.packages.some((nodePackage) => nodePackage.kind === "vike-app");
|
|
736
|
+
}
|
|
784
737
|
function findVuePackage(capability) {
|
|
785
738
|
return capability.packages.find((nodePackage) => nodePackage.kind === "vue-app" || nodePackage.kind === "vike-app");
|
|
786
739
|
}
|
|
@@ -798,11 +751,12 @@ function projectRootPackageScripts(checkPlan, fixPlan, fragments) {
|
|
|
798
751
|
const leafFragments = leafScriptFragments(fragments);
|
|
799
752
|
const directFragments = directScriptFragments(fragments);
|
|
800
753
|
return {
|
|
801
|
-
check: renderRootCheckCommand(checkPlan)
|
|
754
|
+
check: `pnpm run check:boundaries && ${renderRootCheckCommand(checkPlan)}`,
|
|
802
755
|
fix: renderFixCommand(fixPlan),
|
|
803
756
|
...rootTaskEntrypoints(checkPlan, fixPlan),
|
|
804
757
|
...directFragments,
|
|
805
758
|
...leafFragments,
|
|
759
|
+
"check:boundaries": "turbo boundaries --no-color",
|
|
806
760
|
"check:run": noopTaskCommand(),
|
|
807
761
|
"fix:run": noopTaskCommand(),
|
|
808
762
|
};
|
|
@@ -850,7 +804,7 @@ function rootTaskEntrypoints(checkPlan, fixPlan) {
|
|
|
850
804
|
if (taskName === undefined) {
|
|
851
805
|
continue;
|
|
852
806
|
}
|
|
853
|
-
entries.push([taskName,
|
|
807
|
+
entries.push([taskName, renderTurboRunCommand([`${taskName}:run`])]);
|
|
854
808
|
}
|
|
855
809
|
return Object.fromEntries(entries);
|
|
856
810
|
}
|
|
@@ -930,7 +884,7 @@ function packageLinkPlanFor(context, capability) {
|
|
|
930
884
|
]);
|
|
931
885
|
}
|
|
932
886
|
function nodePackageDefinitions(context, capability) {
|
|
933
|
-
|
|
887
|
+
const nodeDefinitions = capability.packages
|
|
934
888
|
.filter((nodePackage) => nodePackage.kind === "hono-api")
|
|
935
889
|
.map((nodePackage) => ({
|
|
936
890
|
name: nodePackageName(context, nodePackage),
|
|
@@ -938,6 +892,18 @@ function nodePackageDefinitions(context, capability) {
|
|
|
938
892
|
role: "runtime-service",
|
|
939
893
|
sourcePreset: "hono-api",
|
|
940
894
|
}));
|
|
895
|
+
if (hasVikePackage(capability)) {
|
|
896
|
+
return [
|
|
897
|
+
...nodeDefinitions,
|
|
898
|
+
{
|
|
899
|
+
name: vikeDbPackageName(context),
|
|
900
|
+
path: vikeDbPackagePath(),
|
|
901
|
+
role: "shared-library",
|
|
902
|
+
sourcePreset: "ts-lib",
|
|
903
|
+
},
|
|
904
|
+
];
|
|
905
|
+
}
|
|
906
|
+
return nodeDefinitions;
|
|
941
907
|
}
|
|
942
908
|
function nodePackageName(context, nodePackage) {
|
|
943
909
|
const packageDefinition = context.blueprint.packages?.find((pkg) => pkg.path === nodePackage.path);
|
|
@@ -947,16 +913,16 @@ function nodePackageName(context, nodePackage) {
|
|
|
947
913
|
const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
|
|
948
914
|
return `@${context.projectName.value}/${leaf}`;
|
|
949
915
|
}
|
|
950
|
-
function packageScopeFromNodeWorkspace(context) {
|
|
951
|
-
const apiPackage = context.blueprint.packages?.find((pkg) => pkg.path === "apps/api");
|
|
952
|
-
if (apiPackage?.name.startsWith("@") && apiPackage.name.endsWith("/api")) {
|
|
953
|
-
return apiPackage.name.slice(1, -"/api".length);
|
|
954
|
-
}
|
|
955
|
-
return context.projectName.value;
|
|
956
|
-
}
|
|
957
916
|
function nodePackageLinkPlan(context, capability) {
|
|
958
917
|
return planPackageLinks(nodePackageDefinitions(context, capability), capability.packageLinks ?? []);
|
|
959
918
|
}
|
|
919
|
+
function vikeDbPackagePath() {
|
|
920
|
+
return "packages/db";
|
|
921
|
+
}
|
|
922
|
+
function vikeDbPackageName(context) {
|
|
923
|
+
const packageDefinition = context.blueprint.packages?.find((pkg) => pkg.path === vikeDbPackagePath());
|
|
924
|
+
return packageDefinition?.name ?? `@${context.projectName.value}/db`;
|
|
925
|
+
}
|
|
960
926
|
function rootPackageJson(context, packageScripts, state) {
|
|
961
927
|
return {
|
|
962
928
|
name: context.projectName.value,
|
|
@@ -1075,7 +1041,7 @@ function vuePackageJson(context, packageName, scripts, packageLinkDependencies =
|
|
|
1075
1041
|
},
|
|
1076
1042
|
};
|
|
1077
1043
|
}
|
|
1078
|
-
function vikePackageJson(context, packageName, scripts) {
|
|
1044
|
+
function vikePackageJson(context, packageName, scripts, packageLinkDependencies = {}) {
|
|
1079
1045
|
return {
|
|
1080
1046
|
name: packageName,
|
|
1081
1047
|
version: "0.0.0",
|
|
@@ -1089,8 +1055,8 @@ function vikePackageJson(context, packageName, scripts) {
|
|
|
1089
1055
|
},
|
|
1090
1056
|
scripts,
|
|
1091
1057
|
dependencies: {
|
|
1058
|
+
...packageLinkDependencies,
|
|
1092
1059
|
"@vikejs/hono": "catalog:",
|
|
1093
|
-
"drizzle-orm": "catalog:",
|
|
1094
1060
|
hono: "catalog:",
|
|
1095
1061
|
telefunc: "catalog:",
|
|
1096
1062
|
vike: "catalog:",
|
|
@@ -1103,7 +1069,6 @@ function vikePackageJson(context, packageName, scripts) {
|
|
|
1103
1069
|
"@types/node": "catalog:",
|
|
1104
1070
|
"@vitejs/plugin-vue": "catalog:",
|
|
1105
1071
|
"@vue/tsconfig": "catalog:",
|
|
1106
|
-
"drizzle-kit": "catalog:",
|
|
1107
1072
|
oxfmt: "catalog:",
|
|
1108
1073
|
oxlint: "catalog:",
|
|
1109
1074
|
"oxlint-tsgolint": "catalog:",
|
|
@@ -1120,6 +1085,65 @@ function vikePackageJson(context, packageName, scripts) {
|
|
|
1120
1085
|
packageManager: context.toolchain.packageManagerPin.value,
|
|
1121
1086
|
};
|
|
1122
1087
|
}
|
|
1088
|
+
function vikeDbPackageJson(context) {
|
|
1089
|
+
return {
|
|
1090
|
+
name: vikeDbPackageName(context),
|
|
1091
|
+
version: "0.0.0",
|
|
1092
|
+
private: true,
|
|
1093
|
+
type: "module",
|
|
1094
|
+
imports: {
|
|
1095
|
+
"#db/*": {
|
|
1096
|
+
default: "./src/*.ts",
|
|
1097
|
+
types: "./src/*.ts",
|
|
1098
|
+
},
|
|
1099
|
+
},
|
|
1100
|
+
exports: {
|
|
1101
|
+
".": {
|
|
1102
|
+
default: "./src/index.ts",
|
|
1103
|
+
types: "./src/index.ts",
|
|
1104
|
+
},
|
|
1105
|
+
"./schema": {
|
|
1106
|
+
default: "./src/schema.ts",
|
|
1107
|
+
types: "./src/schema.ts",
|
|
1108
|
+
},
|
|
1109
|
+
"./queries/todos": {
|
|
1110
|
+
default: "./src/queries/todos.ts",
|
|
1111
|
+
types: "./src/queries/todos.ts",
|
|
1112
|
+
},
|
|
1113
|
+
},
|
|
1114
|
+
dependencies: {
|
|
1115
|
+
"drizzle-orm": "catalog:",
|
|
1116
|
+
},
|
|
1117
|
+
scripts: vikeDbPackageScripts(),
|
|
1118
|
+
devDependencies: {
|
|
1119
|
+
"@types/node": "catalog:",
|
|
1120
|
+
"drizzle-kit": "catalog:",
|
|
1121
|
+
oxfmt: "catalog:",
|
|
1122
|
+
oxlint: "catalog:",
|
|
1123
|
+
"oxlint-tsgolint": "catalog:",
|
|
1124
|
+
typescript: "catalog:",
|
|
1125
|
+
vitest: "catalog:",
|
|
1126
|
+
},
|
|
1127
|
+
engines: {
|
|
1128
|
+
node: context.toolchain.nodeLtsMajor.value,
|
|
1129
|
+
},
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
function vikeDbPackageScripts() {
|
|
1133
|
+
return {
|
|
1134
|
+
"build:run": "tsc -p tsconfig.json --noEmit",
|
|
1135
|
+
"db:push": "mkdir -p data node_modules/.tmp && drizzle-kit push",
|
|
1136
|
+
"drizzle:generate": "drizzle-kit generate",
|
|
1137
|
+
"drizzle:migrate": "drizzle-kit migrate",
|
|
1138
|
+
"drizzle:studio": "drizzle-kit studio",
|
|
1139
|
+
"format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
1140
|
+
"format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
1141
|
+
"lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
|
|
1142
|
+
"lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
|
|
1143
|
+
"test:run": "DATABASE_FILE=./node_modules/.tmp/test.sqlite pnpm run db:push && DATABASE_FILE=./node_modules/.tmp/test.sqlite vitest run --reporter=agent --silent=passed-only",
|
|
1144
|
+
"typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1123
1147
|
function catalogDependencies(dependencies) {
|
|
1124
1148
|
return Object.fromEntries([...dependencies].toSorted().map((dependency) => [dependency, "catalog:"]));
|
|
1125
1149
|
}
|
|
@@ -1135,7 +1159,7 @@ function generationRecord(context) {
|
|
|
1135
1159
|
},
|
|
1136
1160
|
};
|
|
1137
1161
|
}
|
|
1138
|
-
function rustCargoToml(projectName) {
|
|
1162
|
+
function rustCargoToml(projectName, dependencies = []) {
|
|
1139
1163
|
return [
|
|
1140
1164
|
"[package]",
|
|
1141
1165
|
`name = "${projectName}"`,
|
|
@@ -1143,6 +1167,7 @@ function rustCargoToml(projectName) {
|
|
|
1143
1167
|
'edition = "2024"',
|
|
1144
1168
|
"",
|
|
1145
1169
|
"[dependencies]",
|
|
1170
|
+
...renderCargoDependencyTomlEntries(dependencies),
|
|
1146
1171
|
"",
|
|
1147
1172
|
"[lints]",
|
|
1148
1173
|
"workspace = true",
|
|
@@ -1167,16 +1192,10 @@ function rustCargoToml(projectName) {
|
|
|
1167
1192
|
].join("\n");
|
|
1168
1193
|
}
|
|
1169
1194
|
function rustCargoLock(projectName) {
|
|
1170
|
-
return
|
|
1171
|
-
|
|
1172
|
-
"
|
|
1173
|
-
|
|
1174
|
-
"",
|
|
1175
|
-
"[[package]]",
|
|
1176
|
-
`name = "${projectName}"`,
|
|
1177
|
-
'version = "0.1.0"',
|
|
1178
|
-
"",
|
|
1179
|
-
].join("\n");
|
|
1195
|
+
return renderCargoLockForPackage({
|
|
1196
|
+
packageName: projectName,
|
|
1197
|
+
packageVersion: "0.1.0",
|
|
1198
|
+
});
|
|
1180
1199
|
}
|
|
1181
1200
|
function rustRootPackageJson(context, packageScripts, state) {
|
|
1182
1201
|
return {
|
|
@@ -1222,7 +1241,6 @@ function workspaceLibraryPackageOperations({ context, state, packageScripts, pac
|
|
|
1222
1241
|
}
|
|
1223
1242
|
const rootManifest = rootPackageJson(context, packageScripts, state);
|
|
1224
1243
|
const packageManifest = libraryPackageJson(context, state, capability, workspacePackageScripts);
|
|
1225
|
-
const packageLinkPlan = packageLinkPlanFor(context, capability);
|
|
1226
1244
|
return [
|
|
1227
1245
|
{
|
|
1228
1246
|
kind: "writeJson",
|
|
@@ -1243,11 +1261,7 @@ function workspaceLibraryPackageOperations({ context, state, packageScripts, pac
|
|
|
1243
1261
|
{
|
|
1244
1262
|
kind: "writeJson",
|
|
1245
1263
|
to: "turbo.json",
|
|
1246
|
-
value: {
|
|
1247
|
-
tasks: {
|
|
1248
|
-
...packageLinkPlan.turboTasks,
|
|
1249
|
-
},
|
|
1250
|
-
},
|
|
1264
|
+
value: packageTurboConfig({ dependencyBuildsRequired: false }),
|
|
1251
1265
|
},
|
|
1252
1266
|
{
|
|
1253
1267
|
kind: "writeJson",
|
|
@@ -1326,9 +1340,7 @@ function rustBinaryWorkspaceOperations({ context, state, packageScripts, }) {
|
|
|
1326
1340
|
{
|
|
1327
1341
|
kind: "writeJson",
|
|
1328
1342
|
to: "turbo.json",
|
|
1329
|
-
value: {
|
|
1330
|
-
tasks: packageTurboTasks({ dependencyBuildsRequired: false }),
|
|
1331
|
-
},
|
|
1343
|
+
value: packageTurboConfig({ dependencyBuildsRequired: false }),
|
|
1332
1344
|
},
|
|
1333
1345
|
{
|
|
1334
1346
|
kind: "writeJson",
|
|
@@ -1338,7 +1350,7 @@ function rustBinaryWorkspaceOperations({ context, state, packageScripts, }) {
|
|
|
1338
1350
|
{
|
|
1339
1351
|
kind: "writeText",
|
|
1340
1352
|
to: `${packagePath}/Cargo.toml`,
|
|
1341
|
-
text: rustCargoToml(rustProjectName(context)),
|
|
1353
|
+
text: rustCargoToml(rustProjectName(context), capability.cargoDependencies ?? []),
|
|
1342
1354
|
},
|
|
1343
1355
|
{
|
|
1344
1356
|
kind: "writeText",
|
|
@@ -1428,7 +1440,7 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1428
1440
|
}
|
|
1429
1441
|
const capability = state.nodeWorkspace;
|
|
1430
1442
|
const packageLinkPlan = nodePackageLinkPlan(context, capability);
|
|
1431
|
-
const
|
|
1443
|
+
const nodePackageManifests = capability.packages.map((nodePackage) => {
|
|
1432
1444
|
const scripts = nodePackageScripts(nodePackage, capability);
|
|
1433
1445
|
const packageName = nodePackageName(context, nodePackage);
|
|
1434
1446
|
if (nodePackage.kind === "hono-api") {
|
|
@@ -1438,10 +1450,16 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1438
1450
|
: packageManifestExposureFields(exposure));
|
|
1439
1451
|
}
|
|
1440
1452
|
if (nodePackage.kind === "vike-app") {
|
|
1441
|
-
return vikePackageJson(context, packageName, scripts);
|
|
1453
|
+
return vikePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
|
|
1442
1454
|
}
|
|
1443
1455
|
return vuePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
|
|
1444
1456
|
});
|
|
1457
|
+
const vikeDbManifest = hasVikePackage(capability)
|
|
1458
|
+
? vikeDbPackageJson(context)
|
|
1459
|
+
: undefined;
|
|
1460
|
+
const packageManifests = vikeDbManifest === undefined
|
|
1461
|
+
? nodePackageManifests
|
|
1462
|
+
: [...nodePackageManifests, vikeDbManifest];
|
|
1445
1463
|
const rootManifest = rootPackageJson(context, packageScripts, state);
|
|
1446
1464
|
if (rootManifest === undefined) {
|
|
1447
1465
|
throw new Error("workspace-node-packages rendered no package manifests");
|
|
@@ -1456,7 +1474,7 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1456
1474
|
kind: "writeText",
|
|
1457
1475
|
to: "pnpm-workspace.yaml",
|
|
1458
1476
|
text: renderGeneratedPnpmWorkspaceYaml({
|
|
1459
|
-
packages:
|
|
1477
|
+
packages: workspacePackageGlobsForNodeWorkspace(capability),
|
|
1460
1478
|
dependencies: capability.packageLinks === undefined
|
|
1461
1479
|
? collectGeneratedManifestCatalogDependencies([
|
|
1462
1480
|
rootManifest,
|
|
@@ -1490,6 +1508,9 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1490
1508
|
}
|
|
1491
1509
|
: {}),
|
|
1492
1510
|
},
|
|
1511
|
+
boundaries: packageTurboConfig({
|
|
1512
|
+
dependencyBuildsRequired: false,
|
|
1513
|
+
}).boundaries,
|
|
1493
1514
|
},
|
|
1494
1515
|
},
|
|
1495
1516
|
{
|
|
@@ -1501,16 +1522,17 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1501
1522
|
{
|
|
1502
1523
|
kind: "writeJson",
|
|
1503
1524
|
to: `${nodePackage.path}/package.json`,
|
|
1504
|
-
value:
|
|
1525
|
+
value: nodePackageManifests[index],
|
|
1505
1526
|
},
|
|
1506
1527
|
...nodePackageTsconfigOperations(nodePackage, capability),
|
|
1507
|
-
...nodePackage.sourceFiles.
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1528
|
+
...nodePackage.sourceFiles.flatMap((sourceFile) => vikeTemplateSourceOperation({
|
|
1529
|
+
context,
|
|
1530
|
+
nodePackage,
|
|
1531
|
+
sourceFile,
|
|
1532
|
+
workspace: capability,
|
|
1511
1533
|
})),
|
|
1512
1534
|
]),
|
|
1513
|
-
...
|
|
1535
|
+
...(vikeDbManifest === undefined ? [] : vikeDbPackageOperations(context)),
|
|
1514
1536
|
{
|
|
1515
1537
|
kind: "writeJson",
|
|
1516
1538
|
to: ".template/blueprint.json",
|
|
@@ -1525,10 +1547,10 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1525
1547
|
}
|
|
1526
1548
|
function nodePackageScripts(nodePackage, workspace) {
|
|
1527
1549
|
const oxcScripts = {
|
|
1528
|
-
"format:check": "oxfmt --
|
|
1550
|
+
"format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
1529
1551
|
"format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
1530
|
-
lint: "oxlint --config ../../oxlint.config.ts .",
|
|
1531
|
-
"lint:fix": "oxlint --config ../../oxlint.config.ts . --fix",
|
|
1552
|
+
lint: "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
|
|
1553
|
+
"lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
|
|
1532
1554
|
};
|
|
1533
1555
|
if (nodePackage.kind === "hono-api") {
|
|
1534
1556
|
return {
|
|
@@ -1538,27 +1560,24 @@ function nodePackageScripts(nodePackage, workspace) {
|
|
|
1538
1560
|
: {}),
|
|
1539
1561
|
...leafScriptFragments(oxcScripts),
|
|
1540
1562
|
start: "node dist/server.js",
|
|
1541
|
-
"test:run": "vitest run",
|
|
1542
|
-
"typecheck:run": "tsc -p tsconfig.json --noEmit",
|
|
1563
|
+
"test:run": "vitest run --reporter=agent --silent=passed-only",
|
|
1564
|
+
"typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
|
|
1543
1565
|
};
|
|
1544
1566
|
}
|
|
1545
1567
|
if (nodePackage.kind === "vike-app") {
|
|
1568
|
+
const dbCommand = "DATABASE_FILE=../../apps/web/data/app.sqlite pnpm --dir ../../packages/db run db:push";
|
|
1546
1569
|
return {
|
|
1547
1570
|
"build:run": "vike build",
|
|
1548
|
-
dev:
|
|
1549
|
-
"
|
|
1550
|
-
"drizzle:generate": "drizzle-kit generate",
|
|
1551
|
-
"drizzle:migrate": "drizzle-kit migrate",
|
|
1552
|
-
"drizzle:studio": "drizzle-kit studio",
|
|
1553
|
-
"format:check:run": "oxfmt --check --config ../../oxfmt.config.ts .",
|
|
1571
|
+
dev: `${dbCommand} && vike dev`,
|
|
1572
|
+
"format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
1554
1573
|
"format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
1555
|
-
"lint:run": "oxlint --type-aware --config ../../oxlint.config.ts .",
|
|
1556
|
-
"lint:fix:run": "oxlint --type-aware --config ../../oxlint.config.ts . --fix",
|
|
1557
|
-
preview:
|
|
1574
|
+
"lint:run": "oxlint --quiet --format=unix --type-aware --config ../../oxlint.config.ts .",
|
|
1575
|
+
"lint:fix:run": "oxlint --type-aware --format=unix --config ../../oxlint.config.ts . --fix",
|
|
1576
|
+
preview: `${dbCommand} && vike preview`,
|
|
1558
1577
|
start: "node ./dist/server/index.mjs",
|
|
1559
|
-
"test:run": "
|
|
1560
|
-
"test:e2e:run": "
|
|
1561
|
-
"typecheck:run": "vue-tsc --build --noEmit",
|
|
1578
|
+
"test:run": "vitest run --reporter=agent --silent=passed-only --passWithNoTests",
|
|
1579
|
+
"test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
|
|
1580
|
+
"typecheck:run": "vue-tsc --build --noEmit --pretty false",
|
|
1562
1581
|
};
|
|
1563
1582
|
}
|
|
1564
1583
|
return {
|
|
@@ -1566,11 +1585,11 @@ function nodePackageScripts(nodePackage, workspace) {
|
|
|
1566
1585
|
dev: "vite",
|
|
1567
1586
|
...leafScriptFragments(oxcScripts),
|
|
1568
1587
|
preview: "vite preview",
|
|
1569
|
-
"test:run": "vitest run",
|
|
1588
|
+
"test:run": "vitest run --reporter=agent --silent=passed-only",
|
|
1570
1589
|
"test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
|
|
1571
1590
|
"typecheck:run": workspace.packages.length > 1
|
|
1572
|
-
? "vue-tsc --build"
|
|
1573
|
-
: "vue-tsc --build --noEmit",
|
|
1591
|
+
? "vue-tsc --build --pretty false"
|
|
1592
|
+
: "vue-tsc --build --noEmit --pretty false",
|
|
1574
1593
|
};
|
|
1575
1594
|
}
|
|
1576
1595
|
function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
@@ -1582,6 +1601,7 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1582
1601
|
value: {
|
|
1583
1602
|
files: [],
|
|
1584
1603
|
references: [
|
|
1604
|
+
{ path: "../../packages/db" },
|
|
1585
1605
|
{ path: "./tsconfig.app.json" },
|
|
1586
1606
|
{ path: "./tsconfig.test.json" },
|
|
1587
1607
|
{ path: "./tsconfig.node.json" },
|
|
@@ -1608,7 +1628,6 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1608
1628
|
"+server.ts",
|
|
1609
1629
|
"assets/**/*.svg",
|
|
1610
1630
|
"components/**/*.vue",
|
|
1611
|
-
"database/**/*.ts",
|
|
1612
1631
|
"pages/**/*.ts",
|
|
1613
1632
|
"pages/**/*.vue",
|
|
1614
1633
|
"server/**/*.ts",
|
|
@@ -1628,7 +1647,7 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1628
1647
|
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
|
|
1629
1648
|
types: ["node", "vitest/globals"],
|
|
1630
1649
|
},
|
|
1631
|
-
include: ["
|
|
1650
|
+
include: ["test/**/*.ts", "vitest.config.ts"],
|
|
1632
1651
|
},
|
|
1633
1652
|
},
|
|
1634
1653
|
{
|
|
@@ -1649,7 +1668,6 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1649
1668
|
skipLibCheck: true,
|
|
1650
1669
|
},
|
|
1651
1670
|
include: [
|
|
1652
|
-
"drizzle.config.ts",
|
|
1653
1671
|
"playwright.config.ts",
|
|
1654
1672
|
"scripts/**/*.ts",
|
|
1655
1673
|
"vite.config.ts",
|
|
@@ -1802,7 +1820,7 @@ function vueAppTsconfigOperations(packagePath) {
|
|
|
1802
1820
|
}));
|
|
1803
1821
|
}
|
|
1804
1822
|
function sourcePathWithinNodePackage(sourceFile, workspace) {
|
|
1805
|
-
if (workspace.packages.length === 1) {
|
|
1823
|
+
if (workspace.packages.length === 1 && !sourceFile.startsWith("web/")) {
|
|
1806
1824
|
return sourceFile;
|
|
1807
1825
|
}
|
|
1808
1826
|
return sourceFile.replace(/^(api|web)\//, "");
|
|
@@ -1811,6 +1829,91 @@ function nodePackageTargetPath(nodePackage, sourceFile, workspace) {
|
|
|
1811
1829
|
const packageRelativePath = sourcePathWithinNodePackage(sourceFile, workspace);
|
|
1812
1830
|
return `${nodePackage.path}/${packageRelativePath}`;
|
|
1813
1831
|
}
|
|
1832
|
+
function vikeTemplateSourceOperation(options) {
|
|
1833
|
+
const to = nodePackageTargetPath(options.nodePackage, options.sourceFile, options.workspace);
|
|
1834
|
+
const copyOperation = {
|
|
1835
|
+
kind: "copyFile",
|
|
1836
|
+
from: options.sourceFile,
|
|
1837
|
+
to,
|
|
1838
|
+
};
|
|
1839
|
+
if (options.nodePackage.kind === "vike-app" &&
|
|
1840
|
+
[
|
|
1841
|
+
"web/pages/index/+Page.telefunc.ts",
|
|
1842
|
+
"web/server/app.ts",
|
|
1843
|
+
"web/types/global.d.ts",
|
|
1844
|
+
].includes(options.sourceFile)) {
|
|
1845
|
+
const dbPackageName = vikeDbPackageName(options.context);
|
|
1846
|
+
const replacements = {
|
|
1847
|
+
"web/pages/index/+Page.telefunc.ts": `import { createTodo, listTodos } from "${dbPackageName}/queries/todos";`,
|
|
1848
|
+
"web/server/app.ts": `import { createDatabase } from "${dbPackageName}";`,
|
|
1849
|
+
"web/types/global.d.ts": `import type { Database } from "${dbPackageName}";`,
|
|
1850
|
+
};
|
|
1851
|
+
return [
|
|
1852
|
+
copyOperation,
|
|
1853
|
+
{
|
|
1854
|
+
kind: "replaceAnchors",
|
|
1855
|
+
path: to,
|
|
1856
|
+
language: "typescript",
|
|
1857
|
+
replacements: {
|
|
1858
|
+
"db-package-import": replacements[options.sourceFile],
|
|
1859
|
+
},
|
|
1860
|
+
},
|
|
1861
|
+
];
|
|
1862
|
+
}
|
|
1863
|
+
return [copyOperation];
|
|
1864
|
+
}
|
|
1865
|
+
const vikeDbSourceFiles = [
|
|
1866
|
+
"db/turbo.json",
|
|
1867
|
+
"db/drizzle.config.ts",
|
|
1868
|
+
"db/src/db.ts",
|
|
1869
|
+
"db/src/index.ts",
|
|
1870
|
+
"db/src/queries/todos.ts",
|
|
1871
|
+
"db/src/schema.ts",
|
|
1872
|
+
"db/test/todos.test.ts",
|
|
1873
|
+
];
|
|
1874
|
+
function vikeDbPackageOperations(context) {
|
|
1875
|
+
const packagePath = vikeDbPackagePath();
|
|
1876
|
+
return [
|
|
1877
|
+
{
|
|
1878
|
+
kind: "writeJson",
|
|
1879
|
+
to: `${packagePath}/package.json`,
|
|
1880
|
+
value: vikeDbPackageJson(context),
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
kind: "writeJson",
|
|
1884
|
+
to: `${packagePath}/tsconfig.json`,
|
|
1885
|
+
value: vikeDbTsconfigJson(),
|
|
1886
|
+
},
|
|
1887
|
+
...vikeDbSourceFiles.map((sourceFile) => ({
|
|
1888
|
+
kind: "copyFile",
|
|
1889
|
+
from: sourceFile,
|
|
1890
|
+
to: `${packagePath}/${sourceFile.replace(/^db\//, "")}`,
|
|
1891
|
+
})),
|
|
1892
|
+
];
|
|
1893
|
+
}
|
|
1894
|
+
function vikeDbTsconfigJson() {
|
|
1895
|
+
return {
|
|
1896
|
+
compilerOptions: {
|
|
1897
|
+
...strictTypeScriptCompilerOptions({
|
|
1898
|
+
composite: true,
|
|
1899
|
+
declaration: true,
|
|
1900
|
+
declarationMap: true,
|
|
1901
|
+
module: "ESNext",
|
|
1902
|
+
moduleResolution: "Bundler",
|
|
1903
|
+
paths: { "#db/*": ["./src/*"] },
|
|
1904
|
+
rootDir: ".",
|
|
1905
|
+
types: ["node"],
|
|
1906
|
+
}),
|
|
1907
|
+
skipLibCheck: true,
|
|
1908
|
+
},
|
|
1909
|
+
include: ["src/**/*.ts", "test/**/*.ts", "drizzle.config.ts"],
|
|
1910
|
+
};
|
|
1911
|
+
}
|
|
1912
|
+
function workspacePackageGlobsForNodeWorkspace(workspace) {
|
|
1913
|
+
return hasVikePackage(workspace)
|
|
1914
|
+
? [workspace.workspacePackageGlob, "packages/*"]
|
|
1915
|
+
: [workspace.workspacePackageGlob];
|
|
1916
|
+
}
|
|
1814
1917
|
function gitignoreForNodeWorkspace(workspace) {
|
|
1815
1918
|
return [
|
|
1816
1919
|
"node_modules",
|
|
@@ -1822,23 +1925,6 @@ function gitignoreForNodeWorkspace(workspace) {
|
|
|
1822
1925
|
"",
|
|
1823
1926
|
].join("\n");
|
|
1824
1927
|
}
|
|
1825
|
-
function fullStackApiAnchorOperations(context, workspace) {
|
|
1826
|
-
if (workspace.packageLinks?.some((link) => link.consumerPackagePath === "apps/web" &&
|
|
1827
|
-
link.providerPackagePath === "apps/api") !== true) {
|
|
1828
|
-
return [];
|
|
1829
|
-
}
|
|
1830
|
-
const packageScope = packageScopeFromNodeWorkspace(context);
|
|
1831
|
-
return [
|
|
1832
|
-
{
|
|
1833
|
-
kind: "replaceAnchors",
|
|
1834
|
-
path: "apps/web/src/api.ts",
|
|
1835
|
-
language: "typescript",
|
|
1836
|
-
replacements: {
|
|
1837
|
-
"api-type-imports": `import type { AppType } from "@${packageScope}/api";\nimport { hc } from "hono/client";`,
|
|
1838
|
-
},
|
|
1839
|
-
},
|
|
1840
|
-
];
|
|
1841
|
-
}
|
|
1842
1928
|
function strictTypescriptOperations({ context, state, }) {
|
|
1843
1929
|
if (state.package === undefined && state.nodeWorkspace === undefined) {
|
|
1844
1930
|
throw new Error("strict-typescript-root requires a workspace package layout");
|
|
@@ -1893,6 +1979,7 @@ function rootTsconfigReferences(workspace) {
|
|
|
1893
1979
|
}
|
|
1894
1980
|
if (nodePackage.kind === "vike-app") {
|
|
1895
1981
|
return [
|
|
1982
|
+
{ path: "./packages/db" },
|
|
1896
1983
|
{ path: `./${nodePackage.path}/tsconfig.app.json` },
|
|
1897
1984
|
{ path: `./${nodePackage.path}/tsconfig.test.json` },
|
|
1898
1985
|
{ path: `./${nodePackage.path}/tsconfig.node.json` },
|