@ykdz/template 0.0.12 → 0.0.13
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/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +2 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.d.ts +5 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +57 -0
- package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +176 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/+server.ts +12 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.env.example +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/dependabot.yml +23 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/workflows/check.yml +20 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/assets/logo.svg +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/components/CounterButton.vue +21 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/components/PageShell.vue +17 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/database/db.ts +14 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/database/queries/todos.ts +32 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/database/schema.ts +14 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/drizzle.config.ts +10 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/env.d.ts +6 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/global.d.ts +9 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+Head.vue +8 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+Layout.vue +9 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+config.ts +10 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/index/+Page.telefunc.ts +13 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/index/+Page.vue +89 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/tailwind.css +7 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/playwright.config.ts +22 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/server/api.ts +5 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/server/app.ts +25 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/test/e2e/app.spec.ts +10 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/test/todos.test.ts +20 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/vite.config.ts +12 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/vitest.config.ts +8 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/api.ts +1 -4
- package/node_modules/@ykdz/template-core/dist/package-addition.js +2 -1
- package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +6 -0
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.d.ts +1 -1
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +227 -22
- package/node_modules/@ykdz/template-shared/dist/index.d.ts +9 -9
- package/node_modules/@ykdz/template-shared/dist/index.js +29 -11
- package/package.json +3 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import vike from "@vikejs/hono";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { Telefunc } from "telefunc/node";
|
|
4
|
+
|
|
5
|
+
import { createDatabase } from "#/database/db";
|
|
6
|
+
import { api } from "#/server/api";
|
|
7
|
+
|
|
8
|
+
const telefunc = new Telefunc();
|
|
9
|
+
|
|
10
|
+
export const app = new Hono();
|
|
11
|
+
|
|
12
|
+
app.route("/api", api);
|
|
13
|
+
|
|
14
|
+
app.all("/_telefunc", async (c) => {
|
|
15
|
+
const response = await telefunc.serve({
|
|
16
|
+
request: c.req.raw,
|
|
17
|
+
context: {
|
|
18
|
+
db: createDatabase(),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return response ?? c.notFound();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
vike(app);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { expect, test } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
test("renders the Vike home page", async ({ page }) => {
|
|
4
|
+
await page.goto("/");
|
|
5
|
+
await expect(
|
|
6
|
+
page.getByRole("heading", { name: "Full-stack Vike app" }),
|
|
7
|
+
).toBeVisible();
|
|
8
|
+
await page.getByRole("button", { name: "Count 0" }).click();
|
|
9
|
+
await expect(page.getByRole("button", { name: "Count 1" })).toBeVisible();
|
|
10
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { createDatabase } from "#/database/db";
|
|
4
|
+
import { createTodo, listTodos } from "#/database/queries/todos";
|
|
5
|
+
|
|
6
|
+
describe("todo queries", () => {
|
|
7
|
+
it("creates and lists todos through Drizzle SQLite", async () => {
|
|
8
|
+
const db = createDatabase(":memory:");
|
|
9
|
+
|
|
10
|
+
db.run(
|
|
11
|
+
"CREATE TABLE todos (id integer PRIMARY KEY AUTOINCREMENT NOT NULL, title text NOT NULL, completed integer DEFAULT false NOT NULL, created_at text DEFAULT (CURRENT_TIMESTAMP) NOT NULL)",
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
await expect(createTodo(db, { title: "Ship" })).resolves.toMatchObject({
|
|
15
|
+
id: 1,
|
|
16
|
+
title: "Ship",
|
|
17
|
+
});
|
|
18
|
+
await expect(listTodos(db)).resolves.toMatchObject([{ title: "Ship" }]);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
2
|
+
import vue from "@vitejs/plugin-vue";
|
|
3
|
+
import telefunc from "telefunc/vite";
|
|
4
|
+
import vike from "vike/plugin";
|
|
5
|
+
import { defineConfig, type PluginOption } from "vite";
|
|
6
|
+
|
|
7
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- telefunc/vite currently types its plugin factory as any.
|
|
8
|
+
const telefuncPlugin = telefunc() as PluginOption;
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
plugins: [vike(), telefuncPlugin, vue(), tailwindcss()],
|
|
12
|
+
});
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
// @template-anchor api-type-
|
|
2
|
-
import type { AppType } from "__API_PACKAGE__";
|
|
3
|
-
import { hc } from "hono/client";
|
|
4
|
-
// @template-anchor api-type-import-end
|
|
1
|
+
// @template-anchor api-type-imports
|
|
5
2
|
|
|
6
3
|
const apiBaseUrl = import.meta.env.VITE_API_BASE_URL ?? "/";
|
|
7
4
|
|
|
@@ -396,7 +396,8 @@ function workspacePackageGlobsFromBlueprint(blueprint) {
|
|
|
396
396
|
}
|
|
397
397
|
function turboPackageTaskCommand(task, workspacePackageGlobs) {
|
|
398
398
|
const filters = workspacePackageGlobs.map((glob) => `--filter './${glob}'`);
|
|
399
|
-
|
|
399
|
+
const concurrency = task === "check" ? ["--concurrency=1"] : [];
|
|
400
|
+
return [`turbo run ${task}`, ...concurrency, ...filters].join(" ");
|
|
400
401
|
}
|
|
401
402
|
function rootScriptWithTurboPackageTask(script, task, workspacePackageGlobs) {
|
|
402
403
|
const commands = script.split(" && ");
|
|
@@ -10,7 +10,10 @@ catalog:
|
|
|
10
10
|
"@types/node": ^24.0.0
|
|
11
11
|
"@types/web-bluetooth": ^0.0.21
|
|
12
12
|
"@vitejs/plugin-vue": ^6.0.7
|
|
13
|
+
"@vikejs/hono": ^0.2.1
|
|
13
14
|
"@vue/tsconfig": ^0.9.1
|
|
15
|
+
drizzle-kit: 1.0.0-beta.22
|
|
16
|
+
drizzle-orm: 1.0.0-beta.22
|
|
14
17
|
execa: ^9.6.1
|
|
15
18
|
hono: ^4.12.27
|
|
16
19
|
oxfmt: ^0.57.0
|
|
@@ -18,12 +21,15 @@ catalog:
|
|
|
18
21
|
oxlint-tsgolint: ^0.24.0
|
|
19
22
|
pinia: ^3.0.4
|
|
20
23
|
tailwindcss: ^4.3.2
|
|
24
|
+
telefunc: ^0.2.21
|
|
21
25
|
tsc-alias: ^1.8.17
|
|
22
26
|
tsx: ^4.22.4
|
|
23
27
|
turbo: 2.10.2
|
|
24
28
|
typescript: ^6.0.3
|
|
25
29
|
valibot: ^1.4.2
|
|
26
30
|
vite: ^8.1.2
|
|
31
|
+
vike: ^0.4.260
|
|
32
|
+
vike-vue: ^0.9.12
|
|
27
33
|
vitest: ^4.1.9
|
|
28
34
|
vue: ^3.5.39
|
|
29
35
|
vue-tsc: ^3.3.6
|
|
@@ -5,7 +5,7 @@ import type { PresetBlueprintOptions, PresetPackageAdditionOptions, PresetPackag
|
|
|
5
5
|
import type { PresetSourceManifestPreset } from "./preset-source.js";
|
|
6
6
|
export { normalizePresetProjectionDeclaration, projectionCapabilityIssues, validateProjectionCapabilities, };
|
|
7
7
|
export type { GithubMaintenanceCapabilityDeclaration, NodePnpmDevcontainerCapabilityDeclaration, OxcFormatLintCapabilityDeclaration, PresetProjectionDeclaration, ProjectionCapabilityDeclaration, ProjectionCapabilityKind, RustBinaryWorkspaceCapabilityDeclaration, StrictTypescriptRootCapabilityDeclaration, WorkspaceLibraryPackageCapabilityDeclaration, WorkspaceNodePackageDeclaration, WorkspaceNodePackageKind, WorkspaceNodePackagesCapabilityDeclaration, WorkspaceNodePackagePath, };
|
|
8
|
-
export type ProjectionSourcePreset = "hono-api" | "rust-bin" | "ts-lib" | "vue-app" | "vue-hono-app";
|
|
8
|
+
export type ProjectionSourcePreset = "hono-api" | "rust-bin" | "ts-lib" | "vike-app" | "vue-app" | "vue-hono-app";
|
|
9
9
|
export type PresetProjectionSourceRoots = {
|
|
10
10
|
readonly preset: (sourcePreset: ProjectionSourcePreset) => string;
|
|
11
11
|
readonly sharedOxc: () => string;
|
|
@@ -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
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
172
|
-
|
|
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
|
|
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) {
|
|
@@ -807,6 +826,9 @@ function projectPackageScripts(checkPlan, fixPlan, fragments) {
|
|
|
807
826
|
};
|
|
808
827
|
}
|
|
809
828
|
function packageCollection(workspacePackageGlob) {
|
|
829
|
+
if (workspacePackageGlob === ".") {
|
|
830
|
+
return ".";
|
|
831
|
+
}
|
|
810
832
|
return workspacePackageGlob.slice(0, -"/*".length);
|
|
811
833
|
}
|
|
812
834
|
function workspacePackagePath(context, capability) {
|
|
@@ -860,6 +882,9 @@ function nodePackageName(context, nodePackage) {
|
|
|
860
882
|
if (packageDefinition !== undefined) {
|
|
861
883
|
return packageDefinition.name;
|
|
862
884
|
}
|
|
885
|
+
if (nodePackage.path === ".") {
|
|
886
|
+
return context.projectName.value;
|
|
887
|
+
}
|
|
863
888
|
const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
|
|
864
889
|
return `@${context.projectName.value}/${leaf}`;
|
|
865
890
|
}
|
|
@@ -991,6 +1016,50 @@ function vuePackageJson(context, packageName, scripts, packageLinkDependencies =
|
|
|
991
1016
|
},
|
|
992
1017
|
};
|
|
993
1018
|
}
|
|
1019
|
+
function vikePackageJson(context, packageName, scripts) {
|
|
1020
|
+
return {
|
|
1021
|
+
name: packageName,
|
|
1022
|
+
version: "0.0.0",
|
|
1023
|
+
private: true,
|
|
1024
|
+
type: "module",
|
|
1025
|
+
imports: {
|
|
1026
|
+
"#/*": {
|
|
1027
|
+
default: "./*.ts",
|
|
1028
|
+
types: "./*.ts",
|
|
1029
|
+
},
|
|
1030
|
+
},
|
|
1031
|
+
scripts,
|
|
1032
|
+
dependencies: {
|
|
1033
|
+
"@vikejs/hono": "catalog:",
|
|
1034
|
+
"drizzle-orm": "catalog:",
|
|
1035
|
+
hono: "catalog:",
|
|
1036
|
+
telefunc: "catalog:",
|
|
1037
|
+
vike: "catalog:",
|
|
1038
|
+
"vike-vue": "catalog:",
|
|
1039
|
+
vue: "catalog:",
|
|
1040
|
+
},
|
|
1041
|
+
devDependencies: {
|
|
1042
|
+
"@playwright/test": "catalog:",
|
|
1043
|
+
"@tailwindcss/vite": "catalog:",
|
|
1044
|
+
"@types/node": "catalog:",
|
|
1045
|
+
"@vitejs/plugin-vue": "catalog:",
|
|
1046
|
+
"@vue/tsconfig": "catalog:",
|
|
1047
|
+
"drizzle-kit": "catalog:",
|
|
1048
|
+
oxfmt: "catalog:",
|
|
1049
|
+
oxlint: "catalog:",
|
|
1050
|
+
"oxlint-tsgolint": "catalog:",
|
|
1051
|
+
tailwindcss: "catalog:",
|
|
1052
|
+
typescript: "catalog:",
|
|
1053
|
+
vite: "catalog:",
|
|
1054
|
+
vitest: "catalog:",
|
|
1055
|
+
"vue-tsc": "catalog:",
|
|
1056
|
+
},
|
|
1057
|
+
engines: {
|
|
1058
|
+
node: context.toolchain.nodeLtsMajor.value,
|
|
1059
|
+
},
|
|
1060
|
+
packageManager: context.toolchain.packageManagerPin.value,
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
994
1063
|
function catalogDependencies(dependencies) {
|
|
995
1064
|
return Object.fromEntries([...dependencies].toSorted().map((dependency) => [dependency, "catalog:"]));
|
|
996
1065
|
}
|
|
@@ -1315,9 +1384,17 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1315
1384
|
? undefined
|
|
1316
1385
|
: packageManifestExposureFields(exposure));
|
|
1317
1386
|
}
|
|
1387
|
+
if (nodePackage.kind === "vike-app") {
|
|
1388
|
+
return vikePackageJson(context, packageName, scripts);
|
|
1389
|
+
}
|
|
1318
1390
|
return vuePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
|
|
1319
1391
|
});
|
|
1320
|
-
const rootManifest =
|
|
1392
|
+
const rootManifest = isRootNodeWorkspace(capability)
|
|
1393
|
+
? packageManifests[0]
|
|
1394
|
+
: rootPackageJson(context, packageScripts, state);
|
|
1395
|
+
if (rootManifest === undefined) {
|
|
1396
|
+
throw new Error("workspace-node-packages rendered no package manifests");
|
|
1397
|
+
}
|
|
1321
1398
|
return [
|
|
1322
1399
|
{
|
|
1323
1400
|
kind: "writeJson",
|
|
@@ -1377,16 +1454,20 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1377
1454
|
text: gitignoreForNodeWorkspace(capability),
|
|
1378
1455
|
},
|
|
1379
1456
|
...capability.packages.flatMap((nodePackage, index) => [
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1457
|
+
...(nodePackage.path === "."
|
|
1458
|
+
? []
|
|
1459
|
+
: [
|
|
1460
|
+
{
|
|
1461
|
+
kind: "writeJson",
|
|
1462
|
+
to: `${nodePackage.path}/package.json`,
|
|
1463
|
+
value: packageManifests[index],
|
|
1464
|
+
},
|
|
1465
|
+
]),
|
|
1385
1466
|
...nodePackageTsconfigOperations(nodePackage, capability),
|
|
1386
1467
|
...nodePackage.sourceFiles.map((sourceFile) => ({
|
|
1387
1468
|
kind: "copyFile",
|
|
1388
1469
|
from: sourceFile,
|
|
1389
|
-
to:
|
|
1470
|
+
to: nodePackageTargetPath(nodePackage, sourceFile, capability),
|
|
1390
1471
|
})),
|
|
1391
1472
|
]),
|
|
1392
1473
|
...fullStackApiAnchorOperations(context, capability),
|
|
@@ -1439,6 +1520,43 @@ function nodePackageScripts(nodePackage, workspace) {
|
|
|
1439
1520
|
typecheck: "tsc -p tsconfig.json --noEmit",
|
|
1440
1521
|
};
|
|
1441
1522
|
}
|
|
1523
|
+
if (nodePackage.kind === "vike-app") {
|
|
1524
|
+
const checks = {
|
|
1525
|
+
components: [
|
|
1526
|
+
{ kind: "oxc-format-check", owner: workspacePackageBoundary },
|
|
1527
|
+
{ kind: "oxc-lint", owner: workspacePackageBoundary },
|
|
1528
|
+
{ kind: "typescript-typecheck", owner: workspacePackageBoundary },
|
|
1529
|
+
{ kind: "build", owner: workspacePackageBoundary },
|
|
1530
|
+
{ kind: "unit-test", owner: workspacePackageBoundary },
|
|
1531
|
+
{ kind: "e2e-test", owner: workspacePackageBoundary },
|
|
1532
|
+
],
|
|
1533
|
+
environmentNeeds: [],
|
|
1534
|
+
};
|
|
1535
|
+
const fixes = {
|
|
1536
|
+
components: [
|
|
1537
|
+
{ kind: "oxc-format-write", owner: workspacePackageBoundary },
|
|
1538
|
+
{ kind: "oxc-lint-fix", owner: workspacePackageBoundary },
|
|
1539
|
+
],
|
|
1540
|
+
};
|
|
1541
|
+
return {
|
|
1542
|
+
build: "vike build",
|
|
1543
|
+
check: renderRootCheckCommand(checks),
|
|
1544
|
+
dev: "vike dev",
|
|
1545
|
+
"drizzle:generate": "drizzle-kit generate",
|
|
1546
|
+
"drizzle:migrate": "drizzle-kit migrate",
|
|
1547
|
+
"drizzle:studio": "drizzle-kit studio",
|
|
1548
|
+
fix: renderFixCommand(fixes),
|
|
1549
|
+
"format:check": "oxfmt --check --config oxfmt.config.ts .",
|
|
1550
|
+
"format:write": "oxfmt --write --config oxfmt.config.ts .",
|
|
1551
|
+
lint: "oxlint --type-aware --config oxlint.config.ts .",
|
|
1552
|
+
"lint:fix": "oxlint --type-aware --config oxlint.config.ts . --fix",
|
|
1553
|
+
preview: "vike preview",
|
|
1554
|
+
start: "node ./dist/server/index.mjs",
|
|
1555
|
+
test: "vitest run",
|
|
1556
|
+
"test:e2e": "playwright test --config playwright.config.ts",
|
|
1557
|
+
typecheck: "vue-tsc --build --noEmit",
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1442
1560
|
const checks = {
|
|
1443
1561
|
components: [
|
|
1444
1562
|
{ kind: "oxc-format-check", owner: workspacePackageBoundary },
|
|
@@ -1471,6 +1589,80 @@ function nodePackageScripts(nodePackage, workspace) {
|
|
|
1471
1589
|
};
|
|
1472
1590
|
}
|
|
1473
1591
|
function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
1592
|
+
if (nodePackage.kind === "vike-app") {
|
|
1593
|
+
return [
|
|
1594
|
+
{
|
|
1595
|
+
kind: "writeJson",
|
|
1596
|
+
to: "tsconfig.app.json",
|
|
1597
|
+
value: {
|
|
1598
|
+
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
1599
|
+
compilerOptions: {
|
|
1600
|
+
...strictTypeScriptCompilerOptions({
|
|
1601
|
+
composite: true,
|
|
1602
|
+
module: "ESNext",
|
|
1603
|
+
moduleResolution: "Bundler",
|
|
1604
|
+
paths: { "#/*": ["./*"] },
|
|
1605
|
+
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
1606
|
+
types: ["node"],
|
|
1607
|
+
}),
|
|
1608
|
+
skipLibCheck: true,
|
|
1609
|
+
},
|
|
1610
|
+
include: [
|
|
1611
|
+
"+server.ts",
|
|
1612
|
+
"assets/**/*.svg",
|
|
1613
|
+
"components/**/*.vue",
|
|
1614
|
+
"database/**/*.ts",
|
|
1615
|
+
"env.d.ts",
|
|
1616
|
+
"global.d.ts",
|
|
1617
|
+
"pages/**/*.ts",
|
|
1618
|
+
"pages/**/*.vue",
|
|
1619
|
+
"server/**/*.ts",
|
|
1620
|
+
],
|
|
1621
|
+
},
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
kind: "writeJson",
|
|
1625
|
+
to: "tsconfig.test.json",
|
|
1626
|
+
value: {
|
|
1627
|
+
extends: "./tsconfig.app.json",
|
|
1628
|
+
compilerOptions: {
|
|
1629
|
+
lib: ["ESNext", "DOM", "DOM.Iterable"],
|
|
1630
|
+
paths: { "#/*": ["./*"] },
|
|
1631
|
+
skipLibCheck: true,
|
|
1632
|
+
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
|
|
1633
|
+
types: ["node", "vitest/globals"],
|
|
1634
|
+
},
|
|
1635
|
+
include: ["database/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
|
|
1636
|
+
},
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
kind: "writeJson",
|
|
1640
|
+
to: "tsconfig.node.json",
|
|
1641
|
+
multilineArrays: ["include"],
|
|
1642
|
+
value: {
|
|
1643
|
+
compilerOptions: {
|
|
1644
|
+
...strictTypeScriptCompilerOptions({
|
|
1645
|
+
composite: true,
|
|
1646
|
+
module: "ESNext",
|
|
1647
|
+
moduleResolution: "Bundler",
|
|
1648
|
+
lib: ["ESNext", "DOM", "DOM.Iterable"],
|
|
1649
|
+
paths: { "#/*": ["./*"] },
|
|
1650
|
+
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
1651
|
+
types: ["node"],
|
|
1652
|
+
}),
|
|
1653
|
+
skipLibCheck: true,
|
|
1654
|
+
},
|
|
1655
|
+
include: [
|
|
1656
|
+
"drizzle.config.ts",
|
|
1657
|
+
"playwright.config.ts",
|
|
1658
|
+
"scripts/**/*.ts",
|
|
1659
|
+
"vite.config.ts",
|
|
1660
|
+
"vitest.config.ts",
|
|
1661
|
+
],
|
|
1662
|
+
},
|
|
1663
|
+
},
|
|
1664
|
+
];
|
|
1665
|
+
}
|
|
1474
1666
|
if (nodePackage.kind === "hono-api") {
|
|
1475
1667
|
return [
|
|
1476
1668
|
{
|
|
@@ -1619,6 +1811,13 @@ function sourcePathWithinNodePackage(sourceFile, workspace) {
|
|
|
1619
1811
|
}
|
|
1620
1812
|
return sourceFile.replace(/^(api|web)\//, "");
|
|
1621
1813
|
}
|
|
1814
|
+
function nodePackageTargetPath(nodePackage, sourceFile, workspace) {
|
|
1815
|
+
const packageRelativePath = sourcePathWithinNodePackage(sourceFile, workspace);
|
|
1816
|
+
if (nodePackage.path === ".") {
|
|
1817
|
+
return packageRelativePath;
|
|
1818
|
+
}
|
|
1819
|
+
return `${nodePackage.path}/${packageRelativePath}`;
|
|
1820
|
+
}
|
|
1622
1821
|
function gitignoreForNodeWorkspace(workspace) {
|
|
1623
1822
|
return [
|
|
1624
1823
|
"node_modules",
|
|
@@ -1642,8 +1841,7 @@ function fullStackApiAnchorOperations(context, workspace) {
|
|
|
1642
1841
|
path: "apps/web/src/api.ts",
|
|
1643
1842
|
language: "typescript",
|
|
1644
1843
|
replacements: {
|
|
1645
|
-
"api-type-
|
|
1646
|
-
"api-type-import-end": "*/",
|
|
1844
|
+
"api-type-imports": `import type { AppType } from "@${packageScope}/api";\nimport { hc } from "hono/client";`,
|
|
1647
1845
|
},
|
|
1648
1846
|
},
|
|
1649
1847
|
];
|
|
@@ -1700,6 +1898,13 @@ function rootTsconfigReferences(workspace) {
|
|
|
1700
1898
|
? []
|
|
1701
1899
|
: [{ path: `./${nodePackage.path}/tsconfig.json` }];
|
|
1702
1900
|
}
|
|
1901
|
+
if (nodePackage.kind === "vike-app") {
|
|
1902
|
+
return [
|
|
1903
|
+
{ path: "./tsconfig.app.json" },
|
|
1904
|
+
{ path: "./tsconfig.test.json" },
|
|
1905
|
+
{ path: "./tsconfig.node.json" },
|
|
1906
|
+
];
|
|
1907
|
+
}
|
|
1703
1908
|
return [
|
|
1704
1909
|
{ path: `./${nodePackage.path}/tsconfig.app.json` },
|
|
1705
1910
|
{ path: `./${nodePackage.path}/tsconfig.test.json` },
|
|
@@ -6,7 +6,7 @@ export declare const PackageAdditionSupport: {
|
|
|
6
6
|
export type PackageAdditionSupport = (typeof PackageAdditionSupport)[keyof typeof PackageAdditionSupport];
|
|
7
7
|
export declare const packageAdditionSupportValues: readonly ["supported", "unsupported"];
|
|
8
8
|
export type PackageRole = "runtime-service" | "shared-library";
|
|
9
|
-
export type PackageSourcePreset = "hono-api" | "ts-lib" | "vue-app";
|
|
9
|
+
export type PackageSourcePreset = "hono-api" | "ts-lib" | "vike-app" | "vue-app";
|
|
10
10
|
export type PackageLinkIntent = {
|
|
11
11
|
readonly consumerPackagePath: string;
|
|
12
12
|
readonly providerPackagePath: string;
|
|
@@ -77,8 +77,8 @@ export type WorkspaceLibraryPackageCapabilityDeclaration = {
|
|
|
77
77
|
readonly packageSourcePreset: "ts-lib";
|
|
78
78
|
readonly sourceFiles: readonly string[];
|
|
79
79
|
};
|
|
80
|
-
export type WorkspaceNodePackageKind = "hono-api" | "vue-app";
|
|
81
|
-
export type WorkspaceNodePackagePath = "apps/api" | "apps/web";
|
|
80
|
+
export type WorkspaceNodePackageKind = "hono-api" | "vike-app" | "vue-app";
|
|
81
|
+
export type WorkspaceNodePackagePath = "." | "apps/api" | "apps/web";
|
|
82
82
|
export type WorkspaceNodePackageDeclaration = {
|
|
83
83
|
readonly kind: WorkspaceNodePackageKind;
|
|
84
84
|
readonly path: WorkspaceNodePackagePath;
|
|
@@ -86,7 +86,7 @@ export type WorkspaceNodePackageDeclaration = {
|
|
|
86
86
|
};
|
|
87
87
|
export type WorkspaceNodePackagesCapabilityDeclaration = {
|
|
88
88
|
readonly kind: "workspace-node-packages";
|
|
89
|
-
readonly workspacePackageGlob: "apps/*";
|
|
89
|
+
readonly workspacePackageGlob: "." | "apps/*";
|
|
90
90
|
readonly packages: readonly WorkspaceNodePackageDeclaration[];
|
|
91
91
|
readonly packageLinks?: readonly {
|
|
92
92
|
readonly consumerPackagePath: "apps/web";
|
|
@@ -404,7 +404,7 @@ export declare const presetSourceManifestJsonSchema: {
|
|
|
404
404
|
readonly const: "workspace-node-packages";
|
|
405
405
|
};
|
|
406
406
|
readonly workspacePackageGlob: {
|
|
407
|
-
readonly
|
|
407
|
+
readonly enum: readonly [".", "apps/*"];
|
|
408
408
|
};
|
|
409
409
|
readonly packages: {
|
|
410
410
|
readonly type: "array";
|
|
@@ -415,10 +415,10 @@ export declare const presetSourceManifestJsonSchema: {
|
|
|
415
415
|
readonly required: readonly ["kind", "path", "sourceFiles"];
|
|
416
416
|
readonly properties: {
|
|
417
417
|
readonly kind: {
|
|
418
|
-
readonly enum: readonly ["hono-api", "vue-app"];
|
|
418
|
+
readonly enum: readonly ["hono-api", "vike-app", "vue-app"];
|
|
419
419
|
};
|
|
420
420
|
readonly path: {
|
|
421
|
-
readonly enum: readonly ["apps/api", "apps/web"];
|
|
421
|
+
readonly enum: readonly [".", "apps/api", "apps/web"];
|
|
422
422
|
};
|
|
423
423
|
readonly sourceFiles: {
|
|
424
424
|
readonly type: "array";
|
|
@@ -732,7 +732,7 @@ export declare const blueprintJsonSchema: {
|
|
|
732
732
|
readonly enum: readonly ["runtime-service", "shared-library"];
|
|
733
733
|
};
|
|
734
734
|
readonly sourcePreset: {
|
|
735
|
-
readonly enum: readonly ["hono-api", "ts-lib", "vue-app"];
|
|
735
|
+
readonly enum: readonly ["hono-api", "ts-lib", "vike-app", "vue-app"];
|
|
736
736
|
};
|
|
737
737
|
};
|
|
738
738
|
};
|
|
@@ -776,7 +776,7 @@ export declare const projectBlueprintSchema: v.StrictObjectSchema<{
|
|
|
776
776
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
777
777
|
readonly path: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
778
778
|
readonly role: v.OptionalSchema<v.PicklistSchema<["runtime-service", "shared-library"], undefined>, undefined>;
|
|
779
|
-
readonly sourcePreset: v.OptionalSchema<v.PicklistSchema<["hono-api", "ts-lib", "vue-app"], undefined>, undefined>;
|
|
779
|
+
readonly sourcePreset: v.OptionalSchema<v.PicklistSchema<["hono-api", "ts-lib", "vike-app", "vue-app"], undefined>, undefined>;
|
|
780
780
|
}, undefined>, undefined>, undefined>;
|
|
781
781
|
readonly packageLinkIntents: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
782
782
|
readonly consumerPackagePath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|