@boopkit/cli 0.1.2 → 0.1.3

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.
@@ -0,0 +1,17 @@
1
+ {
2
+ "@boopkit/cap-api": "0.1.0",
3
+ "@boopkit/cap-cloud-storage": "0.1.0",
4
+ "@boopkit/cap-coding": "0.1.0",
5
+ "@boopkit/cap-database": "0.1.0",
6
+ "@boopkit/cap-email": "0.1.0",
7
+ "@boopkit/cap-hello": "0.1.0",
8
+ "@boopkit/cap-noticeboard": "0.1.0",
9
+ "@boopkit/cap-product-design": "0.1.0",
10
+ "@boopkit/cap-project-mgmt": "0.1.0",
11
+ "@boopkit/cap-services": "0.1.0",
12
+ "@boopkit/cap-skills": "0.1.0",
13
+ "@boopkit/cap-testing": "0.1.0",
14
+ "@boopkit/cap-users": "0.1.0",
15
+ "@boopkit/cap-web": "0.1.0",
16
+ "@boopkit/logger": "0.1.0"
17
+ }
@@ -45,9 +45,11 @@ export declare function copyCapabilityFiles(targetDir: string, capabilityName: s
45
45
  */
46
46
  /**
47
47
  * Read the version from a @boopkit/ package's package.json and return ^version.
48
- * First tries the monorepo packages/ dir, then falls back to resolving the
49
- * installed package via require.resolve (for published CLI installs).
50
- * Falls back to '*' if neither location works.
48
+ * Fallback chain:
49
+ * 1. Monorepo packages/ dir (development)
50
+ * 2. require.resolve from CLI's node_modules
51
+ * 3. dist/capability-versions.json (baked at build time for npm installs)
52
+ * 4. '*' (last resort)
51
53
  */
52
54
  export declare function getBoopkitVersion(packageName: string): string;
53
55
  export declare function mergePackageJson(targetDir: string, dependencies?: string[], devDependencies?: string[], packages?: Record<string, string>, options?: {
@@ -276,9 +276,11 @@ function scaffoldCapabilityFiles(targetDir, filesDir) {
276
276
  */
277
277
  /**
278
278
  * Read the version from a @boopkit/ package's package.json and return ^version.
279
- * First tries the monorepo packages/ dir, then falls back to resolving the
280
- * installed package via require.resolve (for published CLI installs).
281
- * Falls back to '*' if neither location works.
279
+ * Fallback chain:
280
+ * 1. Monorepo packages/ dir (development)
281
+ * 2. require.resolve from CLI's node_modules
282
+ * 3. dist/capability-versions.json (baked at build time for npm installs)
283
+ * 4. '*' (last resort)
282
284
  */
283
285
  function getBoopkitVersion(packageName) {
284
286
  const pkgName = packageName.replace(/^@boopkit\//, '');
@@ -300,17 +302,19 @@ function getBoopkitVersion(packageName) {
300
302
  return `^${pkg.version}`;
301
303
  }
302
304
  catch {
303
- // Not found — fall back to CLI's own version as a reasonable default
305
+ // Not found via require.resolve
304
306
  }
305
- // Use CLI's own version as fallback (all @boopkit packages versioned in same range)
307
+ // Try build-time version manifest (baked into dist/ at publish time)
306
308
  try {
307
- const cliPkgJsonPath = path.join((0, config_1.getBoopRoot)(), 'package.json');
308
- const cliPkg = JSON.parse(fs.readFileSync(cliPkgJsonPath, 'utf-8'));
309
- if (cliPkg.version)
310
- return `^${cliPkg.version}`;
309
+ const manifestPath = path.join((0, config_1.getBoopRoot)(), 'dist', 'capability-versions.json');
310
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
311
+ const fullName = packageName.startsWith('@') ? packageName : `@boopkit/${pkgName}`;
312
+ if (manifest[fullName]) {
313
+ return `^${manifest[fullName]}`;
314
+ }
311
315
  }
312
316
  catch {
313
- // give up
317
+ // No manifest available
314
318
  }
315
319
  return '*';
316
320
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boopkit/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "CLI tool to scaffold new projects from boop profiles and capabilities",
5
5
  "main": "dist/cli.js",
6
6
  "workspaces": [
@@ -18,7 +18,7 @@
18
18
  "access": "public"
19
19
  },
20
20
  "scripts": {
21
- "build": "tsc",
21
+ "build": "tsc && node tools/generate-version-manifest.js",
22
22
  "dev": "tsx src/cli.ts",
23
23
  "start": "node dist/cli.js",
24
24
  "test": "jest"