wp-typia 0.22.6 → 0.22.8

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.
@@ -1,11 +1,11 @@
1
1
  // @bun
2
2
  import {
3
3
  getPackageVersions
4
- } from "./cli-1sm60g1z.js";
4
+ } from "./cli-arz4rcye.js";
5
5
  import {
6
6
  discoverMigrationInitLayout
7
7
  } from "./cli-2rqf6t0b.js";
8
- import"./cli-tke8twkn.js";
8
+ import"./cli-qse6myha.js";
9
9
  import {
10
10
  quoteTsString,
11
11
  require_typescript,
@@ -13,7 +13,7 @@ import {
13
13
  snapshotWorkspaceFiles,
14
14
  toPascalCase,
15
15
  updateWorkspaceInventorySource
16
- } from "./cli-5kn2p7ee.js";
16
+ } from "./cli-bbj0kn1e.js";
17
17
  import"./cli-fys8vm2t.js";
18
18
  import {
19
19
  CLI_DIAGNOSTIC_CODES,
@@ -218,6 +218,74 @@ import fs2 from "fs";
218
218
  import path2 from "path";
219
219
  import { analyzeSourceTypes } from "@wp-typia/block-runtime/metadata-parser";
220
220
 
221
+ // ../wp-typia-project-tools/src/runtime/cli-init-plan-presentation.ts
222
+ function buildInitPlanChangeSummary(changes, options) {
223
+ const lines = [];
224
+ for (const dependencyChange of changes.packageChanges.addDevDependencies) {
225
+ lines.push(`devDependency ${dependencyChange.action} ${dependencyChange.name} -> ${dependencyChange.requiredValue}`);
226
+ }
227
+ if (changes.packageChanges.packageManagerField) {
228
+ lines.push(`packageManager ${changes.packageChanges.packageManagerField.action} -> ${changes.packageChanges.packageManagerField.requiredValue}`);
229
+ }
230
+ for (const scriptChange of changes.packageChanges.scripts) {
231
+ lines.push(`script ${scriptChange.action} ${scriptChange.name} -> ${scriptChange.requiredValue}`);
232
+ }
233
+ for (const filePlan of changes.plannedFiles) {
234
+ lines.push(`file ${filePlan.action} ${filePlan.path} (${filePlan.purpose})`);
235
+ }
236
+ if (options.includeGeneratedArtifacts) {
237
+ for (const artifactPath of changes.generatedArtifacts) {
238
+ lines.push(`generated artifact ${artifactPath}`);
239
+ }
240
+ }
241
+ return lines;
242
+ }
243
+ function buildInitPlanNextSteps(options) {
244
+ const cliSpecifier = getWpTypiaCliSpecifier();
245
+ const syncTypesRun = formatRunScript(options.packageManager, "sync-types");
246
+ const syncRun = formatRunScript(options.packageManager, "sync");
247
+ const doctorRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "doctor");
248
+ const migrationInitRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "migrate init --current-migration-version v1");
249
+ const dependencyInstallCommand = formatAddDevDependenciesCommand(options.packageManager, buildRequiredDevDependencyMapEntries());
250
+ if (options.layoutKind === "unsupported") {
251
+ return [
252
+ "Align the project to one of the supported retrofit layouts listed below, then rerun `wp-typia init`.",
253
+ dependencyInstallCommand,
254
+ syncTypesRun,
255
+ doctorRun
256
+ ];
257
+ }
258
+ if (options.commandMode === "apply") {
259
+ return [
260
+ ...options.dependencyChangeCount > 0 ? [
261
+ "Install or reinstall project dependencies so the retrofit sync scripts and metadata generators are available locally.",
262
+ dependencyInstallCommand
263
+ ] : [],
264
+ syncRun,
265
+ doctorRun,
266
+ `Optional migration bootstrap: ${migrationInitRun}`
267
+ ];
268
+ }
269
+ return [
270
+ ...options.hasPlannedChanges ? [
271
+ "Re-run `wp-typia init --apply` to write the planned package.json changes and helper files automatically.",
272
+ ...options.dependencyChangeCount > 0 ? [dependencyInstallCommand] : []
273
+ ] : [],
274
+ syncRun,
275
+ doctorRun,
276
+ `Optional migration bootstrap: ${migrationInitRun}`
277
+ ];
278
+ }
279
+ function buildRetrofitPlanSummary(options) {
280
+ if (options.status === "already-initialized") {
281
+ return options.commandMode === "apply" ? "This project already exposes the minimum wp-typia retrofit surface. No files were changed." : "This project already exposes the minimum wp-typia retrofit surface.";
282
+ }
283
+ if (options.commandMode === "apply") {
284
+ return "Applied the minimum wp-typia retrofit surface so package.json and helper scripts are ready for the next install and sync run.";
285
+ }
286
+ return "This command previews the minimum wp-typia adoption layer for the current project without rewriting it into a full scaffold.";
287
+ }
288
+
221
289
  // ../wp-typia-project-tools/src/runtime/cli-init-types.ts
222
290
  var SUPPORTED_RETROFIT_LAYOUT_NOTE = "Supported retrofit layouts currently mirror the migration bootstrap detector: `src/block.json` + `src/types.ts` + `src/save.tsx`, legacy root `block.json` + `src/types.ts` + `src/save.tsx`, or multi-block `src/blocks/*/block.json` workspaces.";
