@bobfrankston/npmglobalize 1.0.20 → 1.0.21

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 +11 -5
  2. package/package.json +1 -1
package/lib.js CHANGED
@@ -1192,6 +1192,10 @@ export async function globalize(cwd, options = {}) {
1192
1192
  console.log(' [dry-run] Would run npm audit');
1193
1193
  }
1194
1194
  }
1195
+ else if (fix && !dryRun) {
1196
+ // Run fix even if no deps changed
1197
+ runNpmAudit(cwd, fix, verbose);
1198
+ }
1195
1199
  if (noPublish) {
1196
1200
  console.log('Transform complete (--nopublish mode).');
1197
1201
  return true;
@@ -1417,8 +1421,9 @@ export async function globalize(cwd, options = {}) {
1417
1421
  }
1418
1422
  }
1419
1423
  // Global install
1420
- const pkgName = pkg.name;
1421
- const pkgVersion = pkg.version;
1424
+ const updatedPkg = readPackageJson(cwd); // Re-read to get updated version
1425
+ const pkgName = updatedPkg.name;
1426
+ const pkgVersion = updatedPkg.version;
1422
1427
  if (install) {
1423
1428
  console.log(`Installing globally: ${pkgName}@${pkgVersion}...`);
1424
1429
  if (!dryRun) {
@@ -1485,9 +1490,10 @@ export async function globalize(cwd, options = {}) {
1485
1490
  console.log('Keeping npm versions (--nofiles mode).');
1486
1491
  }
1487
1492
  console.log('Done!');
1488
- // Run final audit if dependencies were transformed or fix was requested
1489
- if ((fix || updateDeps || transformResult.transformed) && !dryRun) {
1490
- runNpmAudit(cwd, false, verbose); // Don't fix again, just report
1493
+ // Run final audit report if not already run
1494
+ const auditAlreadyRun = (fix || updateDeps) && (transformResult.transformed || alreadyTransformed || updateDeps);
1495
+ if (!auditAlreadyRun && (fix || updateDeps || transformResult.transformed) && !dryRun) {
1496
+ runNpmAudit(cwd, false, verbose); // Just report, don't fix again
1491
1497
  }
1492
1498
  // Print summary
1493
1499
  console.log('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/npmglobalize",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Transform file: dependencies to npm versions for publishing",
5
5
  "main": "index.js",
6
6
  "type": "module",