@wp-typia/project-tools 0.16.10 → 0.16.12

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.
Files changed (104) hide show
  1. package/README.md +9 -3
  2. package/dist/runtime/built-in-block-artifact-documents.d.ts +3 -0
  3. package/dist/runtime/built-in-block-artifact-documents.js +2 -0
  4. package/dist/runtime/built-in-block-artifact-types.d.ts +51 -0
  5. package/dist/runtime/built-in-block-artifact-types.js +304 -0
  6. package/dist/runtime/built-in-block-artifacts.js +4 -803
  7. package/dist/runtime/built-in-block-attribute-emitters.d.ts +71 -0
  8. package/dist/runtime/built-in-block-attribute-emitters.js +176 -0
  9. package/dist/runtime/built-in-block-attribute-specs.d.ts +38 -0
  10. package/dist/runtime/built-in-block-attribute-specs.js +358 -0
  11. package/dist/runtime/built-in-block-code-templates/basic.d.ts +4 -0
  12. package/dist/runtime/built-in-block-code-templates/basic.js +249 -0
  13. package/dist/runtime/built-in-block-code-templates/compound-child.d.ts +4 -0
  14. package/dist/runtime/built-in-block-code-templates/compound-child.js +138 -0
  15. package/dist/runtime/built-in-block-code-templates/compound-parent.d.ts +6 -0
  16. package/dist/runtime/built-in-block-code-templates/compound-parent.js +227 -0
  17. package/dist/runtime/built-in-block-code-templates/compound-persistence.d.ts +4 -0
  18. package/dist/runtime/built-in-block-code-templates/compound-persistence.js +478 -0
  19. package/dist/runtime/built-in-block-code-templates/compound.d.ts +3 -0
  20. package/dist/runtime/built-in-block-code-templates/compound.js +3 -0
  21. package/dist/runtime/built-in-block-code-templates/interactivity.d.ts +5 -0
  22. package/dist/runtime/built-in-block-code-templates/interactivity.js +547 -0
  23. package/dist/runtime/built-in-block-code-templates/persistence.d.ts +5 -0
  24. package/dist/runtime/built-in-block-code-templates/persistence.js +550 -0
  25. package/dist/runtime/built-in-block-code-templates/shared.d.ts +16 -0
  26. package/dist/runtime/built-in-block-code-templates/shared.js +53 -0
  27. package/dist/runtime/built-in-block-code-templates.d.ts +5 -32
  28. package/dist/runtime/built-in-block-code-templates.js +5 -2230
  29. package/dist/runtime/cli-add-block-config.d.ts +6 -0
  30. package/dist/runtime/cli-add-block-config.js +143 -0
  31. package/dist/runtime/cli-add-block-legacy-validator.d.ts +4 -0
  32. package/dist/runtime/cli-add-block-legacy-validator.js +168 -0
  33. package/dist/runtime/cli-add-block.js +3 -301
  34. package/dist/runtime/cli-add-workspace-assets.d.ts +38 -0
  35. package/dist/runtime/cli-add-workspace-assets.js +399 -0
  36. package/dist/runtime/cli-add-workspace.d.ts +2 -38
  37. package/dist/runtime/cli-add-workspace.js +5 -396
  38. package/dist/runtime/cli-doctor-environment.d.ts +12 -0
  39. package/dist/runtime/cli-doctor-environment.js +123 -0
  40. package/dist/runtime/cli-doctor-workspace.d.ts +14 -0
  41. package/dist/runtime/cli-doctor-workspace.js +296 -0
  42. package/dist/runtime/cli-doctor.d.ts +4 -2
  43. package/dist/runtime/cli-doctor.js +10 -405
  44. package/dist/runtime/cli-help.js +1 -1
  45. package/dist/runtime/cli-scaffold.js +1 -1
  46. package/dist/runtime/migration-command-surface.d.ts +67 -0
  47. package/dist/runtime/migration-command-surface.js +189 -0
  48. package/dist/runtime/migration-diff-rename.d.ts +13 -0
  49. package/dist/runtime/migration-diff-rename.js +192 -0
  50. package/dist/runtime/migration-diff-transform.d.ts +14 -0
  51. package/dist/runtime/migration-diff-transform.js +105 -0
  52. package/dist/runtime/migration-diff.js +12 -297
  53. package/dist/runtime/migration-generated-artifacts.d.ts +3 -0
  54. package/dist/runtime/migration-generated-artifacts.js +41 -0
  55. package/dist/runtime/migration-maintenance.d.ts +51 -0
  56. package/dist/runtime/migration-maintenance.js +380 -0
  57. package/dist/runtime/migration-planning.d.ts +23 -0
  58. package/dist/runtime/migration-planning.js +131 -0
  59. package/dist/runtime/migration-project-config-source.d.ts +6 -0
  60. package/dist/runtime/migration-project-config-source.js +424 -0
  61. package/dist/runtime/migration-project-layout-discovery.d.ts +61 -0
  62. package/dist/runtime/migration-project-layout-discovery.js +337 -0
  63. package/dist/runtime/migration-project-layout-paths.d.ts +135 -0
  64. package/dist/runtime/migration-project-layout-paths.js +288 -0
  65. package/dist/runtime/migration-project-layout.d.ts +3 -0
  66. package/dist/runtime/migration-project-layout.js +2 -0
  67. package/dist/runtime/migration-project-workspace.d.ts +47 -0
  68. package/dist/runtime/migration-project-workspace.js +212 -0
  69. package/dist/runtime/migration-project.d.ts +4 -94
  70. package/dist/runtime/migration-project.js +3 -1101
  71. package/dist/runtime/migration-render-diff-rule.d.ts +5 -0
  72. package/dist/runtime/migration-render-diff-rule.js +120 -0
  73. package/dist/runtime/migration-render-execution.d.ts +3 -0
  74. package/dist/runtime/migration-render-execution.js +428 -0
  75. package/dist/runtime/migration-render-generated.d.ts +27 -0
  76. package/dist/runtime/migration-render-generated.js +230 -0
  77. package/dist/runtime/migration-render-support.d.ts +3 -0
  78. package/dist/runtime/migration-render-support.js +16 -0
  79. package/dist/runtime/migration-render.d.ts +3 -33
  80. package/dist/runtime/migration-render.js +3 -789
  81. package/dist/runtime/migration-ui-capability.js +1 -1
  82. package/dist/runtime/migrations.d.ts +24 -118
  83. package/dist/runtime/migrations.js +12 -700
  84. package/dist/runtime/scaffold-bootstrap.d.ts +45 -0
  85. package/dist/runtime/scaffold-bootstrap.js +185 -0
  86. package/dist/runtime/scaffold-package-manager-files.d.ts +35 -0
  87. package/dist/runtime/scaffold-package-manager-files.js +79 -0
  88. package/dist/runtime/scaffold.d.ts +1 -12
  89. package/dist/runtime/scaffold.js +10 -393
  90. package/dist/runtime/template-source-contracts.d.ts +81 -0
  91. package/dist/runtime/template-source-contracts.js +1 -0
  92. package/dist/runtime/template-source-external.d.ts +21 -0
  93. package/dist/runtime/template-source-external.js +184 -0
  94. package/dist/runtime/template-source-locators.d.ts +4 -0
  95. package/dist/runtime/template-source-locators.js +72 -0
  96. package/dist/runtime/template-source-normalization.d.ts +7 -0
  97. package/dist/runtime/template-source-normalization.js +53 -0
  98. package/dist/runtime/template-source-remote.d.ts +23 -0
  99. package/dist/runtime/template-source-remote.js +336 -0
  100. package/dist/runtime/template-source-seeds.d.ts +12 -0
  101. package/dist/runtime/template-source-seeds.js +243 -0
  102. package/dist/runtime/template-source.d.ts +4 -86
  103. package/dist/runtime/template-source.js +9 -828
  104. package/package.json +5 -5