223
291
  var RETROFIT_APPLY_PREVIEW_NOTE = "If you rerun with `wp-typia init --apply`, package.json and generated helper files are snapshotted and rolled back automatically if a write fails.";
@@ -364,76 +432,9 @@ function buildPlannedFiles(projectDir, layoutKind) {
364
432
  }
365
433
  ];
366
434
  }
367
- function buildChangeSummary(changes, options) {
368
- const lines = [];
369
- for (const dependencyChange of changes.packageChanges.addDevDependencies) {
370
- lines.push(`devDependency ${dependencyChange.action} ${dependencyChange.name} -> ${dependencyChange.requiredValue}`);
371
- }
372
- if (changes.packageChanges.packageManagerField) {
373
- lines.push(`packageManager ${changes.packageChanges.packageManagerField.action} -> ${changes.packageChanges.packageManagerField.requiredValue}`);
374
- }
375
- for (const scriptChange of changes.packageChanges.scripts) {
376
- lines.push(`script ${scriptChange.action} ${scriptChange.name} -> ${scriptChange.requiredValue}`);
377
- }
378
- for (const filePlan of changes.plannedFiles) {
379
- lines.push(`file ${filePlan.action} ${filePlan.path} (${filePlan.purpose})`);
380
- }
381
- if (options.includeGeneratedArtifacts) {
382
- for (const artifactPath of changes.generatedArtifacts) {
383
- lines.push(`generated artifact ${artifactPath}`);
384
- }
385
- }
386
- return lines;
387
- }
388
- function buildNextSteps(options) {
389
- const cliSpecifier = getWpTypiaCliSpecifier();
390
- const syncTypesRun = formatRunScript(options.packageManager, "sync-types");
391
- const syncRun = formatRunScript(options.packageManager, "sync");
392
- const doctorRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "doctor");
393
- const migrationInitRun = formatPackageExecCommand(options.packageManager, cliSpecifier, "migrate init --current-migration-version v1");
394
- const dependencyInstallCommand = formatAddDevDependenciesCommand(options.packageManager, buildRequiredDevDependencyMapEntries());
395
- if (options.layoutKind === "unsupported") {
396
- return [
397
- "Align the project to one of the supported retrofit layouts listed below, then rerun `wp-typia init`.",
398
- dependencyInstallCommand,
399
- syncTypesRun,
400
- doctorRun
401
- ];
402
- }
403
- if (options.commandMode === "apply") {
404
- return [
405
- ...options.dependencyChangeCount > 0 ? [
406
- "Install or reinstall project dependencies so the retrofit sync scripts and metadata generators are available locally.",
407
- dependencyInstallCommand
408
- ] : [],
409
- syncRun,
410
- doctorRun,
411
- `Optional migration bootstrap: ${migrationInitRun}`
412
- ];
413
- }
414
- const steps = [
415
- ...options.hasPlannedChanges ? [
416
- "Re-run `wp-typia init --apply` to write the planned package.json changes and helper files automatically.",
417
- ...options.dependencyChangeCount > 0 ? [dependencyInstallCommand] : []
418
- ] : [],
419
- syncRun,
420
- doctorRun,
421
- `Optional migration bootstrap: ${migrationInitRun}`
422
- ];
423
- return steps;
424
- }
425
- function buildRetrofitPlanSummary(options) {
426
- if (options.status === "already-initialized") {
427
- return options.commandMode === "apply" ? "This project already exposes the minimum wp-typia retrofit surface. No files were changed." : "This project already exposes the minimum wp-typia retrofit surface.";
428
- }
429
- if (options.commandMode === "apply") {
430
- return "Applied the minimum wp-typia retrofit surface so package.json and helper scripts are ready for the next install and sync run.";
431
- }
432
- return "This command previews the minimum wp-typia adoption layer for the current project without rewriting it into a full scaffold.";
433
- }
434
435
  function createRetrofitPlan(options) {
435
436
  const includeGeneratedArtifacts = options.commandMode === "preview-only";
436
- const plannedChanges = buildChangeSummary({
437
+ const plannedChanges = buildInitPlanChangeSummary({
437
438
  generatedArtifacts: options.generatedArtifacts,
438
439
  packageChanges: options.packageChanges,
439
440
  plannedFiles: options.plannedFiles
@@ -445,7 +446,7 @@ function createRetrofitPlan(options) {
445
446
  commandMode: options.commandMode,
446
447
  detectedLayout: options.detectedLayout,
447
448
  generatedArtifacts: options.generatedArtifacts,
448
- nextSteps: options.nextSteps ?? buildNextSteps({
449
+ nextSteps: options.nextSteps ?? buildInitPlanNextSteps({
449
450
  commandMode: options.commandMode,
450
451
  dependencyChangeCount: options.packageChanges.addDevDependencies.length,
451
452
  hasPlannedChanges: plannedChanges.length > 0,
@@ -861,4 +862,4 @@ export {
861
862
  applyInitPlan
862
863
  };
863
864
 
864
- //# debugId=9445E5AD8C9D8E6964756E2164756E21
865
+ //# debugId=4F60C8DD81E9727764756E2164756E21