@boopkit/cli 0.1.8 → 0.1.10

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
@@ -1,7 +1,42 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
3
36
  Object.defineProperty(exports, "__esModule", { value: true });
4
37
  const commander_1 = require("commander");
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
5
40
  const status_1 = require("./commands/status");
6
41
  const init_1 = require("./commands/init");
7
42
  const list_1 = require("./commands/list");
@@ -9,11 +44,12 @@ const add_1 = require("./commands/add");
9
44
  const adopt_1 = require("./commands/adopt");
10
45
  const update_1 = require("./commands/update");
11
46
  const loop_1 = require("./commands/loop");
47
+ const pkgJson = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf-8'));
12
48
  const program = new commander_1.Command();
13
49
  program
14
50
  .name('boop')
15
51
  .description('Scaffold new projects from boop profiles and capabilities')
16
- .version('0.1.0');
52
+ .version(pkgJson.version);
17
53
  program
18
54
  .command('init')
19
55
  .description('Create a new project from a boop profile')
@@ -52,6 +88,7 @@ program
52
88
  .option('--force', 'Overwrite locally modified files (creates .bak backup)')
53
89
  .option('--restore', 'Restore locally deleted scaffold files')
54
90
  .option('--prune', 'Remove deprecated scaffold files from disk (creates .bak backup)')
91
+ .option('--skip-npm', 'Skip npm update (only re-scaffold from installed versions)')
55
92
  .option('--json', 'Output structured JSON')
56
93
  .action(update_1.runUpdate);
57
94
  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.10",
4
4
  "description": "CLI tool to scaffold new projects from boop profiles and capabilities",
5
5
  "main": "dist/cli.js",
6
6
  "workspaces": [