@@ -0,0 +1,45 @@
1
+ import type { PackageManagerId } from "./package-managers.js";
2
+ import type { ScaffoldTemplateVariables } from "./scaffold.js";
3
+ import type { BuiltInTemplateId } from "./template-registry.js";
4
+ /**
5
+ * Ensures the scaffold target directory exists and is empty unless explicitly allowed.
6
+ *
7
+ * @param targetDir Absolute project directory that will receive scaffold output.
8
+ * @param allowExisting Whether an existing non-empty directory should be accepted.
9
+ * @returns A promise that resolves once the directory precondition is satisfied.
10
+ */
11
+ export declare function ensureScaffoldDirectory(targetDir: string, allowExisting?: boolean): Promise<void>;
12
+ /**
13
+ * Writes built-in starter manifest files into a scaffolded project.
14
+ *
15
+ * @param targetDir Absolute scaffold target directory.
16
+ * @param templateId Built-in template id being scaffolded.
17
+ * @param variables Resolved scaffold template variables.
18
+ * @returns A promise that resolves after all starter manifests are written.
19
+ */
20
+ export declare function writeStarterManifestFiles(targetDir: string, templateId: string, variables: ScaffoldTemplateVariables): Promise<void>;
21
+ /**
22
+ * Seed REST-derived persistence artifacts into a newly scaffolded built-in
23
+ * project before the first manual `sync-rest` run.
24
+ *
25
+ * @param targetDir Absolute scaffold target directory.
26
+ * @param templateId Built-in template id being scaffolded.
27
+ * @param variables Resolved scaffold template variables for the project.
28
+ * @returns A promise that resolves after any required persistence artifacts are generated.
29
+ */
30
+ export declare function seedBuiltInPersistenceArtifacts(targetDir: string, templateId: BuiltInTemplateId, variables: ScaffoldTemplateVariables): Promise<void>;
31
+ /**
32
+ * Detects whether a scaffolded project is the official workspace template.
33
+ *
34
+ * @param projectDir Absolute scaffold target directory.
35
+ * @returns `true` when the project metadata identifies the official workspace template.
36
+ */
37
+ export declare function isOfficialWorkspaceProject(projectDir: string): boolean;
38
+ /**
39
+ * Adds migration scripts and starter workspace files to the official workspace template.
40
+ *
41
+ * @param projectDir Absolute scaffold target directory.
42
+ * @param packageManager Package manager used for generated script commands.
43
+ * @returns A promise that resolves after scripts and migration starter files are written.
44
+ */
45
+ export declare function applyWorkspaceMigrationCapability(projectDir: string, packageManager: PackageManagerId): Promise<void>;
@@ -0,0 +1,185 @@
1
+ import fs from "node:fs";
2
+ import { promises as fsp } from "node:fs";
3
+ import path from "node:path";
4
+ import { formatPackageExecCommand } from "./package-managers.js";
5
+ import { ensureMigrationDirectories, writeInitialMigrationScaffold, writeMigrationConfig, } from "./migration-project.js";
6
+ import { syncPersistenceRestArtifacts } from "./persistence-rest-artifacts.js";
7
+ import { getPackageVersions } from "./package-versions.js";
8
+ import { getStarterManifestFiles, stringifyStarterManifest } from "./starter-manifests.js";
9
+ import { OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE, PROJECT_TOOLS_PACKAGE_ROOT, } from "./template-registry.js";
10
+ const EPHEMERAL_NODE_MODULES_LINK_TYPE = process.platform === "win32" ? "junction" : "dir";
11
+ /**
12
+ * Ensures the scaffold target directory exists and is empty unless explicitly allowed.
13
+ *
14
+ * @param targetDir Absolute project directory that will receive scaffold output.
15
+ * @param allowExisting Whether an existing non-empty directory should be accepted.
16
+ * @returns A promise that resolves once the directory precondition is satisfied.
17
+ */
18
+ export async function ensureScaffoldDirectory(targetDir, allowExisting = false) {
19
+ if (!fs.existsSync(targetDir)) {
20
+ await fsp.mkdir(targetDir, { recursive: true });
21
+ return;
22
+ }
23
+ if (allowExisting) {
24
+ return;
25
+ }
26
+ const entries = await fsp.readdir(targetDir);
27
+ if (entries.length > 0) {
28
+ throw new Error(`Target directory is not empty: ${targetDir}`);
29
+ }
30
+ }
31
+ /**
32
+ * Writes built-in starter manifest files into a scaffolded project.
33
+ *
34
+ * @param targetDir Absolute scaffold target directory.
35
+ * @param templateId Built-in template id being scaffolded.
36
+ * @param variables Resolved scaffold template variables.
37
+ * @returns A promise that resolves after all starter manifests are written.
38
+ */
39
+ export async function writeStarterManifestFiles(targetDir, templateId, variables) {
40
+ const manifests = getStarterManifestFiles(templateId, variables);
41
+ for (const { document, relativePath } of manifests) {
42
+ const destinationPath = path.join(targetDir, relativePath);
43
+ await fsp.mkdir(path.dirname(destinationPath), { recursive: true });
44
+ await fsp.writeFile(destinationPath, stringifyStarterManifest(document), "utf8");
45
+ }
46
+ }
47
+ /**
48
+ * Seed REST-derived persistence artifacts into a newly scaffolded built-in
49
+ * project before the first manual `sync-rest` run.
50
+ *
51
+ * @param targetDir Absolute scaffold target directory.
52
+ * @param templateId Built-in template id being scaffolded.
53
+ * @param variables Resolved scaffold template variables for the project.
54
+ * @returns A promise that resolves after any required persistence artifacts are generated.
55
+ */
56
+ export async function seedBuiltInPersistenceArtifacts(targetDir, templateId, variables) {
57
+ const needsPersistenceArtifacts = templateId === "persistence" ||
58
+ (templateId === "compound" && variables.compoundPersistenceEnabled === "true");
59
+ if (!needsPersistenceArtifacts) {
60
+ return;
61
+ }
62
+ await withEphemeralScaffoldNodeModules(targetDir, async () => {
63
+ if (templateId === "persistence") {
64
+ await syncPersistenceRestArtifacts({
65
+ apiTypesFile: path.join("src", "api-types.ts"),
66
+ outputDir: "src",
67
+ projectDir: targetDir,
68
+ variables,
69
+ });
70
+ return;
71
+ }
72
+ await syncPersistenceRestArtifacts({
73
+ apiTypesFile: path.join("src", "blocks", variables.slugKebabCase, "api-types.ts"),
74
+ outputDir: path.join("src", "blocks", variables.slugKebabCase),
75
+ projectDir: targetDir,
76
+ variables,
77
+ });
78
+ });
79
+ }
80
+ /**
81
+ * Detects whether a scaffolded project is the official workspace template.
82
+ *
83
+ * @param projectDir Absolute scaffold target directory.
84
+ * @returns `true` when the project metadata identifies the official workspace template.
85
+ */
86
+ export function isOfficialWorkspaceProject(projectDir) {
87
+ const packageJsonPath = path.join(projectDir, "package.json");
88
+ if (!fs.existsSync(packageJsonPath)) {
89
+ return false;
90
+ }
91
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
92
+ return (packageJson.wpTypia?.projectType === "workspace" &&
93
+ packageJson.wpTypia?.templatePackage === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE);
94
+ }
95
+ /**
96
+ * Adds migration scripts and starter workspace files to the official workspace template.
97
+ *
98
+ * @param projectDir Absolute scaffold target directory.
99
+ * @param packageManager Package manager used for generated script commands.
100
+ * @returns A promise that resolves after scripts and migration starter files are written.
101
+ */
102
+ export async function applyWorkspaceMigrationCapability(projectDir, packageManager) {
103
+ const packageJsonPath = path.join(projectDir, "package.json");
104
+ const packageJson = JSON.parse(await fsp.readFile(packageJsonPath, "utf8"));
105
+ const wpTypiaPackageVersion = getPackageVersions().wpTypiaPackageVersion;
106
+ const canonicalCliSpecifier = wpTypiaPackageVersion === "^0.0.0"
107
+ ? "wp-typia"
108
+ : `wp-typia@${wpTypiaPackageVersion.replace(/^[~^]/u, "")}`;
109
+ const migrationCli = (args) => formatPackageExecCommand(packageManager, canonicalCliSpecifier, `migrate ${args}`);
110
+ packageJson.scripts = {
111
+ ...(packageJson.scripts ?? {}),
112
+ "migration:init": migrationCli("init --current-migration-version v1"),
113
+ "migration:snapshot": migrationCli("snapshot"),
114
+ "migration:diff": migrationCli("diff"),
115
+ "migration:scaffold": migrationCli("scaffold"),
116
+ "migration:doctor": migrationCli("doctor --all"),
117
+ "migration:fixtures": migrationCli("fixtures --all"),
118
+ "migration:verify": migrationCli("verify --all"),
119
+ "migration:fuzz": migrationCli("fuzz --all"),
120
+ };
121
+ await fsp.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, "\t")}\n`, "utf8");
122
+ writeMigrationConfig(projectDir, {
123
+ blocks: [],
124
+ currentMigrationVersion: "v1",
125
+ snapshotDir: "src/migrations/versions",
126
+ supportedMigrationVersions: ["v1"],
127
+ });
128
+ ensureMigrationDirectories(projectDir, []);
129
+ writeInitialMigrationScaffold(projectDir, "v1", []);
130
+ }
131
+ /**
132
+ * Locate a node_modules directory containing `typia` relative to the project
133
+ * tools package root.
134
+ *
135
+ * Search order:
136
+ * 1. `PROJECT_TOOLS_PACKAGE_ROOT/node_modules`
137
+ * 2. The monorepo root resolved from `PROJECT_TOOLS_PACKAGE_ROOT`
138
+ * 3. The monorepo root `node_modules`
139
+ *
140
+ * @returns The first matching path, or `null` when no candidate contains `typia`.
141
+ */
142
+ function resolveScaffoldGeneratorNodeModulesPath() {
143
+ const candidates = [
144
+ path.join(PROJECT_TOOLS_PACKAGE_ROOT, "node_modules"),
145
+ path.resolve(PROJECT_TOOLS_PACKAGE_ROOT, "..", ".."),
146
+ path.resolve(PROJECT_TOOLS_PACKAGE_ROOT, "..", "..", "node_modules"),
147
+ ];
148
+ for (const candidate of candidates) {
149
+ if (fs.existsSync(path.join(candidate, "typia", "package.json"))) {
150
+ return candidate;
151
+ }
152
+ }
153
+ return null;
154
+ }
155
+ /**
156
+ * Temporarily symlink a scaffold generator node_modules directory into the
157
+ * target project while running an async callback.
158
+ *
159
+ * The helper resolves the source path via `resolveScaffoldGeneratorNodeModulesPath()`
160
+ * and uses `EPHEMERAL_NODE_MODULES_LINK_TYPE` for the symlink. The temporary
161
+ * link is removed in the `finally` block so cleanup still happens if the
162
+ * callback throws.
163
+ *
164
+ * @param targetDir Absolute scaffold target directory.
165
+ * @param callback Async work that requires a resolvable `node_modules`.
166
+ * @returns A promise that resolves after the callback and cleanup complete.
167
+ */
168
+ async function withEphemeralScaffoldNodeModules(targetDir, callback) {
169
+ const targetNodeModulesPath = path.join(targetDir, "node_modules");
170
+ if (fs.existsSync(targetNodeModulesPath)) {
171
+ await callback();
172
+ return;
173
+ }
174
+ const sourceNodeModulesPath = resolveScaffoldGeneratorNodeModulesPath();
175
+ if (!sourceNodeModulesPath) {
176
+ throw new Error("Unable to resolve a node_modules directory with typia for scaffold-time REST artifact generation.");
177
+ }
178
+ await fsp.symlink(sourceNodeModulesPath, targetNodeModulesPath, EPHEMERAL_NODE_MODULES_LINK_TYPE);
179
+ try {
180
+ await callback();
181
+ }
182
+ finally {
183
+ await fsp.rm(targetNodeModulesPath, { force: true, recursive: true });
184
+ }
185
+ }
@@ -0,0 +1,35 @@
1
+ import type { PackageManagerId } from "./package-managers.js";
2
+ /**
3
+ * Normalizes scaffolded package-manager specific files for the selected toolchain.
4
+ *
5
+ * @param targetDir Absolute scaffold target directory.
6
+ * @param packageManagerId Selected package manager id.
7
+ * @returns A promise that resolves after any package-manager sidecar files are updated.
8
+ */
9
+ export declare function normalizePackageManagerFiles(targetDir: string, packageManagerId: PackageManagerId): Promise<void>;
10
+ /**
11
+ * Rewrites the generated package.json for the selected package manager.
12
+ *
13
+ * @param targetDir Absolute scaffold target directory.
14
+ * @param packageManagerId Selected package manager id.
15
+ * @returns A promise that resolves after the package.json file is normalized.
16
+ */
17
+ export declare function normalizePackageJson(targetDir: string, packageManagerId: PackageManagerId): Promise<void>;
18
+ /**
19
+ * Removes lockfiles that do not match the selected package manager.
20
+ *
21
+ * @param targetDir Absolute scaffold target directory.
22
+ * @param packageManagerId Selected package manager id.
23
+ * @returns A promise that resolves after stale lockfiles are removed.
24
+ */
25
+ export declare function removeUnexpectedLockfiles(targetDir: string, packageManagerId: PackageManagerId): Promise<void>;
26
+ /**
27
+ * Installs scaffolded project dependencies with the selected package manager.
28
+ *
29
+ * @param options Absolute target directory and selected package manager id.
30
+ * @returns A promise that resolves after the install command completes.
31
+ */
32
+ export declare function defaultInstallDependencies({ projectDir, packageManager, }: {
33
+ projectDir: string;
34
+ packageManager: PackageManagerId;
35
+ }): Promise<void>;
@@ -0,0 +1,79 @@
1
+ import fs from "node:fs";
2
+ import { promises as fsp } from "node:fs";
3
+ import { execSync } from "node:child_process";
4
+ import path from "node:path";
5
+ import { formatInstallCommand, getPackageManager, transformPackageManagerText, } from "./package-managers.js";
6
+ const LOCKFILES = {
7
+ bun: ["bun.lock", "bun.lockb"],
8
+ npm: ["package-lock.json"],
9
+ pnpm: ["pnpm-lock.yaml"],
10
+ yarn: ["yarn.lock"],
11
+ };
12
+ /**
13
+ * Normalizes scaffolded package-manager specific files for the selected toolchain.
14
+ *
15
+ * @param targetDir Absolute scaffold target directory.
16
+ * @param packageManagerId Selected package manager id.
17
+ * @returns A promise that resolves after any package-manager sidecar files are updated.
18
+ */
19
+ export async function normalizePackageManagerFiles(targetDir, packageManagerId) {
20
+ const yarnRcPath = path.join(targetDir, ".yarnrc.yml");
21
+ if (packageManagerId === "yarn") {
22
+ await fsp.writeFile(yarnRcPath, "nodeLinker: node-modules\n", "utf8");
23
+ return;
24
+ }
25
+ await fsp.rm(yarnRcPath, { force: true });
26
+ }
27
+ /**
28
+ * Rewrites the generated package.json for the selected package manager.
29
+ *
30
+ * @param targetDir Absolute scaffold target directory.
31
+ * @param packageManagerId Selected package manager id.
32
+ * @returns A promise that resolves after the package.json file is normalized.
33
+ */
34
+ export async function normalizePackageJson(targetDir, packageManagerId) {
35
+ const packageJsonPath = path.join(targetDir, "package.json");
36
+ if (!fs.existsSync(packageJsonPath)) {
37
+ return;
38
+ }
39
+ const packageManager = getPackageManager(packageManagerId);
40
+ const packageJson = JSON.parse(await fsp.readFile(packageJsonPath, "utf8"));
41
+ packageJson.packageManager = packageManager.packageManagerField;
42
+ if (packageJson.scripts) {
43
+ for (const [key, value] of Object.entries(packageJson.scripts)) {
44
+ if (typeof value === "string") {
45
+ packageJson.scripts[key] = transformPackageManagerText(value, packageManagerId);
46
+ }
47
+ }
48
+ }
49
+ await fsp.writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, "\t")}\n`, "utf8");
50
+ }
51
+ /**
52
+ * Removes lockfiles that do not match the selected package manager.
53
+ *
54
+ * @param targetDir Absolute scaffold target directory.
55
+ * @param packageManagerId Selected package manager id.
56
+ * @returns A promise that resolves after stale lockfiles are removed.
57
+ */
58
+ export async function removeUnexpectedLockfiles(targetDir, packageManagerId) {
59
+ const keep = new Set(LOCKFILES[packageManagerId] ?? []);
60
+ const allLockfiles = Object.values(LOCKFILES).flat();
61
+ await Promise.all(allLockfiles.map(async (filename) => {
62
+ if (keep.has(filename)) {
63
+ return;
64
+ }
65
+ await fsp.rm(path.join(targetDir, filename), { force: true });
66
+ }));
67
+ }
68
+ /**
69
+ * Installs scaffolded project dependencies with the selected package manager.
70
+ *
71
+ * @param options Absolute target directory and selected package manager id.
72
+ * @returns A promise that resolves after the install command completes.
73
+ */
74
+ export async function defaultInstallDependencies({ projectDir, packageManager, }) {
75
+ execSync(formatInstallCommand(packageManager), {
76
+ cwd: projectDir,
77
+ stdio: "inherit",
78
+ });
79
+ }
@@ -138,17 +138,7 @@ export interface ScaffoldProjectResult {
138
138
  variables: ScaffoldTemplateVariables;
139
139
  warnings: string[];
140
140
  }
