@boopkit/cli 0.1.8 → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "@boopkit/cap-api": "0.1.0",
3
- "@boopkit/cap-background-jobs": "0.1.0",
3
+ "@boopkit/cap-background-jobs": "0.2.0",
4
4
  "@boopkit/cap-cloud-storage": "0.1.0",
5
5
  "@boopkit/cap-coding": "0.1.0",
6
6
  "@boopkit/cap-database": "0.1.3",
package/dist/cli.js CHANGED
@@ -52,6 +52,7 @@ program
52
52
  .option('--force', 'Overwrite locally modified files (creates .bak backup)')
53
53
  .option('--restore', 'Restore locally deleted scaffold files')
54
54
  .option('--prune', 'Remove deprecated scaffold files from disk (creates .bak backup)')
55
+ .option('--skip-npm', 'Skip npm update (only re-scaffold from installed versions)')
55
56
  .option('--json', 'Output structured JSON')
56
57
  .action(update_1.runUpdate);
57
58
  program
@@ -4,5 +4,6 @@ export interface UpdateOptions {
4
4
  restore?: boolean;
5
5
  prune?: boolean;
6
6
  json?: boolean;
7
+ skipNpm?: boolean;
7
8
  }
8
9
  export declare function runUpdate(capabilityName: string | undefined, options: UpdateOptions): void;
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.runUpdate = runUpdate;
37
37
  const fs = __importStar(require("fs"));
38
38
  const path = __importStar(require("path"));
39
+ const child_process_1 = require("child_process");
39
40
  const project_1 = require("../lib/project");
40
41
  const capability_1 = require("../lib/capability");
41
42
  const update_1 = require("../lib/update");
@@ -58,6 +59,21 @@ function runUpdate(capabilityName, options) {
58
59
  process.exitCode = 1;
59
60
  return;
60
61
  }
62
+ // Step 1: npm install capability packages at latest within current major (unless --skip-npm or --dry-run)
63
+ if (!options.skipNpm && !options.dryRun) {
64
+ const packageSpecs = resolveNpmPackageSpecs(capsToUpdate, targetDir);
65
+ if (packageSpecs.length > 0) {
66
+ if (!options.json) {
67
+ console.log(`Updating npm packages: ${packageSpecs.join(', ')}`);
68
+ }
69
+ try {
70
+ (0, child_process_1.execSync)(`npm install ${packageSpecs.join(' ')}`, { cwd: targetDir, stdio: options.json ? 'pipe' : 'inherit' });
71
+ }
72
+ catch (err) {
73
+ console.error(`\x1b[33mWARN\x1b[0m npm install failed — continuing with scaffold update using installed versions`);
74
+ }
75
+ }
76
+ }
61
77
  // Plan all updates
62
78
  const plans = [];
63
79
  for (const cap of capsToUpdate) {
@@ -202,3 +218,26 @@ function diagnoseMissingPlans(capsToUpdate, requestedCap, targetDir) {
202
218
  }
203
219
  return 'No capabilities to update.';
204
220
  }
221
+ /**
222
+ * Resolve capability names to npm install specs pinned to the current major version.
223
+ * E.g. @boopkit/cap-background-jobs@0.2.0 → "@boopkit/cap-background-jobs@0"
224
+ * This allows minor+patch updates within the same major (including 0.x → 0.y)
225
+ * without crossing a major version boundary.
226
+ */
227
+ function resolveNpmPackageSpecs(capabilities, targetDir) {
228
+ const specs = [];
229
+ for (const cap of capabilities) {
230
+ const pkgDir = (0, capability_1.getPackageDir)(cap, [targetDir]);
231
+ if (!pkgDir)
232
+ continue;
233
+ const pkgJsonPath = path.join(pkgDir, 'package.json');
234
+ if (!fs.existsSync(pkgJsonPath))
235
+ continue;
236
+ const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
237
+ if (pkgJson.name && pkgJson.boopkit?.capability && pkgJson.version) {
238
+ const major = pkgJson.version.split('.')[0];
239
+ specs.push(`${pkgJson.name}@${major}`);
240
+ }
241
+ }
242
+ return specs;
243
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boopkit/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "CLI tool to scaffold new projects from boop profiles and capabilities",
5
5
  "main": "dist/cli.js",
6
6
  "workspaces": [