@ykdz/template 0.0.7 → 0.0.9
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 → cli.js} +33 -21
- package/node_modules/@ykdz/template-builtin-source/dist/src/index.d.ts +22 -0
- package/node_modules/@ykdz/template-builtin-source/dist/src/index.js +96 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.d.ts +6 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +240 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.d.ts +7 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.js +94 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.d.ts +2 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +15 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.d.ts +9 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +103 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.d.ts +6 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +224 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.d.ts +6 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +372 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.d.ts +8 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +203 -0
- package/node_modules/@ykdz/template-builtin-source/package.json +59 -0
- package/{templates → node_modules/@ykdz/template-builtin-source/templates}/preset-source.json +14 -2
- package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/node/oxlint.config.ts +34 -0
- package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/tsconfig.config.json +20 -0
- package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/vue/oxlint.config.ts +36 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/env.d.ts +8 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/env.d.ts +16 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.d.ts +7 -4
- package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.js +45 -14
- package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.js +13 -6
- package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.d.ts +5 -5
- package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.js +23 -30
- package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.d.ts +6 -4
- package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.js +45 -14
- package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.js +8 -3
- package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.js +3 -0
- package/node_modules/@ykdz/template-core/dist/package-addition.d.ts +12 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition.js +33 -18
- package/{pnpm-workspace.yaml → node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml} +4 -1
- package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.d.ts +3 -3
- package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.js +1 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.d.ts +1 -3
- package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.js +73 -74
- package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.d.ts +3 -3
- package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.js +1 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.d.ts +17 -5
- package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.js +209 -169
- package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.d.ts +2 -2
- package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.js +14 -6
- package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.js +2 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.d.ts +1 -1
- package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.js +8 -10
- package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.d.ts +5 -5
- package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.js +10 -11
- package/node_modules/@ykdz/template-core/package.json +34 -0
- package/package.json +18 -31
- package/README.md +0 -35
- package/dist/src/package-addition.d.ts +0 -8
- package/templates/shared/oxc/node/oxlint.config.ts +0 -9
- package/templates/shared/oxc/vue/oxlint.config.ts +0 -9
- package/templates/vue-app/env.d.ts +0 -1
- package/templates/vue-hono-app/web/env.d.ts +0 -9
- /package/dist/{src/cli.d.ts → cli.d.ts} +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/app.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/server.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/test/app.test.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/vitest.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rust-toolchain.toml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rustfmt.toml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/src/main.rs +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/browser-test.Dockerfile +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/node-pnpm.Dockerfile +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/rust.Dockerfile +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/editor-customization/capabilities.json +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/oxfmt.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/index.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/name-schema.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/index.html +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.package-addition.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/App.vue +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/main.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/stores/counter.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/style.css +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/app.test.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/e2e/app.spec.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vite.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vitest.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/index.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/runtime.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/server.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/test/app.test.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/vitest.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/index.html +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/playwright.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/App.vue +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/api.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/main.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/stores/counter.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/style.css +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/app.test.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/e2e/app.spec.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vite.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vitest.config.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.d.ts +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
|
|
3
|
+
import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
|
|
4
|
+
import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
|
|
5
|
+
import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
|
|
6
|
+
import { renderNewProject } from "@ykdz/template-core/renderer";
|
|
7
|
+
export const rustBinPresetMetadata = {
|
|
8
|
+
name: "rust-bin",
|
|
9
|
+
title: "Rust binary",
|
|
10
|
+
description: "Rust native binary workspace with rustfmt, clippy, and cargo tests.",
|
|
11
|
+
generation: "supported",
|
|
12
|
+
supportedPackageManagers: ["pnpm"],
|
|
13
|
+
supportedProjectKinds: ["multi-package"],
|
|
14
|
+
packageAdditionSupport: PackageAdditionSupport.Unsupported,
|
|
15
|
+
features: [
|
|
16
|
+
"root-check",
|
|
17
|
+
"fix-command",
|
|
18
|
+
"devcontainer",
|
|
19
|
+
"github-actions",
|
|
20
|
+
"dependabot",
|
|
21
|
+
"rustfmt-clippy",
|
|
22
|
+
"cargo-test",
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
const rustPackageBoundary = {
|
|
26
|
+
kind: "package-boundary",
|
|
27
|
+
path: ".",
|
|
28
|
+
};
|
|
29
|
+
function cargoPackageNameFromProjectName(projectName) {
|
|
30
|
+
const slug = projectName
|
|
31
|
+
.normalize("NFKD")
|
|
32
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
33
|
+
.toLowerCase()
|
|
34
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
35
|
+
.replace(/^-+|-+$/g, "");
|
|
36
|
+
return slug || "rust-bin";
|
|
37
|
+
}
|
|
38
|
+
function projectNameFromDir(targetDir) {
|
|
39
|
+
return path.basename(path.resolve(targetDir));
|
|
40
|
+
}
|
|
41
|
+
function rustWorkspacePackageName(projectName) {
|
|
42
|
+
return `${cargoPackageNameFromProjectName(projectName)}-native`;
|
|
43
|
+
}
|
|
44
|
+
function rustWorkspacePackagePath(projectName) {
|
|
45
|
+
return `packages/${cargoPackageNameFromProjectName(projectName)}`;
|
|
46
|
+
}
|
|
47
|
+
export function planRustBinChecks() {
|
|
48
|
+
return {
|
|
49
|
+
components: [
|
|
50
|
+
{ kind: "rustfmt-check", owner: rustPackageBoundary },
|
|
51
|
+
{ kind: "cargo-clippy", owner: rustPackageBoundary },
|
|
52
|
+
{ kind: "cargo-test", owner: rustPackageBoundary },
|
|
53
|
+
],
|
|
54
|
+
environmentNeeds: [],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export function planRustBinFixes() {
|
|
58
|
+
return {
|
|
59
|
+
components: [{ kind: "rustfmt-write", owner: rustPackageBoundary }],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function rustBinBlueprint(options = { targetDir: process.cwd() }) {
|
|
63
|
+
const projectName = projectNameFromDir(options.targetDir);
|
|
64
|
+
return {
|
|
65
|
+
schemaVersion: 1,
|
|
66
|
+
preset: "rust-bin",
|
|
67
|
+
packageManager: "pnpm",
|
|
68
|
+
projectKind: "multi-package",
|
|
69
|
+
features: [...rustBinPresetMetadata.features],
|
|
70
|
+
packages: [
|
|
71
|
+
{
|
|
72
|
+
name: rustWorkspacePackageName(projectName),
|
|
73
|
+
path: rustWorkspacePackagePath(projectName),
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export function projectRustBinPackageScripts() {
|
|
79
|
+
return {
|
|
80
|
+
check: renderRootCheckCommand(planRustBinChecks()),
|
|
81
|
+
fix: renderFixCommand(planRustBinFixes()),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export const rustBinPresetProjection = {
|
|
85
|
+
metadata: rustBinPresetMetadata,
|
|
86
|
+
blueprint: rustBinBlueprint,
|
|
87
|
+
project(context) {
|
|
88
|
+
return interpretPresetProjectionDeclaration({
|
|
89
|
+
preset: rustBinPresetMetadata,
|
|
90
|
+
declaration: loadBuiltInPresetProjectionDeclaration("rust-bin"),
|
|
91
|
+
context,
|
|
92
|
+
sourceRoots: builtInPresetProjectionSourceRoots(),
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
async render({ targetDir, plan }) {
|
|
96
|
+
await renderNewProject({
|
|
97
|
+
sourceRoot: plan.sourceRoot,
|
|
98
|
+
sourceRoots: plan.sourceRoots,
|
|
99
|
+
targetRoot: targetDir,
|
|
100
|
+
operations: [...plan.operations],
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
|
|
2
|
+
import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
|
|
3
|
+
export declare const tsLibPresetMetadata: BuiltInPreset;
|
|
4
|
+
export declare function tsLibBlueprint(options?: PresetBlueprintOptions): ProjectBlueprint;
|
|
5
|
+
export declare function projectTsLibPackageScripts(): Record<string, string>;
|
|
6
|
+
export declare const tsLibPresetProjection: PresetProjection;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
|
|
5
|
+
import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
|
|
6
|
+
import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
|
|
7
|
+
import { packageManifestExposureFields, planPackageLinks, } from "@ykdz/template-core/package-linking";
|
|
8
|
+
import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
|
|
9
|
+
import { renderNewProject, } from "@ykdz/template-core/renderer";
|
|
10
|
+
export const tsLibPresetMetadata = {
|
|
11
|
+
name: "ts-lib",
|
|
12
|
+
title: "TypeScript library",
|
|
13
|
+
description: "Strict TypeScript package with pnpm catalog tooling.",
|
|
14
|
+
generation: "supported",
|
|
15
|
+
supportedPackageManagers: ["pnpm"],
|
|
16
|
+
supportedProjectKinds: ["multi-package"],
|
|
17
|
+
packageAdditionSupport: PackageAdditionSupport.Supported,
|
|
18
|
+
features: [
|
|
19
|
+
"pnpm-catalog",
|
|
20
|
+
"oxc-format-lint",
|
|
21
|
+
"strict-typescript",
|
|
22
|
+
"root-check",
|
|
23
|
+
"fix-command",
|
|
24
|
+
"devcontainer",
|
|
25
|
+
"github-actions",
|
|
26
|
+
"dependabot",
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
const tsLibPackageBoundary = {
|
|
30
|
+
kind: "package-boundary",
|
|
31
|
+
path: ".",
|
|
32
|
+
};
|
|
33
|
+
function planTsLibPackageChecks() {
|
|
34
|
+
return {
|
|
35
|
+
components: [
|
|
36
|
+
{ kind: "typescript-typecheck", owner: tsLibPackageBoundary },
|
|
37
|
+
{ kind: "oxc-lint", owner: tsLibPackageBoundary },
|
|
38
|
+
{ kind: "oxc-format-check", owner: tsLibPackageBoundary },
|
|
39
|
+
],
|
|
40
|
+
environmentNeeds: [],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function planTsLibPackageFixes() {
|
|
44
|
+
return {
|
|
45
|
+
components: [
|
|
46
|
+
{ kind: "oxc-format-write", owner: tsLibPackageBoundary },
|
|
47
|
+
{ kind: "oxc-lint-fix", owner: tsLibPackageBoundary },
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function projectNameFromDir(targetDir) {
|
|
52
|
+
return path.basename(path.resolve(targetDir));
|
|
53
|
+
}
|
|
54
|
+
function packageScopeFromOptions(options) {
|
|
55
|
+
return options.scope ?? projectNameFromDir(options.targetDir);
|
|
56
|
+
}
|
|
57
|
+
function scopedPackageName(packageScope, packageLeafName) {
|
|
58
|
+
return `@${packageScope}/${packageLeafName}`;
|
|
59
|
+
}
|
|
60
|
+
export function tsLibBlueprint(options = { targetDir: process.cwd() }) {
|
|
61
|
+
const packageScope = packageScopeFromOptions(options);
|
|
62
|
+
const packageLeafName = projectNameFromDir(options.targetDir);
|
|
63
|
+
return {
|
|
64
|
+
schemaVersion: 1,
|
|
65
|
+
preset: "ts-lib",
|
|
66
|
+
packageManager: "pnpm",
|
|
67
|
+
projectKind: "multi-package",
|
|
68
|
+
features: [...tsLibPresetMetadata.features],
|
|
69
|
+
packages: [
|
|
70
|
+
{
|
|
71
|
+
name: scopedPackageName(packageScope, packageLeafName),
|
|
72
|
+
path: `packages/${packageLeafName}`,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function projectTsLibPackageScripts() {
|
|
78
|
+
const checkPlan = planTsLibPackageChecks();
|
|
79
|
+
const fixPlan = planTsLibPackageFixes();
|
|
80
|
+
return {
|
|
81
|
+
check: renderRootCheckCommand(checkPlan),
|
|
82
|
+
fix: renderFixCommand(fixPlan),
|
|
83
|
+
"format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
|
|
84
|
+
"format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
85
|
+
lint: "oxlint --config ../../oxlint.config.ts .",
|
|
86
|
+
"lint:fix": "oxlint --config ../../oxlint.config.ts . --fix",
|
|
87
|
+
typecheck: "tsc -p tsconfig.json --noEmit",
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
|
|
91
|
+
const packageExposure = planPackageLinks([
|
|
92
|
+
{
|
|
93
|
+
name: packageNameValue,
|
|
94
|
+
path: packagePath,
|
|
95
|
+
role: "shared-library",
|
|
96
|
+
sourcePreset: "ts-lib",
|
|
97
|
+
},
|
|
98
|
+
]).exposuresByPackagePath.get(packagePath);
|
|
99
|
+
if (packageExposure === undefined) {
|
|
100
|
+
throw new Error(`Missing Package Exposure for ${packagePath}`);
|
|
101
|
+
}
|
|
102
|
+
const exposureFields = packageManifestExposureFields(packageExposure);
|
|
103
|
+
return [
|
|
104
|
+
{
|
|
105
|
+
kind: "writeJson",
|
|
106
|
+
to: `${packagePath}/package.json`,
|
|
107
|
+
value: {
|
|
108
|
+
name: packageNameValue,
|
|
109
|
+
version: "0.0.0",
|
|
110
|
+
private: true,
|
|
111
|
+
type: "module",
|
|
112
|
+
imports: exposureFields.imports,
|
|
113
|
+
exports: exposureFields.exports,
|
|
114
|
+
dependencies: {
|
|
115
|
+
valibot: "catalog:",
|
|
116
|
+
},
|
|
117
|
+
scripts: projectTsLibPackageScripts(),
|
|
118
|
+
devDependencies: {
|
|
119
|
+
"@types/node": "catalog:",
|
|
120
|
+
oxfmt: "catalog:",
|
|
121
|
+
oxlint: "catalog:",
|
|
122
|
+
"oxlint-tsgolint": "catalog:",
|
|
123
|
+
typescript: "catalog:",
|
|
124
|
+
},
|
|
125
|
+
engines: {
|
|
126
|
+
node: nodeVersion,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
multilineArrays: ["files"],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
kind: "writeJson",
|
|
133
|
+
to: `${packagePath}/tsconfig.json`,
|
|
134
|
+
value: {
|
|
135
|
+
compilerOptions: {
|
|
136
|
+
composite: true,
|
|
137
|
+
declaration: true,
|
|
138
|
+
declarationMap: true,
|
|
139
|
+
erasableSyntaxOnly: true,
|
|
140
|
+
exactOptionalPropertyTypes: true,
|
|
141
|
+
forceConsistentCasingInFileNames: true,
|
|
142
|
+
isolatedModules: true,
|
|
143
|
+
module: "nodenext",
|
|
144
|
+
moduleResolution: "nodenext",
|
|
145
|
+
noEmitOnError: true,
|
|
146
|
+
noFallthroughCasesInSwitch: true,
|
|
147
|
+
noImplicitOverride: true,
|
|
148
|
+
noImplicitReturns: true,
|
|
149
|
+
noUncheckedIndexedAccess: true,
|
|
150
|
+
rootDir: "src",
|
|
151
|
+
skipLibCheck: false,
|
|
152
|
+
strict: true,
|
|
153
|
+
target: "es2023",
|
|
154
|
+
types: ["node"],
|
|
155
|
+
verbatimModuleSyntax: true,
|
|
156
|
+
},
|
|
157
|
+
include: ["src/**/*.ts"],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
kind: "copyFile",
|
|
162
|
+
from: "src/index.ts",
|
|
163
|
+
to: `${packagePath}/src/index.ts`,
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
kind: "copyFile",
|
|
167
|
+
from: "src/name-schema.ts",
|
|
168
|
+
to: `${packagePath}/src/name-schema.ts`,
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
function packageAdditionPlan(packageNameValue, packagePath, nodeVersion) {
|
|
173
|
+
const [workspaceCollection] = packagePath.split("/");
|
|
174
|
+
return {
|
|
175
|
+
packagePath,
|
|
176
|
+
workspacePackageGlob: `${workspaceCollection}/*`,
|
|
177
|
+
packageRole: "shared-library",
|
|
178
|
+
packageSourcePreset: "ts-lib",
|
|
179
|
+
sourceRoot: templateSourceRoot(),
|
|
180
|
+
sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
|
|
181
|
+
operations: packageAdditionOperations(packagePath, packageNameValue, nodeVersion),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function templateSourceRoot() {
|
|
185
|
+
const projectionDir = path.dirname(fileURLToPath(import.meta.url));
|
|
186
|
+
const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "ts-lib");
|
|
187
|
+
return existsSync(path.join(publishedTemplateRoot, "src", "index.ts"))
|
|
188
|
+
? publishedTemplateRoot
|
|
189
|
+
: projectionDir;
|
|
190
|
+
}
|
|
191
|
+
function sharedOxcSourceRoot() {
|
|
192
|
+
const projectionDir = path.dirname(fileURLToPath(import.meta.url));
|
|
193
|
+
const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
|
|
194
|
+
return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
|
|
195
|
+
? publishedSharedRoot
|
|
196
|
+
: path.join(projectionDir, "..", "shared", "oxc");
|
|
197
|
+
}
|
|
198
|
+
export const tsLibPresetProjection = {
|
|
199
|
+
metadata: tsLibPresetMetadata,
|
|
200
|
+
capabilities: {
|
|
201
|
+
packageAddition: {
|
|
202
|
+
planPackageAddition({ packageName, packagePath, nodeVersion, }) {
|
|
203
|
+
return packageAdditionPlan(packageName, packagePath, nodeVersion);
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
blueprint: tsLibBlueprint,
|
|
208
|
+
project(context) {
|
|
209
|
+
return interpretPresetProjectionDeclaration({
|
|
210
|
+
preset: tsLibPresetMetadata,
|
|
211
|
+
declaration: loadBuiltInPresetProjectionDeclaration("ts-lib"),
|
|
212
|
+
context,
|
|
213
|
+
sourceRoots: builtInPresetProjectionSourceRoots(),
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
async render({ targetDir, plan }) {
|
|
217
|
+
await renderNewProject({
|
|
218
|
+
sourceRoot: plan.sourceRoot,
|
|
219
|
+
sourceRoots: plan.sourceRoots,
|
|
220
|
+
targetRoot: targetDir,
|
|
221
|
+
operations: [...plan.operations],
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
|
|
2
|
+
import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
|
|
3
|
+
export declare const vueAppPresetMetadata: BuiltInPreset;
|
|
4
|
+
export declare function vueAppBlueprint(options?: PresetBlueprintOptions): ProjectBlueprint;
|
|
5
|
+
export declare function projectVueAppPackageScripts(): Record<string, string>;
|
|
6
|
+
export declare const vueAppPresetProjection: PresetProjection;
|