@ykdz/template 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cli.js +14 -2
- package/dist/src/declarations.d.ts +36 -0
- package/dist/src/declarations.js +29 -0
- package/dist/src/module-graph.d.ts +1 -1
- package/dist/src/module-graph.js +10 -2
- package/dist/src/package-addition-support.d.ts +5 -0
- package/dist/src/package-addition-support.js +4 -0
- package/dist/src/package-addition.d.ts +1 -0
- package/dist/src/package-addition.js +401 -54
- package/dist/src/package-linking.d.ts +55 -0
- package/dist/src/package-linking.js +116 -0
- package/dist/src/preset-projection.d.ts +3 -1
- package/dist/src/renderer.js +1 -0
- package/dist/templates/hono-api/projection.js +35 -14
- package/dist/templates/registry.js +3 -0
- package/dist/templates/rust-bin/projection.js +11 -1
- package/dist/templates/ts-lib/projection.js +52 -39
- package/dist/templates/vue-app/projection.js +27 -18
- package/dist/templates/vue-hono-app/projection.js +43 -23
- package/package.json +2 -2
- package/templates/hono-api/src/server.ts +1 -1
- package/templates/hono-api/test/app.test.ts +1 -1
- package/templates/ts-lib/src/index.ts +2 -2
- package/templates/ts-lib/src/name-schema.ts +3 -0
- package/templates/vue-app/src/App.vue +1 -1
- package/templates/vue-app/test/app.test.ts +1 -1
- package/templates/vue-hono-app/web/src/App.vue +2 -2
- package/templates/vue-hono-app/web/test/app.test.ts +1 -1
|
@@ -5,6 +5,8 @@ import { collectGeneratedManifestCatalogReferences, renderGeneratedPnpmWorkspace
|
|
|
5
5
|
import { browserTestToolLayer, checkedDockerfileFirstNodePnpmDevcontainer, nodePnpmToolLayer, } from "../../src/devcontainer.js";
|
|
6
6
|
import { editorCustomizationForCapabilities } from "../../src/editor-customization.js";
|
|
7
7
|
import { renderFixCommand, renderRootCheckCommand, } from "../../src/module-graph.js";
|
|
8
|
+
import { PackageAdditionSupport } from "../../src/package-addition-support.js";
|
|
9
|
+
import { packageManifestExposureFields, planPackageLinks, } from "../../src/package-linking.js";
|
|
8
10
|
import { renderNewProject } from "../../src/renderer.js";
|
|
9
11
|
const generatedBy = {
|
|
10
12
|
packageName: "@ykdz/template",
|
|
@@ -18,6 +20,7 @@ export const vueHonoAppPresetMetadata = {
|
|
|
18
20
|
generation: "supported",
|
|
19
21
|
supportedPackageManagers: ["pnpm"],
|
|
20
22
|
supportedProjectKinds: ["multi-package"],
|
|
23
|
+
packageAdditionSupport: PackageAdditionSupport.Unsupported,
|
|
21
24
|
features: [
|
|
22
25
|
"pnpm-catalog",
|
|
23
26
|
"oxc-format-lint",
|
|
@@ -84,6 +87,10 @@ function planVueHonoRootChecks() {
|
|
|
84
87
|
{ kind: "oxc-format-check", owner: rootBoundary },
|
|
85
88
|
{ kind: "oxc-lint", owner: rootBoundary },
|
|
86
89
|
{ kind: "typescript-typecheck", owner: rootBoundary },
|
|
90
|
+
{ kind: "turbo-package-typecheck", owner: workspacePackageBoundary },
|
|
91
|
+
{ kind: "turbo-package-build", owner: workspacePackageBoundary },
|
|
92
|
+
{ kind: "turbo-package-test", owner: workspacePackageBoundary },
|
|
93
|
+
{ kind: "turbo-package-e2e-test", owner: workspacePackageBoundary },
|
|
87
94
|
{ kind: "turbo-package-check", owner: workspacePackageBoundary },
|
|
88
95
|
],
|
|
89
96
|
environmentNeeds: [
|
|
@@ -206,16 +213,16 @@ function rootPackageJson(context, packageScripts) {
|
|
|
206
213
|
packageManager: context.toolchain.packageManagerPin.value,
|
|
207
214
|
};
|
|
208
215
|
}
|
|
209
|
-
function apiPackageJson(context, packageScope) {
|
|
216
|
+
function apiPackageJson(context, packageScope, exposure) {
|
|
217
|
+
const exposureFields = packageManifestExposureFields(exposure);
|
|
210
218
|
return {
|
|
211
219
|
name: packageName(packageScope, "api"),
|
|
212
220
|
version: "0.0.0",
|
|
213
221
|
private: true,
|
|
214
222
|
type: "module",
|
|
215
|
-
types:
|
|
216
|
-
exports:
|
|
217
|
-
|
|
218
|
-
},
|
|
223
|
+
types: exposureFields.types,
|
|
224
|
+
exports: exposureFields.exports,
|
|
225
|
+
imports: exposureFields.imports,
|
|
219
226
|
scripts: projectVueHonoApiPackageScripts(),
|
|
220
227
|
dependencies: {
|
|
221
228
|
"@hono/node-server": "catalog:",
|
|
@@ -235,15 +242,21 @@ function apiPackageJson(context, packageScope) {
|
|
|
235
242
|
},
|
|
236
243
|
};
|
|
237
244
|
}
|
|
238
|
-
function webPackageJson(context, packageScope) {
|
|
245
|
+
function webPackageJson(context, packageScope, packageLinkDependencies) {
|
|
239
246
|
return {
|
|
240
247
|
name: packageName(packageScope, "web"),
|
|
241
248
|
version: "0.0.0",
|
|
242
249
|
private: true,
|
|
243
250
|
type: "module",
|
|
251
|
+
imports: {
|
|
252
|
+
"#/*": {
|
|
253
|
+
default: "./src/*.ts",
|
|
254
|
+
types: "./src/*.ts",
|
|
255
|
+
},
|
|
256
|
+
},
|
|
244
257
|
scripts: projectVueHonoWebPackageScripts(),
|
|
245
258
|
dependencies: {
|
|
246
|
-
|
|
259
|
+
...packageLinkDependencies,
|
|
247
260
|
"@vueuse/core": "catalog:",
|
|
248
261
|
hono: "catalog:",
|
|
249
262
|
pinia: "catalog:",
|
|
@@ -307,8 +320,24 @@ function operationsForVueHonoApp(context, packageScripts, checkPlan) {
|
|
|
307
320
|
settings: editorCustomization.settings,
|
|
308
321
|
});
|
|
309
322
|
const rootManifest = rootPackageJson(context, packageScripts);
|
|
310
|
-
const
|
|
311
|
-
|
|
323
|
+
const packageLinkPlan = planPackageLinks([
|
|
324
|
+
{
|
|
325
|
+
name: apiName,
|
|
326
|
+
path: "apps/api",
|
|
327
|
+
role: "runtime-service",
|
|
328
|
+
sourcePreset: "hono-api",
|
|
329
|
+
},
|
|
330
|
+
], [{ consumerPackagePath: "apps/web", providerPackagePath: "apps/api" }]);
|
|
331
|
+
const apiExposure = packageLinkPlan.exposuresByPackagePath.get("apps/api");
|
|
332
|
+
const webPackageLinkDependencies = packageLinkPlan.manifestDependenciesByPackagePath.get("apps/web");
|
|
333
|
+
if (apiExposure === undefined) {
|
|
334
|
+
throw new Error("Missing Package Exposure for apps/api");
|
|
335
|
+
}
|
|
336
|
+
if (webPackageLinkDependencies === undefined) {
|
|
337
|
+
throw new Error("Missing Package Link Dependencies for apps/web");
|
|
338
|
+
}
|
|
339
|
+
const apiManifest = apiPackageJson(context, packageScope, apiExposure);
|
|
340
|
+
const webManifest = webPackageJson(context, packageScope, webPackageLinkDependencies);
|
|
312
341
|
return [
|
|
313
342
|
{
|
|
314
343
|
kind: "writeJson",
|
|
@@ -336,12 +365,13 @@ function operationsForVueHonoApp(context, packageScripts, checkPlan) {
|
|
|
336
365
|
value: {
|
|
337
366
|
tasks: {
|
|
338
367
|
build: {
|
|
339
|
-
dependsOn:
|
|
368
|
+
dependsOn: packageLinkPlan.turboTasks.build.dependsOn,
|
|
340
369
|
outputs: ["dist/**"],
|
|
341
370
|
},
|
|
342
|
-
check:
|
|
343
|
-
|
|
344
|
-
|
|
371
|
+
check: packageLinkPlan.turboTasks.check,
|
|
372
|
+
typecheck: packageLinkPlan.turboTasks.typecheck,
|
|
373
|
+
test: packageLinkPlan.turboTasks.test,
|
|
374
|
+
"test:e2e": packageLinkPlan.turboTasks["test:e2e"],
|
|
345
375
|
dev: {
|
|
346
376
|
cache: false,
|
|
347
377
|
persistent: true,
|
|
@@ -358,7 +388,6 @@ function operationsForVueHonoApp(context, packageScripts, checkPlan) {
|
|
|
358
388
|
value: {
|
|
359
389
|
files: [],
|
|
360
390
|
references: [
|
|
361
|
-
{ path: "./apps/api/tsconfig.json" },
|
|
362
391
|
{ path: "./apps/web/tsconfig.app.json" },
|
|
363
392
|
{ path: "./apps/web/tsconfig.test.json" },
|
|
364
393
|
{ path: "./apps/web/tsconfig.node.json" },
|
|
@@ -463,9 +492,6 @@ function operationsForVueHonoApp(context, packageScripts, checkPlan) {
|
|
|
463
492
|
module: "NodeNext",
|
|
464
493
|
moduleResolution: "NodeNext",
|
|
465
494
|
noEmitOnError: true,
|
|
466
|
-
paths: {
|
|
467
|
-
"@/*": ["./src/*"],
|
|
468
|
-
},
|
|
469
495
|
skipLibCheck: false,
|
|
470
496
|
strict: true,
|
|
471
497
|
target: "ES2022",
|
|
@@ -535,10 +561,6 @@ function operationsForVueHonoApp(context, packageScripts, checkPlan) {
|
|
|
535
561
|
module: "ESNext",
|
|
536
562
|
moduleResolution: "Bundler",
|
|
537
563
|
noEmitOnError: true,
|
|
538
|
-
paths: {
|
|
539
|
-
"@/*": ["./src/*"],
|
|
540
|
-
[apiName]: ["../api/src/index.ts"],
|
|
541
|
-
},
|
|
542
564
|
skipLibCheck: false,
|
|
543
565
|
strict: true,
|
|
544
566
|
target: "ES2022",
|
|
@@ -546,7 +568,6 @@ function operationsForVueHonoApp(context, packageScripts, checkPlan) {
|
|
|
546
568
|
types: ["web-bluetooth"],
|
|
547
569
|
},
|
|
548
570
|
include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue"],
|
|
549
|
-
references: [{ path: "../api/tsconfig.build.json" }],
|
|
550
571
|
},
|
|
551
572
|
},
|
|
552
573
|
{
|
|
@@ -560,7 +581,6 @@ function operationsForVueHonoApp(context, packageScripts, checkPlan) {
|
|
|
560
581
|
types: ["node", "vitest/globals", "web-bluetooth"],
|
|
561
582
|
},
|
|
562
583
|
include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue", "test/**/*.ts"],
|
|
563
|
-
references: [{ path: "../api/tsconfig.build.json" }],
|
|
564
584
|
},
|
|
565
585
|
},
|
|
566
586
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ykdz/template",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Project template generator for YKDZ starter projects.",
|
|
6
6
|
"keywords": [
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
56
|
-
"check": "pnpm run check:format && pnpm run typecheck && pnpm run test && pnpm run check:templates
|
|
56
|
+
"check": "pnpm run check:format && pnpm run typecheck && pnpm run test && pnpm run check:templates",
|
|
57
57
|
"check:format": "oxfmt --check --config templates/shared/oxc/oxfmt.config.ts --ignore-path .oxfmtignore .",
|
|
58
58
|
"check:fixtures": "tsx scripts/check-fixtures.ts",
|
|
59
59
|
"check:templates": "pnpm run check:templates:shared-oxc && pnpm run check:templates:github-yaml && pnpm run check:templates:boundary && pnpm run check:templates:static-source",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
|
|
3
|
+
import { nameSchema } from "#/name-schema";
|
|
4
|
+
|
|
3
5
|
export type Greeting = {
|
|
4
6
|
message: string;
|
|
5
7
|
};
|
|
6
8
|
|
|
7
|
-
const nameSchema = v.pipe(v.string(), v.trim(), v.minLength(1));
|
|
8
|
-
|
|
9
9
|
export function greet(name: string): Greeting {
|
|
10
10
|
return { message: `Hello, ${v.parse(nameSchema, name)}` };
|
|
11
11
|
}
|
|
@@ -3,7 +3,7 @@ import { usePreferredDark } from "@vueuse/core";
|
|
|
3
3
|
import { storeToRefs } from "pinia";
|
|
4
4
|
import { computed } from "vue";
|
|
5
5
|
|
|
6
|
-
import { useCounterStore } from "
|
|
6
|
+
import { useCounterStore } from "#/stores/counter";
|
|
7
7
|
|
|
8
8
|
const counter = useCounterStore();
|
|
9
9
|
const { count } = storeToRefs(counter);
|
|
@@ -3,8 +3,8 @@ import { usePreferredDark } from "@vueuse/core";
|
|
|
3
3
|
import { storeToRefs } from "pinia";
|
|
4
4
|
import { computed, onMounted, ref } from "vue";
|
|
5
5
|
|
|
6
|
-
import { api } from "
|
|
7
|
-
import { useCounterStore } from "
|
|
6
|
+
import { api } from "#/api";
|
|
7
|
+
import { useCounterStore } from "#/stores/counter";
|
|
8
8
|
|
|
9
9
|
const counter = useCounterStore();
|
|
10
10
|
const { count } = storeToRefs(counter);
|