@bobfrankston/npmglobalize 1.0.62 → 1.0.63

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.
Files changed (2) hide show
  1. package/lib.js +62 -46
  2. package/package.json +1 -1
package/lib.js CHANGED
@@ -1740,28 +1740,34 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
1740
1740
  console.log('Installing from local directory...');
1741
1741
  }
1742
1742
  const pkgName = pkg.name;
1743
- if (install) {
1744
- console.log(`Installing ${pkgName} globally from local directory...`);
1745
- const localInstallResult = runCommand('npm', ['install', '-g', '.'], { cwd, silent: false });
1746
- if (localInstallResult.success) {
1747
- const version = pkg.version;
1748
- console.log(colors.green(`✓ Installed globally: ${pkgName}@${version}`));
1749
- }
1750
- else {
1751
- console.error(colors.red(`✗ Global install failed`));
1752
- console.error(colors.yellow(' Try running manually: npm install -g .'));
1753
- }
1743
+ if (!pkg.bin && (install || wsl)) {
1744
+ console.log(colors.yellow('Note: This is a library (no bin field), skipping global installation.'));
1745
+ console.log(colors.yellow('To use in projects: npm install ' + pkgName));
1754
1746
  }
1755
- if (wsl) {
1756
- console.log(`Installing ${pkgName} in WSL from local directory...`);
1757
- const wslInstallResult = runCommand('wsl', ['npm', 'install', '-g', '.'], { cwd, silent: false });
1758
- if (wslInstallResult.success) {
1759
- const version = pkg.version;
1760
- console.log(colors.green(`✓ Installed in WSL: ${pkgName}@${version}`));
1747
+ else {
1748
+ if (install) {
1749
+ console.log(`Installing ${pkgName} globally from local directory...`);
1750
+ const localInstallResult = runCommand('npm', ['install', '-g', '.'], { cwd, silent: false });
1751
+ if (localInstallResult.success) {
1752
+ const version = pkg.version;
1753
+ console.log(colors.green(`✓ Installed globally: ${pkgName}@${version}`));
1754
+ }
1755
+ else {
1756
+ console.error(colors.red(`✗ Global install failed`));
1757
+ console.error(colors.yellow(' Try running manually: npm install -g .'));
1758
+ }
1761
1759
  }
1762
- else {
1763
- console.error(colors.red(`✗ WSL install failed`));
1764
- console.error(colors.yellow(' Try running manually in WSL: npm install -g .'));
1760
+ if (wsl) {
1761
+ console.log(`Installing ${pkgName} in WSL from local directory...`);
1762
+ const wslInstallResult = runCommand('wsl', ['npm', 'install', '-g', '.'], { cwd, silent: false });
1763
+ if (wslInstallResult.success) {
1764
+ const version = pkg.version;
1765
+ console.log(colors.green(`✓ Installed in WSL: ${pkgName}@${version}`));
1766
+ }
1767
+ else {
1768
+ console.error(colors.red(`✗ WSL install failed`));
1769
+ console.error(colors.yellow(' Try running manually in WSL: npm install -g .'));
1770
+ }
1765
1771
  }
1766
1772
  }
1767
1773
  }
@@ -2180,38 +2186,44 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
2180
2186
  const updatedPkg = readPackageJson(cwd); // Re-read to get updated version
2181
2187
  const pkgName = updatedPkg.name;
2182
2188
  const pkgVersion = updatedPkg.version;
2183
- if (install) {
2184
- console.log(`Installing globally: ${pkgName}@${pkgVersion}...`);
2185
- if (!dryRun) {
2186
- // Install from local directory (faster and works immediately after publish)
2187
- const installResult = runCommand('npm', ['install', '-g', '.'], { cwd, silent: false });
2188
- if (installResult.success) {
2189
- console.log(colors.green(`✓ Installed globally: ${pkgName}@${pkgVersion}`));
2189
+ if (!updatedPkg.bin && (install || wsl)) {
2190
+ console.log(colors.yellow('Note: This is a library (no bin field), skipping global installation.'));
2191
+ console.log(colors.yellow('To use in projects: npm install ' + pkgName));
2192
+ }
2193
+ else {
2194
+ if (install) {
2195
+ console.log(`Installing globally: ${pkgName}@${pkgVersion}...`);
2196
+ if (!dryRun) {
2197
+ // Install from local directory (faster and works immediately after publish)
2198
+ const installResult = runCommand('npm', ['install', '-g', '.'], { cwd, silent: false });
2199
+ if (installResult.success) {
2200
+ console.log(colors.green(`✓ Installed globally: ${pkgName}@${pkgVersion}`));
2201
+ }
2202
+ else {
2203
+ console.error(colors.red(`✗ Global install failed`));
2204
+ console.error(colors.yellow(' Try running manually: npm install -g .'));
2205
+ }
2190
2206
  }
2191
2207
  else {
2192
- console.error(colors.red(`✗ Global install failed`));
2193
- console.error(colors.yellow(' Try running manually: npm install -g .'));
2208
+ console.log(` [dry-run] Would run: npm install -g .`);
2194
2209
  }
2195
2210
  }
2196
- else {
2197
- console.log(` [dry-run] Would run: npm install -g .`);
2198
- }
2199
- }
2200
- if (wsl) {
2201
- console.log(`Installing in WSL: ${pkgName}@${pkgVersion}...`);
2202
- if (!dryRun) {
2203
- // Install from local directory in WSL
2204
- const wslResult = runCommand('wsl', ['npm', 'install', '-g', '.'], { cwd, silent: false });
2205
- if (wslResult.success) {
2206
- console.log(colors.green(`✓ Installed in WSL: ${pkgName}@${pkgVersion}`));
2211
+ if (wsl) {
2212
+ console.log(`Installing in WSL: ${pkgName}@${pkgVersion}...`);
2213
+ if (!dryRun) {
2214
+ // Install from local directory in WSL
2215
+ const wslResult = runCommand('wsl', ['npm', 'install', '-g', '.'], { cwd, silent: false });
2216
+ if (wslResult.success) {
2217
+ console.log(colors.green(`✓ Installed in WSL: ${pkgName}@${pkgVersion}`));
2218
+ }
2219
+ else {
2220
+ console.error(colors.yellow('✗ WSL install failed (is npm installed in WSL?)'));
2221
+ }
2207
2222
  }
2208
2223
  else {
2209
- console.error(colors.yellow('✗ WSL install failed (is npm installed in WSL?)'));
2224
+ console.log(` [dry-run] Would run: wsl npm install -g ${pkgName}`);
2210
2225
  }
2211
2226
  }
2212
- else {
2213
- console.log(` [dry-run] Would run: wsl npm install -g ${pkgName}`);
2214
- }
2215
2227
  }
2216
2228
  // Finalize - restore file: paths if --files mode (default)
2217
2229
  if (files && transformResult.transformed) {
@@ -2260,8 +2272,12 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
2260
2272
  }
2261
2273
  console.log(colors.green('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
2262
2274
  console.log('');
2263
- console.log(`To use run: ${colors.green(finalPkg.name.includes('/') ? finalPkg.name.split('/')[1] : finalPkg.name)}`);
2264
- console.log('');
2275
+ // Only show "To use run" message if package provides commands (has bin field)
2276
+ if (finalPkg.bin) {
2277
+ const commandName = finalPkg.name.includes('/') ? finalPkg.name.split('/')[1] : finalPkg.name;
2278
+ console.log(`To use run: ${colors.green(commandName)}`);
2279
+ console.log('');
2280
+ }
2265
2281
  return true;
2266
2282
  }
2267
2283
  export default {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/npmglobalize",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "description": "Transform file: dependencies to npm versions for publishing",
5
5
  "main": "index.js",
6
6
  "type": "module",