141
- /**
142
- * Builds the generated WordPress wrapper CSS class for a scaffolded block.
143
- *
144
- * Returns `wp-block-{namespace}-{slug}` when a non-empty namespace is present,
145
- * or `wp-block-{slug}` when the namespace is empty or undefined. When the
146
- * normalized namespace equals the normalized slug, appends `-block` so the
147
- * generated class avoids repeated namespace segments without colliding with the
148
- * default core wrapper classes. Both inputs are normalized and validated with
149
- * the same scaffold identifier rules used for block names.
150
- */
151
- export declare function buildBlockCssClassName(namespace: string | undefined, slug: string): string;
141
+ export { buildBlockCssClassName } from "./scaffold-identifiers.js";
152
142
  export declare function isDataStorageMode(value: string): value is DataStorageMode;
153
143
  export declare function isPersistencePolicy(value: string): value is PersistencePolicy;
154
144
  export declare function detectAuthor(): string;
@@ -158,4 +148,3 @@ export declare function resolvePackageManagerId({ packageManager, yes, isInterac
158
148
  export declare function collectScaffoldAnswers({ projectName, templateId, yes, dataStorageMode, namespace, persistencePolicy, phpPrefix, promptText, textDomain, }: CollectScaffoldAnswersOptions): Promise<ScaffoldAnswers>;
159
149
  export declare function getTemplateVariables(templateId: string, answers: ScaffoldAnswers): ScaffoldTemplateVariables;
160
150
  export declare function scaffoldProject({ projectDir, templateId, answers, dataStorageMode, persistencePolicy, packageManager, externalLayerId, externalLayerSource, externalLayerSourceLabel, repositoryReference, cwd, allowExistingDir, noInstall, installDependencies, variant, withMigrationUi, withTestPreset, withWpEnv, }: ScaffoldProjectOptions): Promise<ScaffoldProjectResult>;
161
- export {};