@ykdz/template 0.0.5 → 0.0.6
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 +65 -32
- package/dist/src/declarations.js +2 -2
- package/dist/src/generated-scenarios.d.ts +62 -0
- package/dist/src/generated-scenarios.js +361 -0
- package/dist/src/package-addition.js +22 -29
- package/dist/src/preset-projection.d.ts +1 -0
- package/dist/src/preset-source.d.ts +430 -0
- package/dist/src/preset-source.js +940 -0
- package/dist/src/projection-capabilities.d.ts +67 -0
- package/dist/src/projection-capabilities.js +2207 -0
- package/dist/src/renderer.js +19 -1
- package/dist/src/template-boundary-check.d.ts +7 -3
- package/dist/src/template-boundary-check.js +104 -10
- package/package.json +3 -2
- package/templates/preset-source.json +499 -0
- package/templates/vue-app/playwright.package-addition.config.ts +22 -0
- package/dist/templates/hono-api/projection.d.ts +0 -6
- package/dist/templates/hono-api/projection.js +0 -559
- package/dist/templates/projection-plans.d.ts +0 -7
- package/dist/templates/projection-plans.js +0 -94
- package/dist/templates/registry.d.ts +0 -7
- package/dist/templates/registry.js +0 -45
- package/dist/templates/rust-bin/projection.d.ts +0 -9
- package/dist/templates/rust-bin/projection.js +0 -400
- package/dist/templates/ts-lib/projection.d.ts +0 -6
- package/dist/templates/ts-lib/projection.js +0 -536
- package/dist/templates/vue-app/projection.d.ts +0 -6
- package/dist/templates/vue-app/projection.js +0 -766
- package/dist/templates/vue-hono-app/projection.d.ts +0 -8
- package/dist/templates/vue-hono-app/projection.js +0 -713
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { collectGeneratedManifestCatalogDependencies, renderGeneratedPnpmWorkspaceYaml, } from "../../src/dependency-catalog.js";
|
|
5
|
-
import { checkedDockerfileFirstNodePnpmDevcontainer, nodePnpmToolLayer, } from "../../src/devcontainer.js";
|
|
6
|
-
import { editorCustomizationForCapabilities } from "../../src/editor-customization.js";
|
|
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";
|
|
10
|
-
import { renderNewProject } from "../../src/renderer.js";
|
|
11
|
-
const generatedBy = {
|
|
12
|
-
packageName: "@ykdz/template",
|
|
13
|
-
version: "0.0.0",
|
|
14
|
-
command: "template init --preset ts-lib",
|
|
15
|
-
};
|
|
16
|
-
export const tsLibPresetMetadata = {
|
|
17
|
-
name: "ts-lib",
|
|
18
|
-
title: "TypeScript library",
|
|
19
|
-
description: "Strict TypeScript package with pnpm catalog tooling.",
|
|
20
|
-
generation: "supported",
|
|
21
|
-
supportedPackageManagers: ["pnpm"],
|
|
22
|
-
supportedProjectKinds: ["multi-package"],
|
|
23
|
-
packageAdditionSupport: PackageAdditionSupport.Supported,
|
|
24
|
-
features: [
|
|
25
|
-
"pnpm-catalog",
|
|
26
|
-
"oxc-format-lint",
|
|
27
|
-
"strict-typescript",
|
|
28
|
-
"root-check",
|
|
29
|
-
"fix-command",
|
|
30
|
-
"devcontainer",
|
|
31
|
-
"github-actions",
|
|
32
|
-
"dependabot",
|
|
33
|
-
],
|
|
34
|
-
};
|
|
35
|
-
const dependencyMaintenancePolicy = {
|
|
36
|
-
ecosystems: ["npm", "github-actions", "docker"],
|
|
37
|
-
interval: "weekly",
|
|
38
|
-
};
|
|
39
|
-
const tsLibPackageBoundary = {
|
|
40
|
-
kind: "package-boundary",
|
|
41
|
-
path: ".",
|
|
42
|
-
};
|
|
43
|
-
const tsLibRootBoundary = {
|
|
44
|
-
kind: "workspace-orchestration",
|
|
45
|
-
path: ".",
|
|
46
|
-
};
|
|
47
|
-
const tsLibWorkspacePackageBoundary = {
|
|
48
|
-
kind: "package-boundary",
|
|
49
|
-
path: "packages/*",
|
|
50
|
-
};
|
|
51
|
-
function planTsLibPackageChecks() {
|
|
52
|
-
return {
|
|
53
|
-
components: [
|
|
54
|
-
{ kind: "typescript-typecheck", owner: tsLibPackageBoundary },
|
|
55
|
-
{ kind: "oxc-lint", owner: tsLibPackageBoundary },
|
|
56
|
-
{ kind: "oxc-format-check", owner: tsLibPackageBoundary },
|
|
57
|
-
],
|
|
58
|
-
environmentNeeds: [],
|
|
59
|
-
};
|
|
60
|
-
}
|
|
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() {
|
|
74
|
-
return {
|
|
75
|
-
components: [
|
|
76
|
-
{ kind: "oxc-format-write", owner: tsLibPackageBoundary },
|
|
77
|
-
{ kind: "oxc-lint-fix", owner: tsLibPackageBoundary },
|
|
78
|
-
],
|
|
79
|
-
};
|
|
80
|
-
}
|
|
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);
|
|
102
|
-
return {
|
|
103
|
-
schemaVersion: 1,
|
|
104
|
-
preset: "ts-lib",
|
|
105
|
-
packageManager: "pnpm",
|
|
106
|
-
projectKind: "multi-package",
|
|
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",
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
export function projectTsLibPackageScripts() {
|
|
136
|
-
const checkPlan = planTsLibPackageChecks();
|
|
137
|
-
const fixPlan = planTsLibPackageFixes();
|
|
138
|
-
return {
|
|
139
|
-
check: renderRootCheckCommand(checkPlan),
|
|
140
|
-
fix: renderFixCommand(fixPlan),
|
|
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",
|
|
145
|
-
typecheck: "tsc -p tsconfig.json --noEmit",
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
function rootPackageJson(context, packageScripts) {
|
|
149
|
-
return {
|
|
150
|
-
name: context.projectName.value,
|
|
151
|
-
version: "0.0.0",
|
|
152
|
-
private: true,
|
|
153
|
-
type: "module",
|
|
154
|
-
scripts: packageScripts,
|
|
155
|
-
devDependencies: {
|
|
156
|
-
oxfmt: "catalog:",
|
|
157
|
-
oxlint: "catalog:",
|
|
158
|
-
turbo: "catalog:",
|
|
159
|
-
typescript: "catalog:",
|
|
160
|
-
},
|
|
161
|
-
engines: {
|
|
162
|
-
node: context.toolchain.nodeLtsMajor.value,
|
|
163
|
-
},
|
|
164
|
-
packageManager: context.toolchain.packageManagerPin.value,
|
|
165
|
-
};
|
|
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
|
-
}
|
|
191
|
-
function generationRecord(context) {
|
|
192
|
-
return {
|
|
193
|
-
...generatedBy,
|
|
194
|
-
toolchain: {
|
|
195
|
-
nodeLtsMajor: context.toolchain.nodeLtsMajor.value,
|
|
196
|
-
packageManagerPin: context.toolchain.packageManagerPin.value,
|
|
197
|
-
source: context.toolchain.source,
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
function operationsForTsLib(context, packageScripts, checkPlan) {
|
|
202
|
-
const editorCustomization = editorCustomizationForCapabilities([
|
|
203
|
-
"oxc-format-lint",
|
|
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);
|
|
228
|
-
return [
|
|
229
|
-
{
|
|
230
|
-
kind: "writeJson",
|
|
231
|
-
to: "package.json",
|
|
232
|
-
value: rootManifest,
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
kind: "writeText",
|
|
236
|
-
to: "pnpm-workspace.yaml",
|
|
237
|
-
text: renderGeneratedPnpmWorkspaceYaml({
|
|
238
|
-
packages: ["packages/*"],
|
|
239
|
-
dependencies: collectGeneratedManifestCatalogDependencies([
|
|
240
|
-
rootManifest,
|
|
241
|
-
packageManifest,
|
|
242
|
-
]),
|
|
243
|
-
}),
|
|
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
|
-
},
|
|
261
|
-
{
|
|
262
|
-
kind: "writeJson",
|
|
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`,
|
|
292
|
-
value: {
|
|
293
|
-
compilerOptions: {
|
|
294
|
-
composite: true,
|
|
295
|
-
declaration: true,
|
|
296
|
-
declarationMap: true,
|
|
297
|
-
module: "NodeNext",
|
|
298
|
-
moduleResolution: "NodeNext",
|
|
299
|
-
noEmitOnError: true,
|
|
300
|
-
rootDir: "src",
|
|
301
|
-
skipLibCheck: false,
|
|
302
|
-
strict: true,
|
|
303
|
-
target: "ES2022",
|
|
304
|
-
types: ["node"],
|
|
305
|
-
},
|
|
306
|
-
include: ["src/**/*.ts"],
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
kind: "copyFile",
|
|
311
|
-
sourceRoot: "sharedOxc",
|
|
312
|
-
from: "node/oxlint.config.ts",
|
|
313
|
-
to: "oxlint.config.ts",
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
kind: "copyFile",
|
|
317
|
-
sourceRoot: "sharedOxc",
|
|
318
|
-
from: "oxfmt.config.ts",
|
|
319
|
-
to: "oxfmt.config.ts",
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
kind: "writeText",
|
|
323
|
-
to: ".gitignore",
|
|
324
|
-
text: [
|
|
325
|
-
"node_modules",
|
|
326
|
-
"dist",
|
|
327
|
-
".env",
|
|
328
|
-
".template/",
|
|
329
|
-
".pnpm-store/",
|
|
330
|
-
"",
|
|
331
|
-
].join("\n"),
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
kind: "copyFile",
|
|
335
|
-
from: "src/index.ts",
|
|
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`,
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
kind: "writeJson",
|
|
345
|
-
to: ".template/blueprint.json",
|
|
346
|
-
value: context.blueprint,
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
kind: "writeJson",
|
|
350
|
-
to: ".template/generated-by.json",
|
|
351
|
-
value: generationRecord(context),
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
kind: "writeJson",
|
|
355
|
-
to: ".devcontainer/devcontainer.json",
|
|
356
|
-
value: developmentContainer.devcontainer,
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
kind: "copyFile",
|
|
360
|
-
sourceRoot: "sharedDevcontainer",
|
|
361
|
-
from: "node-pnpm.Dockerfile",
|
|
362
|
-
to: ".devcontainer/Dockerfile",
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
kind: "writeJson",
|
|
366
|
-
to: ".vscode/extensions.json",
|
|
367
|
-
value: {
|
|
368
|
-
recommendations: editorCustomization.extensions,
|
|
369
|
-
},
|
|
370
|
-
multilineArrays: ["recommendations"],
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
kind: "writeJson",
|
|
374
|
-
to: ".vscode/settings.json",
|
|
375
|
-
value: editorCustomization.settings,
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
kind: "copyFile",
|
|
379
|
-
from: ".github/workflows/check.yml",
|
|
380
|
-
to: ".github/workflows/check.yml",
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
kind: "copyFile",
|
|
384
|
-
from: ".github/dependabot.yml",
|
|
385
|
-
to: ".github/dependabot.yml",
|
|
386
|
-
},
|
|
387
|
-
];
|
|
388
|
-
}
|
|
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);
|
|
402
|
-
return [
|
|
403
|
-
{
|
|
404
|
-
kind: "writeJson",
|
|
405
|
-
to: `${packagePath}/package.json`,
|
|
406
|
-
value: {
|
|
407
|
-
name: packageName,
|
|
408
|
-
version: "0.0.0",
|
|
409
|
-
private: true,
|
|
410
|
-
type: "module",
|
|
411
|
-
imports: exposureFields.imports,
|
|
412
|
-
exports: exposureFields.exports,
|
|
413
|
-
dependencies: {
|
|
414
|
-
valibot: "catalog:",
|
|
415
|
-
},
|
|
416
|
-
scripts: projectTsLibPackageScripts(),
|
|
417
|
-
devDependencies: {
|
|
418
|
-
"@types/node": "catalog:",
|
|
419
|
-
oxfmt: "catalog:",
|
|
420
|
-
oxlint: "catalog:",
|
|
421
|
-
typescript: "catalog:",
|
|
422
|
-
},
|
|
423
|
-
engines: {
|
|
424
|
-
node: nodeVersion,
|
|
425
|
-
},
|
|
426
|
-
},
|
|
427
|
-
multilineArrays: ["files"],
|
|
428
|
-
},
|
|
429
|
-
{
|
|
430
|
-
kind: "writeJson",
|
|
431
|
-
to: `${packagePath}/tsconfig.json`,
|
|
432
|
-
value: {
|
|
433
|
-
compilerOptions: {
|
|
434
|
-
composite: true,
|
|
435
|
-
declaration: true,
|
|
436
|
-
declarationMap: true,
|
|
437
|
-
module: "NodeNext",
|
|
438
|
-
moduleResolution: "NodeNext",
|
|
439
|
-
noEmitOnError: true,
|
|
440
|
-
rootDir: "src",
|
|
441
|
-
skipLibCheck: false,
|
|
442
|
-
strict: true,
|
|
443
|
-
target: "ES2022",
|
|
444
|
-
types: ["node"],
|
|
445
|
-
},
|
|
446
|
-
include: ["src/**/*.ts"],
|
|
447
|
-
},
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
kind: "copyFile",
|
|
451
|
-
from: "src/index.ts",
|
|
452
|
-
to: `${packagePath}/src/index.ts`,
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
kind: "copyFile",
|
|
456
|
-
from: "src/name-schema.ts",
|
|
457
|
-
to: `${packagePath}/src/name-schema.ts`,
|
|
458
|
-
},
|
|
459
|
-
];
|
|
460
|
-
}
|
|
461
|
-
function packageAdditionPlan(packageName, packagePath, nodeVersion) {
|
|
462
|
-
const [workspaceCollection] = packagePath.split("/");
|
|
463
|
-
return {
|
|
464
|
-
packagePath,
|
|
465
|
-
workspacePackageGlob: `${workspaceCollection}/*`,
|
|
466
|
-
packageRole: "shared-library",
|
|
467
|
-
packageSourcePreset: "ts-lib",
|
|
468
|
-
sourceRoot: templateSourceRoot(),
|
|
469
|
-
sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
|
|
470
|
-
operations: packageAdditionOperations(packagePath, packageName, nodeVersion),
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
function templateSourceRoot() {
|
|
474
|
-
const projectionDir = path.dirname(fileURLToPath(import.meta.url));
|
|
475
|
-
const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "ts-lib");
|
|
476
|
-
return existsSync(path.join(publishedTemplateRoot, "src", "index.ts"))
|
|
477
|
-
? publishedTemplateRoot
|
|
478
|
-
: projectionDir;
|
|
479
|
-
}
|
|
480
|
-
function sharedOxcSourceRoot() {
|
|
481
|
-
const projectionDir = path.dirname(fileURLToPath(import.meta.url));
|
|
482
|
-
const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
|
|
483
|
-
return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
|
|
484
|
-
? publishedSharedRoot
|
|
485
|
-
: path.join(projectionDir, "..", "shared", "oxc");
|
|
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
|
-
}
|
|
494
|
-
export const tsLibPresetProjection = {
|
|
495
|
-
metadata: tsLibPresetMetadata,
|
|
496
|
-
capabilities: {
|
|
497
|
-
packageAddition: {
|
|
498
|
-
planPackageAddition({ packageName, packagePath, nodeVersion, }) {
|
|
499
|
-
return packageAdditionPlan(packageName, packagePath, nodeVersion);
|
|
500
|
-
},
|
|
501
|
-
},
|
|
502
|
-
},
|
|
503
|
-
blueprint: tsLibBlueprint,
|
|
504
|
-
project(context) {
|
|
505
|
-
const checkPlan = planTsLibRootChecks();
|
|
506
|
-
const fixPlan = planTsLibRootFixes();
|
|
507
|
-
const packageScripts = projectTsLibRootPackageScripts();
|
|
508
|
-
return {
|
|
509
|
-
sourceRoot: templateSourceRoot(),
|
|
510
|
-
sourceRoots: {
|
|
511
|
-
sharedDevcontainer: sharedDevcontainerSourceRoot(),
|
|
512
|
-
sharedOxc: sharedOxcSourceRoot(),
|
|
513
|
-
},
|
|
514
|
-
operations: operationsForTsLib(context, packageScripts, checkPlan),
|
|
515
|
-
checkPlan,
|
|
516
|
-
fixPlan,
|
|
517
|
-
dependencyMaintenancePolicy,
|
|
518
|
-
packageScripts,
|
|
519
|
-
capabilities: {
|
|
520
|
-
rootCheck: true,
|
|
521
|
-
fixCommand: true,
|
|
522
|
-
githubActions: true,
|
|
523
|
-
dependabot: true,
|
|
524
|
-
devcontainer: true,
|
|
525
|
-
},
|
|
526
|
-
};
|
|
527
|
-
},
|
|
528
|
-
async render({ targetDir, plan }) {
|
|
529
|
-
await renderNewProject({
|
|
530
|
-
sourceRoot: plan.sourceRoot,
|
|
531
|
-
sourceRoots: plan.sourceRoots,
|
|
532
|
-
targetRoot: targetDir,
|
|
533
|
-
operations: [...plan.operations],
|
|
534
|
-
});
|
|
535
|
-
},
|
|
536
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BuiltInPreset, ProjectBlueprint } from "../../src/declarations.js";
|
|
2
|
-
import type { PresetBlueprintOptions, PresetProjection } from "../../src/preset-projection.js";
|
|
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;
|