@bobfrankston/npmglobalize 1.0.94 → 1.0.96

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.
@@ -30,7 +30,8 @@
30
30
  "Bash(onboard --help:*)",
31
31
  "Bash(npmglobalize:*)",
32
32
  "Bash(npm whoami:*)",
33
- "Bash(where npmglobalize:*)"
33
+ "Bash(where npmglobalize:*)",
34
+ "Bash(npm audit:*)"
34
35
  ]
35
36
  }
36
37
  }
package/lib.js CHANGED
@@ -1595,26 +1595,24 @@ export function getToolVersion() {
1595
1595
  return 'unknown';
1596
1596
  }
1597
1597
  }
1598
- /** Offer to add a bin field if missing — returns true if bin was added or already existed */
1598
+ /** Offer to add a bin field if missing — returns true if bin was added, false to skip/abort */
1599
1599
  async function offerAddBin(cwd, pkg) {
1600
1600
  if (pkg.bin)
1601
1601
  return true;
1602
1602
  // Determine likely entry point
1603
1603
  const mainFile = pkg.main || 'index.js';
1604
1604
  const cmdName = (pkg.name || path.basename(cwd)).replace(/^@[^/]+\//, '');
1605
- console.log(colors.yellow('No bin field — this package won\'t install as a CLI command.'));
1606
- const choice = await promptChoice(`Add bin field to make it a CLI tool?\n 1) Yes, use "${cmdName}" → "${mainFile}" (default)\n 2) No, install as library link\n 3) Abort\nChoice:`, ['1', '2', '3', '']);
1607
- if (choice === '3')
1608
- return false;
1609
- if (choice === '2') {
1610
- console.log(colors.dim('Installing as library link (no bin)...'));
1605
+ console.log(colors.yellow('No bin field — this is a library, not a CLI tool.'));
1606
+ console.log(colors.yellow('Libraries should not be installed globally. Use npm install <name> in projects instead.'));
1607
+ const choice = await promptChoice(`Add bin field to make it a CLI tool?\n 1) Yes, use "${cmdName}" → "${mainFile}"\n 2) Skip global install (default)\nChoice:`, ['1', '2', '']);
1608
+ if (choice === '1') {
1609
+ pkg.bin = { [cmdName]: mainFile };
1610
+ writePackageJson(cwd, pkg);
1611
+ console.log(colors.green(`✓ Added bin: { "${cmdName}": "${mainFile}" }`));
1611
1612
  return true;
1612
1613
  }
1613
- // choice is '1' or '' (default)
1614
- pkg.bin = { [cmdName]: mainFile };
1615
- writePackageJson(cwd, pkg);
1616
- console.log(colors.green(`✓ Added bin: { "${cmdName}": "${mainFile}" }`));
1617
- return true;
1614
+ // choice is '2' or '' (default) — skip
1615
+ return false;
1618
1616
  }
1619
1617
  /** Perform local-only install (npm install -g .) — extracted for reuse from git-init prompts */
1620
1618
  async function doLocalInstall(cwd, options) {
@@ -1626,8 +1624,11 @@ async function doLocalInstall(cwd, options) {
1626
1624
  console.log(colors.dim('Skipping transform/publish — installing with file: deps as-is'));
1627
1625
  if (!pkg.bin) {
1628
1626
  const proceed = await offerAddBin(cwd, pkg);
1629
- if (!proceed)
1630
- return false;
1627
+ if (!proceed) {
1628
+ console.log(colors.yellow('Skipping global install — library packages should not be installed globally.'));
1629
+ console.log(colors.yellow(`To use in projects: npm install ${pkgName}`));
1630
+ return true;
1631
+ }
1631
1632
  }
1632
1633
  if (dryRun) {
1633
1634
  console.log(' [dry-run] Would run: npm install -g .');
@@ -1729,8 +1730,11 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
1729
1730
  console.log(colors.dim('Skipping transform/publish — installing with file: deps as-is'));
1730
1731
  if (!pkg.bin) {
1731
1732
  const proceed = await offerAddBin(cwd, pkg);
1732
- if (!proceed)
1733
- return false;
1733
+ if (!proceed) {
1734
+ console.log(colors.yellow('Skipping global install — library packages should not be installed globally.'));
1735
+ console.log(colors.yellow(`To use in projects: npm install ${pkgName}`));
1736
+ return true;
1737
+ }
1734
1738
  }
1735
1739
  if (dryRun) {
1736
1740
  console.log(' [dry-run] Would run: npm install -g .');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/npmglobalize",
3
- "version": "1.0.94",
3
+ "version": "1.0.96",
4
4
  "description": "Transform file: dependencies to npm versions for publishing",
5
5
  "main": "index.js",
6
6
  "type": "module",