@ykdz/template 0.0.3 → 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/README.md +1 -1
- package/dist/src/cli.d.ts +0 -1
- package/dist/src/cli.js +26 -2
- package/dist/src/declarations.d.ts +38 -3
- package/dist/src/declarations.js +75 -36
- package/dist/src/dependency-catalog.d.ts +9 -1
- package/dist/src/dependency-catalog.js +69 -0
- package/dist/src/devcontainer.d.ts +49 -9
- package/dist/src/devcontainer.js +192 -14
- package/dist/src/editor-customization.d.ts +0 -1
- package/dist/src/editor-customization.js +54 -47
- package/dist/src/generation-context.d.ts +0 -1
- package/dist/src/generation-context.js +4 -1
- package/dist/src/module-graph.d.ts +8 -5
- package/dist/src/module-graph.js +20 -2
- package/dist/src/next-step-instructions.d.ts +0 -1
- package/dist/src/next-step-instructions.js +35 -0
- 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 +2 -1
- package/dist/src/package-addition.js +557 -55
- package/dist/src/package-linking.d.ts +55 -0
- package/dist/src/package-linking.js +116 -0
- package/dist/src/preset-projection.d.ts +4 -2
- package/dist/src/project-github.d.ts +3 -2
- package/dist/src/project-github.js +24 -6
- package/dist/src/renderer.d.ts +16 -2
- package/dist/src/renderer.js +96 -12
- package/dist/src/runtime-paths.d.ts +0 -1
- package/dist/src/template-boundary-check.d.ts +34 -0
- package/dist/src/template-boundary-check.js +448 -0
- package/dist/src/toolchain-resolution.d.ts +0 -1
- package/dist/templates/hono-api/projection.d.ts +2 -3
- package/dist/templates/hono-api/projection.js +258 -76
- package/dist/templates/projection-plans.d.ts +0 -1
- package/dist/templates/registry.d.ts +0 -1
- package/dist/templates/registry.js +5 -2
- package/dist/templates/rust-bin/projection.d.ts +2 -3
- package/dist/templates/rust-bin/projection.js +171 -53
- package/dist/templates/ts-lib/projection.d.ts +2 -3
- package/dist/templates/ts-lib/projection.js +251 -87
- package/dist/templates/vue-app/projection.d.ts +2 -3
- package/dist/templates/vue-app/projection.js +266 -94
- package/dist/templates/vue-hono-app/projection.d.ts +0 -1
- package/dist/templates/vue-hono-app/projection.js +232 -108
- package/package.json +10 -5
- package/pnpm-workspace.yaml +1 -0
- package/templates/hono-api/.github/dependabot.yml +13 -0
- package/templates/hono-api/src/server.ts +1 -1
- package/templates/hono-api/test/app.test.ts +1 -1
- package/templates/rust-bin/.github/dependabot.yml +18 -1
- package/templates/rust-bin/rust-toolchain.toml +3 -0
- package/templates/rust-bin/rustfmt.toml +2 -0
- package/templates/shared/devcontainer/browser-test.Dockerfile +2 -0
- package/templates/shared/devcontainer/node-pnpm.Dockerfile +6 -0
- package/templates/shared/devcontainer/rust.Dockerfile +16 -0
- package/templates/shared/editor-customization/capabilities.json +56 -0
- package/templates/ts-lib/.github/dependabot.yml +13 -0
- package/templates/ts-lib/src/index.ts +5 -1
- package/templates/ts-lib/src/name-schema.ts +3 -0
- package/templates/vue-app/.github/dependabot.yml +13 -0
- package/templates/vue-app/.github/workflows/check.yml +1 -1
- package/templates/vue-app/src/App.vue +1 -1
- package/templates/vue-app/test/app.test.ts +1 -1
- package/templates/vue-hono-app/.github/dependabot.yml +13 -0
- package/templates/vue-hono-app/web/src/App.vue +2 -2
- package/templates/vue-hono-app/web/test/app.test.ts +1 -1
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/declarations.d.ts.map +0 -1
- package/dist/src/dependency-catalog.d.ts.map +0 -1
- package/dist/src/devcontainer.d.ts.map +0 -1
- package/dist/src/editor-customization.d.ts.map +0 -1
- package/dist/src/generation-context.d.ts.map +0 -1
- package/dist/src/module-graph.d.ts.map +0 -1
- package/dist/src/next-step-instructions.d.ts.map +0 -1
- package/dist/src/package-addition.d.ts.map +0 -1
- package/dist/src/preset-projection.d.ts.map +0 -1
- package/dist/src/project-github.d.ts.map +0 -1
- package/dist/src/renderer.d.ts.map +0 -1
- package/dist/src/runtime-paths.d.ts.map +0 -1
- package/dist/src/toolchain-resolution.d.ts.map +0 -1
- package/dist/templates/hono-api/projection.d.ts.map +0 -1
- package/dist/templates/projection-plans.d.ts.map +0 -1
- package/dist/templates/registry.d.ts.map +0 -1
- package/dist/templates/rust-bin/projection.d.ts.map +0 -1
- package/dist/templates/ts-lib/projection.d.ts.map +0 -1
- package/dist/templates/vue-app/projection.d.ts.map +0 -1
- package/dist/templates/vue-hono-app/projection.d.ts.map +0 -1
- package/templates/hono-api/projection.ts +0 -453
- package/templates/projection-plans.ts +0 -135
- package/templates/registry.ts +0 -59
- package/templates/rust-bin/projection.ts +0 -346
- package/templates/ts-lib/projection.ts +0 -454
- package/templates/vue-app/projection.ts +0 -687
- package/templates/vue-hono-app/projection.ts +0 -669
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { renderGeneratedPnpmWorkspaceYaml } from "../../src/dependency-catalog.js";
|
|
5
|
-
import {
|
|
4
|
+
import { collectGeneratedManifestCatalogDependencies, renderGeneratedPnpmWorkspaceYaml, } from "../../src/dependency-catalog.js";
|
|
5
|
+
import { 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 {
|
|
8
|
+
import { PackageAdditionSupport } from "../../src/package-addition-support.js";
|
|
9
|
+
import { packageManifestExposureFields, planPackageLinks, } from "../../src/package-linking.js";
|
|
9
10
|
import { renderNewProject } from "../../src/renderer.js";
|
|
10
11
|
const generatedBy = {
|
|
11
12
|
packageName: "@ykdz/template",
|
|
@@ -18,7 +19,8 @@ export const tsLibPresetMetadata = {
|
|
|
18
19
|
description: "Strict TypeScript package with pnpm catalog tooling.",
|
|
19
20
|
generation: "supported",
|
|
20
21
|
supportedPackageManagers: ["pnpm"],
|
|
21
|
-
supportedProjectKinds: ["
|
|
22
|
+
supportedProjectKinds: ["multi-package"],
|
|
23
|
+
packageAdditionSupport: PackageAdditionSupport.Supported,
|
|
22
24
|
features: [
|
|
23
25
|
"pnpm-catalog",
|
|
24
26
|
"oxc-format-lint",
|
|
@@ -31,14 +33,22 @@ export const tsLibPresetMetadata = {
|
|
|
31
33
|
],
|
|
32
34
|
};
|
|
33
35
|
const dependencyMaintenancePolicy = {
|
|
34
|
-
ecosystems: ["npm", "github-actions"],
|
|
36
|
+
ecosystems: ["npm", "github-actions", "docker"],
|
|
35
37
|
interval: "weekly",
|
|
36
38
|
};
|
|
37
39
|
const tsLibPackageBoundary = {
|
|
38
40
|
kind: "package-boundary",
|
|
39
41
|
path: ".",
|
|
40
42
|
};
|
|
41
|
-
|
|
43
|
+
const tsLibRootBoundary = {
|
|
44
|
+
kind: "workspace-orchestration",
|
|
45
|
+
path: ".",
|
|
46
|
+
};
|
|
47
|
+
const tsLibWorkspacePackageBoundary = {
|
|
48
|
+
kind: "package-boundary",
|
|
49
|
+
path: "packages/*",
|
|
50
|
+
};
|
|
51
|
+
function planTsLibPackageChecks() {
|
|
42
52
|
return {
|
|
43
53
|
components: [
|
|
44
54
|
{ kind: "typescript-typecheck", owner: tsLibPackageBoundary },
|
|
@@ -48,7 +58,19 @@ function planTsLibChecks() {
|
|
|
48
58
|
environmentNeeds: [],
|
|
49
59
|
};
|
|
50
60
|
}
|
|
51
|
-
function
|
|
61
|
+
function planTsLibRootChecks() {
|
|
62
|
+
return {
|
|
63
|
+
components: [
|
|
64
|
+
{ kind: "oxc-format-check", owner: tsLibRootBoundary },
|
|
65
|
+
{ kind: "oxc-lint", owner: tsLibRootBoundary },
|
|
66
|
+
{ kind: "typescript-typecheck", owner: tsLibRootBoundary },
|
|
67
|
+
{ kind: "turbo-package-typecheck", owner: tsLibWorkspacePackageBoundary },
|
|
68
|
+
{ kind: "turbo-package-check", owner: tsLibWorkspacePackageBoundary },
|
|
69
|
+
],
|
|
70
|
+
environmentNeeds: [],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function planTsLibPackageFixes() {
|
|
52
74
|
return {
|
|
53
75
|
components: [
|
|
54
76
|
{ kind: "oxc-format-write", owner: tsLibPackageBoundary },
|
|
@@ -56,48 +78,84 @@ function planTsLibFixes() {
|
|
|
56
78
|
],
|
|
57
79
|
};
|
|
58
80
|
}
|
|
59
|
-
|
|
81
|
+
function planTsLibRootFixes() {
|
|
82
|
+
return {
|
|
83
|
+
components: [
|
|
84
|
+
{ kind: "oxc-format-write", owner: tsLibRootBoundary },
|
|
85
|
+
{ kind: "oxc-lint-fix", owner: tsLibRootBoundary },
|
|
86
|
+
{ kind: "turbo-package-fix", owner: tsLibWorkspacePackageBoundary },
|
|
87
|
+
],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function projectNameFromDir(targetDir) {
|
|
91
|
+
return path.basename(path.resolve(targetDir));
|
|
92
|
+
}
|
|
93
|
+
function packageScopeFromOptions(options) {
|
|
94
|
+
return options.scope ?? projectNameFromDir(options.targetDir);
|
|
95
|
+
}
|
|
96
|
+
function packageName(packageScope, packageLeafName) {
|
|
97
|
+
return `@${packageScope}/${packageLeafName}`;
|
|
98
|
+
}
|
|
99
|
+
export function tsLibBlueprint(options = { targetDir: process.cwd() }) {
|
|
100
|
+
const packageScope = packageScopeFromOptions(options);
|
|
101
|
+
const packageLeafName = projectNameFromDir(options.targetDir);
|
|
60
102
|
return {
|
|
61
103
|
schemaVersion: 1,
|
|
62
104
|
preset: "ts-lib",
|
|
63
105
|
packageManager: "pnpm",
|
|
64
|
-
projectKind: "
|
|
106
|
+
projectKind: "multi-package",
|
|
65
107
|
features: [...tsLibPresetMetadata.features],
|
|
108
|
+
packages: [
|
|
109
|
+
{
|
|
110
|
+
name: packageName(packageScope, packageLeafName),
|
|
111
|
+
path: `packages/${packageLeafName}`,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function workspacePackagePath(context) {
|
|
117
|
+
return `packages/${context.projectName.value}`;
|
|
118
|
+
}
|
|
119
|
+
function workspacePackageName(context) {
|
|
120
|
+
const packageDefinition = context.blueprint.packages?.find((pkg) => pkg.path === workspacePackagePath(context));
|
|
121
|
+
return (packageDefinition?.name ??
|
|
122
|
+
packageName(context.projectName.value, context.projectName.value));
|
|
123
|
+
}
|
|
124
|
+
function projectTsLibRootPackageScripts() {
|
|
125
|
+
return {
|
|
126
|
+
check: renderRootCheckCommand(planTsLibRootChecks()),
|
|
127
|
+
fix: renderFixCommand(planTsLibRootFixes()),
|
|
128
|
+
"format:check": "oxfmt --check --config oxfmt.config.ts oxlint.config.ts oxfmt.config.ts",
|
|
129
|
+
"format:write": "oxfmt --write --config oxfmt.config.ts oxlint.config.ts oxfmt.config.ts",
|
|
130
|
+
lint: "oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --deny-warnings",
|
|
131
|
+
"lint:fix": "oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --fix --deny-warnings",
|
|
132
|
+
typecheck: "tsc -p tsconfig.config.json --noEmit",
|
|
66
133
|
};
|
|
67
134
|
}
|
|
68
135
|
export function projectTsLibPackageScripts() {
|
|
69
|
-
const checkPlan =
|
|
70
|
-
const fixPlan =
|
|
136
|
+
const checkPlan = planTsLibPackageChecks();
|
|
137
|
+
const fixPlan = planTsLibPackageFixes();
|
|
71
138
|
return {
|
|
72
|
-
build: "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
|
|
73
139
|
check: renderRootCheckCommand(checkPlan),
|
|
74
140
|
fix: renderFixCommand(fixPlan),
|
|
75
|
-
"format:check": "oxfmt --check .",
|
|
76
|
-
"format:write": "oxfmt --write .",
|
|
77
|
-
lint: "oxlint . --deny-warnings",
|
|
78
|
-
"lint:fix": "oxlint . --fix --deny-warnings",
|
|
141
|
+
"format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
|
|
142
|
+
"format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
143
|
+
lint: "oxlint --config ../../oxlint.config.ts . --deny-warnings",
|
|
144
|
+
"lint:fix": "oxlint --config ../../oxlint.config.ts . --fix --deny-warnings",
|
|
79
145
|
typecheck: "tsc -p tsconfig.json --noEmit",
|
|
80
146
|
};
|
|
81
147
|
}
|
|
82
|
-
function
|
|
148
|
+
function rootPackageJson(context, packageScripts) {
|
|
83
149
|
return {
|
|
84
150
|
name: context.projectName.value,
|
|
85
151
|
version: "0.0.0",
|
|
86
152
|
private: true,
|
|
87
|
-
files: ["dist"],
|
|
88
153
|
type: "module",
|
|
89
|
-
exports: {
|
|
90
|
-
".": {
|
|
91
|
-
default: "./dist/index.js",
|
|
92
|
-
types: "./dist/index.d.ts",
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
154
|
scripts: packageScripts,
|
|
96
155
|
devDependencies: {
|
|
97
|
-
"@types/node": "catalog:",
|
|
98
156
|
oxfmt: "catalog:",
|
|
99
157
|
oxlint: "catalog:",
|
|
100
|
-
|
|
158
|
+
turbo: "catalog:",
|
|
101
159
|
typescript: "catalog:",
|
|
102
160
|
},
|
|
103
161
|
engines: {
|
|
@@ -106,6 +164,30 @@ function packageJson(context, packageScripts) {
|
|
|
106
164
|
packageManager: context.toolchain.packageManagerPin.value,
|
|
107
165
|
};
|
|
108
166
|
}
|
|
167
|
+
function libraryPackageJson(context, exposure) {
|
|
168
|
+
const exposureFields = packageManifestExposureFields(exposure);
|
|
169
|
+
return {
|
|
170
|
+
name: workspacePackageName(context),
|
|
171
|
+
version: "0.0.0",
|
|
172
|
+
private: true,
|
|
173
|
+
type: "module",
|
|
174
|
+
imports: exposureFields.imports,
|
|
175
|
+
exports: exposureFields.exports,
|
|
176
|
+
dependencies: {
|
|
177
|
+
valibot: "catalog:",
|
|
178
|
+
},
|
|
179
|
+
scripts: projectTsLibPackageScripts(),
|
|
180
|
+
devDependencies: {
|
|
181
|
+
"@types/node": "catalog:",
|
|
182
|
+
oxfmt: "catalog:",
|
|
183
|
+
oxlint: "catalog:",
|
|
184
|
+
typescript: "catalog:",
|
|
185
|
+
},
|
|
186
|
+
engines: {
|
|
187
|
+
node: context.toolchain.nodeLtsMajor.value,
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
109
191
|
function generationRecord(context) {
|
|
110
192
|
return {
|
|
111
193
|
...generatedBy,
|
|
@@ -120,40 +202,101 @@ function operationsForTsLib(context, packageScripts, checkPlan) {
|
|
|
120
202
|
const editorCustomization = editorCustomizationForCapabilities([
|
|
121
203
|
"oxc-format-lint",
|
|
122
204
|
]);
|
|
205
|
+
const developmentContainer = checkedDockerfileFirstNodePnpmDevcontainer({
|
|
206
|
+
name: context.projectName.value,
|
|
207
|
+
layer: nodePnpmToolLayer({
|
|
208
|
+
nodeVersion: context.toolchain.nodeLtsMajor.value,
|
|
209
|
+
packageManagerPin: context.toolchain.packageManagerPin.value,
|
|
210
|
+
}),
|
|
211
|
+
extensions: editorCustomization.extensions,
|
|
212
|
+
settings: editorCustomization.settings,
|
|
213
|
+
});
|
|
214
|
+
const rootManifest = rootPackageJson(context, packageScripts);
|
|
215
|
+
const packageLinkPlan = planPackageLinks([
|
|
216
|
+
{
|
|
217
|
+
name: workspacePackageName(context),
|
|
218
|
+
path: workspacePackagePath(context),
|
|
219
|
+
role: "shared-library",
|
|
220
|
+
sourcePreset: "ts-lib",
|
|
221
|
+
},
|
|
222
|
+
]);
|
|
223
|
+
const packageExposure = packageLinkPlan.exposuresByPackagePath.get(workspacePackagePath(context));
|
|
224
|
+
if (packageExposure === undefined) {
|
|
225
|
+
throw new Error(`Missing Package Exposure for ${workspacePackagePath(context)}`);
|
|
226
|
+
}
|
|
227
|
+
const packageManifest = libraryPackageJson(context, packageExposure);
|
|
123
228
|
return [
|
|
124
229
|
{
|
|
125
230
|
kind: "writeJson",
|
|
126
231
|
to: "package.json",
|
|
127
|
-
value:
|
|
128
|
-
multilineArrays: ["files"],
|
|
232
|
+
value: rootManifest,
|
|
129
233
|
},
|
|
130
234
|
{
|
|
131
235
|
kind: "writeText",
|
|
132
236
|
to: "pnpm-workspace.yaml",
|
|
133
237
|
text: renderGeneratedPnpmWorkspaceYaml({
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"typescript",
|
|
140
|
-
],
|
|
238
|
+
packages: ["packages/*"],
|
|
239
|
+
dependencies: collectGeneratedManifestCatalogDependencies([
|
|
240
|
+
rootManifest,
|
|
241
|
+
packageManifest,
|
|
242
|
+
]),
|
|
141
243
|
}),
|
|
142
244
|
},
|
|
245
|
+
{
|
|
246
|
+
kind: "writeJson",
|
|
247
|
+
to: "turbo.json",
|
|
248
|
+
value: {
|
|
249
|
+
tasks: {
|
|
250
|
+
build: packageLinkPlan.turboTasks.build,
|
|
251
|
+
check: packageLinkPlan.turboTasks.check,
|
|
252
|
+
typecheck: packageLinkPlan.turboTasks.typecheck,
|
|
253
|
+
test: packageLinkPlan.turboTasks.test,
|
|
254
|
+
"test:e2e": packageLinkPlan.turboTasks["test:e2e"],
|
|
255
|
+
fix: {
|
|
256
|
+
cache: false,
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
143
261
|
{
|
|
144
262
|
kind: "writeJson",
|
|
145
263
|
to: "tsconfig.json",
|
|
264
|
+
value: {
|
|
265
|
+
files: [],
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
kind: "writeJson",
|
|
270
|
+
to: "tsconfig.config.json",
|
|
271
|
+
value: {
|
|
272
|
+
compilerOptions: {
|
|
273
|
+
module: "NodeNext",
|
|
274
|
+
moduleResolution: "NodeNext",
|
|
275
|
+
noEmitOnError: true,
|
|
276
|
+
skipLibCheck: false,
|
|
277
|
+
strict: true,
|
|
278
|
+
target: "ES2022",
|
|
279
|
+
},
|
|
280
|
+
include: ["oxlint.config.ts", "oxfmt.config.ts"],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
kind: "writeJson",
|
|
285
|
+
to: `${workspacePackagePath(context)}/package.json`,
|
|
286
|
+
value: packageManifest,
|
|
287
|
+
multilineArrays: ["files"],
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
kind: "writeJson",
|
|
291
|
+
to: `${workspacePackagePath(context)}/tsconfig.json`,
|
|
146
292
|
value: {
|
|
147
293
|
compilerOptions: {
|
|
294
|
+
composite: true,
|
|
148
295
|
declaration: true,
|
|
149
296
|
declarationMap: true,
|
|
150
297
|
module: "NodeNext",
|
|
151
298
|
moduleResolution: "NodeNext",
|
|
152
299
|
noEmitOnError: true,
|
|
153
|
-
outDir: "dist",
|
|
154
|
-
paths: {
|
|
155
|
-
"@/*": ["./src/*"],
|
|
156
|
-
},
|
|
157
300
|
rootDir: "src",
|
|
158
301
|
skipLibCheck: false,
|
|
159
302
|
strict: true,
|
|
@@ -178,33 +321,45 @@ function operationsForTsLib(context, packageScripts, checkPlan) {
|
|
|
178
321
|
{
|
|
179
322
|
kind: "writeText",
|
|
180
323
|
to: ".gitignore",
|
|
181
|
-
text: [
|
|
324
|
+
text: [
|
|
325
|
+
"node_modules",
|
|
326
|
+
"dist",
|
|
327
|
+
".env",
|
|
328
|
+
".template/",
|
|
329
|
+
".pnpm-store/",
|
|
330
|
+
"",
|
|
331
|
+
].join("\n"),
|
|
182
332
|
},
|
|
183
333
|
{
|
|
184
334
|
kind: "copyFile",
|
|
185
335
|
from: "src/index.ts",
|
|
186
|
-
to:
|
|
336
|
+
to: `${workspacePackagePath(context)}/src/index.ts`,
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
kind: "copyFile",
|
|
340
|
+
from: "src/name-schema.ts",
|
|
341
|
+
to: `${workspacePackagePath(context)}/src/name-schema.ts`,
|
|
187
342
|
},
|
|
188
343
|
{
|
|
189
344
|
kind: "writeJson",
|
|
190
|
-
to: ".
|
|
191
|
-
value:
|
|
345
|
+
to: ".template/blueprint.json",
|
|
346
|
+
value: context.blueprint,
|
|
192
347
|
},
|
|
193
348
|
{
|
|
194
349
|
kind: "writeJson",
|
|
195
|
-
to: ".
|
|
350
|
+
to: ".template/generated-by.json",
|
|
196
351
|
value: generationRecord(context),
|
|
197
352
|
},
|
|
198
353
|
{
|
|
199
354
|
kind: "writeJson",
|
|
200
355
|
to: ".devcontainer/devcontainer.json",
|
|
201
|
-
value:
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
356
|
+
value: developmentContainer.devcontainer,
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
kind: "copyFile",
|
|
360
|
+
sourceRoot: "sharedDevcontainer",
|
|
361
|
+
from: "node-pnpm.Dockerfile",
|
|
362
|
+
to: ".devcontainer/Dockerfile",
|
|
208
363
|
},
|
|
209
364
|
{
|
|
210
365
|
kind: "writeJson",
|
|
@@ -220,18 +375,30 @@ function operationsForTsLib(context, packageScripts, checkPlan) {
|
|
|
220
375
|
value: editorCustomization.settings,
|
|
221
376
|
},
|
|
222
377
|
{
|
|
223
|
-
kind: "
|
|
378
|
+
kind: "copyFile",
|
|
379
|
+
from: ".github/workflows/check.yml",
|
|
224
380
|
to: ".github/workflows/check.yml",
|
|
225
|
-
text: projectCheckWorkflow({ checkPlan }),
|
|
226
381
|
},
|
|
227
382
|
{
|
|
228
|
-
kind: "
|
|
383
|
+
kind: "copyFile",
|
|
384
|
+
from: ".github/dependabot.yml",
|
|
229
385
|
to: ".github/dependabot.yml",
|
|
230
|
-
text: projectDependabotConfig(dependencyMaintenancePolicy),
|
|
231
386
|
},
|
|
232
387
|
];
|
|
233
388
|
}
|
|
234
389
|
function packageAdditionOperations(packagePath, packageName, nodeVersion) {
|
|
390
|
+
const packageExposure = planPackageLinks([
|
|
391
|
+
{
|
|
392
|
+
name: packageName,
|
|
393
|
+
path: packagePath,
|
|
394
|
+
role: "shared-library",
|
|
395
|
+
sourcePreset: "ts-lib",
|
|
396
|
+
},
|
|
397
|
+
]).exposuresByPackagePath.get(packagePath);
|
|
398
|
+
if (packageExposure === undefined) {
|
|
399
|
+
throw new Error(`Missing Package Exposure for ${packagePath}`);
|
|
400
|
+
}
|
|
401
|
+
const exposureFields = packageManifestExposureFields(packageExposure);
|
|
235
402
|
return [
|
|
236
403
|
{
|
|
237
404
|
kind: "writeJson",
|
|
@@ -240,20 +407,17 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
|
|
|
240
407
|
name: packageName,
|
|
241
408
|
version: "0.0.0",
|
|
242
409
|
private: true,
|
|
243
|
-
files: ["dist"],
|
|
244
410
|
type: "module",
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
},
|
|
411
|
+
imports: exposureFields.imports,
|
|
412
|
+
exports: exposureFields.exports,
|
|
413
|
+
dependencies: {
|
|
414
|
+
valibot: "catalog:",
|
|
250
415
|
},
|
|
251
416
|
scripts: projectTsLibPackageScripts(),
|
|
252
417
|
devDependencies: {
|
|
253
418
|
"@types/node": "catalog:",
|
|
254
419
|
oxfmt: "catalog:",
|
|
255
420
|
oxlint: "catalog:",
|
|
256
|
-
"tsc-alias": "catalog:",
|
|
257
421
|
typescript: "catalog:",
|
|
258
422
|
},
|
|
259
423
|
engines: {
|
|
@@ -273,10 +437,6 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
|
|
|
273
437
|
module: "NodeNext",
|
|
274
438
|
moduleResolution: "NodeNext",
|
|
275
439
|
noEmitOnError: true,
|
|
276
|
-
outDir: "dist",
|
|
277
|
-
paths: {
|
|
278
|
-
"@/*": ["./src/*"],
|
|
279
|
-
},
|
|
280
440
|
rootDir: "src",
|
|
281
441
|
skipLibCheck: false,
|
|
282
442
|
strict: true,
|
|
@@ -288,29 +448,23 @@ function packageAdditionOperations(packagePath, packageName, nodeVersion) {
|
|
|
288
448
|
},
|
|
289
449
|
{
|
|
290
450
|
kind: "copyFile",
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
to: `${packagePath}/oxlint.config.ts`,
|
|
451
|
+
from: "src/index.ts",
|
|
452
|
+
to: `${packagePath}/src/index.ts`,
|
|
294
453
|
},
|
|
295
454
|
{
|
|
296
455
|
kind: "copyFile",
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
to: `${packagePath}/oxfmt.config.ts`,
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
kind: "copyFile",
|
|
303
|
-
from: "src/index.ts",
|
|
304
|
-
to: `${packagePath}/src/index.ts`,
|
|
456
|
+
from: "src/name-schema.ts",
|
|
457
|
+
to: `${packagePath}/src/name-schema.ts`,
|
|
305
458
|
},
|
|
306
459
|
];
|
|
307
460
|
}
|
|
308
|
-
function packageAdditionPlan(
|
|
309
|
-
const
|
|
461
|
+
function packageAdditionPlan(packageName, packagePath, nodeVersion) {
|
|
462
|
+
const [workspaceCollection] = packagePath.split("/");
|
|
310
463
|
return {
|
|
311
464
|
packagePath,
|
|
312
|
-
workspacePackageGlob:
|
|
313
|
-
|
|
465
|
+
workspacePackageGlob: `${workspaceCollection}/*`,
|
|
466
|
+
packageRole: "shared-library",
|
|
467
|
+
packageSourcePreset: "ts-lib",
|
|
314
468
|
sourceRoot: templateSourceRoot(),
|
|
315
469
|
sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
|
|
316
470
|
operations: packageAdditionOperations(packagePath, packageName, nodeVersion),
|
|
@@ -330,23 +484,33 @@ function sharedOxcSourceRoot() {
|
|
|
330
484
|
? publishedSharedRoot
|
|
331
485
|
: path.join(projectionDir, "..", "shared", "oxc");
|
|
332
486
|
}
|
|
487
|
+
function sharedDevcontainerSourceRoot() {
|
|
488
|
+
const projectionDir = path.dirname(fileURLToPath(import.meta.url));
|
|
489
|
+
const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "devcontainer");
|
|
490
|
+
return existsSync(path.join(publishedSharedRoot, "node-pnpm.Dockerfile"))
|
|
491
|
+
? publishedSharedRoot
|
|
492
|
+
: path.join(projectionDir, "..", "shared", "devcontainer");
|
|
493
|
+
}
|
|
333
494
|
export const tsLibPresetProjection = {
|
|
334
495
|
metadata: tsLibPresetMetadata,
|
|
335
496
|
capabilities: {
|
|
336
497
|
packageAddition: {
|
|
337
|
-
planPackageAddition({
|
|
338
|
-
return packageAdditionPlan(
|
|
498
|
+
planPackageAddition({ packageName, packagePath, nodeVersion, }) {
|
|
499
|
+
return packageAdditionPlan(packageName, packagePath, nodeVersion);
|
|
339
500
|
},
|
|
340
501
|
},
|
|
341
502
|
},
|
|
342
503
|
blueprint: tsLibBlueprint,
|
|
343
504
|
project(context) {
|
|
344
|
-
const checkPlan =
|
|
345
|
-
const fixPlan =
|
|
346
|
-
const packageScripts =
|
|
505
|
+
const checkPlan = planTsLibRootChecks();
|
|
506
|
+
const fixPlan = planTsLibRootFixes();
|
|
507
|
+
const packageScripts = projectTsLibRootPackageScripts();
|
|
347
508
|
return {
|
|
348
509
|
sourceRoot: templateSourceRoot(),
|
|
349
|
-
sourceRoots: {
|
|
510
|
+
sourceRoots: {
|
|
511
|
+
sharedDevcontainer: sharedDevcontainerSourceRoot(),
|
|
512
|
+
sharedOxc: sharedOxcSourceRoot(),
|
|
513
|
+
},
|
|
350
514
|
operations: operationsForTsLib(context, packageScripts, checkPlan),
|
|
351
515
|
checkPlan,
|
|
352
516
|
fixPlan,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { BuiltInPreset, ProjectBlueprint } from "../../src/declarations.js";
|
|
2
|
-
import type { PresetProjection } from "../../src/preset-projection.js";
|
|
2
|
+
import type { PresetBlueprintOptions, PresetProjection } from "../../src/preset-projection.js";
|
|
3
3
|
export declare const vueAppPresetMetadata: BuiltInPreset;
|
|
4
|
-
export declare function vueAppBlueprint(): ProjectBlueprint;
|
|
4
|
+
export declare function vueAppBlueprint(options?: PresetBlueprintOptions): ProjectBlueprint;
|
|
5
5
|
export declare function projectVueAppPackageScripts(): Record<string, string>;
|
|
6
6
|
export declare const vueAppPresetProjection: PresetProjection;
|
|
7
|
-
//# sourceMappingURL=projection.d.ts.map
|