@bobfrankston/npmglobalize 1.0.182 → 1.0.183

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 +17 -10
  2. package/package.json +1 -1
package/lib.js CHANGED
@@ -3883,10 +3883,10 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
3883
3883
  if (adoptable) {
3884
3884
  choice = await promptChoice('How would you like to set up git?\n'
3885
3885
  + ' 1) Adopt history from existing remote (recommended)\n'
3886
- + ' 2) Initialize fresh git repository\n'
3887
3886
  + ' a) Adopt ALL (don\'t ask again for remaining deps)\n'
3887
+ + ' 2) Initialize fresh git repository\n'
3888
3888
  + ' 3) Use local install only (skip git/publish)\n'
3889
- + ' 4) Abort\nChoice:', ['1', '2', 'a', '3', '4', '']);
3889
+ + ' 4) Abort\nChoice:', ['1', 'a', '2', '3', '4', '']);
3890
3890
  if (choice === '3') {
3891
3891
  console.log(colors.dim('Switching to local-only mode...'));
3892
3892
  writeConfig(cwd, { ...configOptions, local: true }, new Set(['local']));
@@ -5591,11 +5591,13 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
5591
5591
  if (!publishResult.success) {
5592
5592
  // Check for specific error types before recording
5593
5593
  const output = (publishResult.output + '\n' + publishResult.stderr).toLowerCase();
5594
+ let alreadyPublished = false;
5594
5595
  // "Already published" is benign — don't record as error
5595
5596
  if (output.includes('cannot publish over') || output.includes('previously published')) {
5596
5597
  const currentPkgVersion = readPackageJson(cwd).version;
5597
5598
  if (output.includes(currentPkgVersion)) {
5598
5599
  console.log(colors.green('✓ Already published — continuing'));
5600
+ alreadyPublished = true;
5599
5601
  }
5600
5602
  else {
5601
5603
  console.error(colors.red('\nERROR: npm publish failed\n'));
@@ -5644,15 +5646,20 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
5644
5646
  recordBuildIssue(pkg.name || path.basename(cwd), 'error', 'npm publish failed');
5645
5647
  console.error(colors.yellow('Publish failed — run npm login or check npm whoami'));
5646
5648
  }
5647
- if (transformResult.transformed) {
5648
- console.log('Restoring file: dependencies...');
5649
- const failPkg = readPackageJson(cwd);
5650
- restoreDeps(failPkg, verbose);
5651
- writePackageJson(cwd, failPkg);
5652
- runCommand('git', ['add', 'package.json'], { cwd, silent: true });
5653
- gitCommit('Restore file: dependencies', cwd);
5649
+ if (alreadyPublished) {
5650
+ // Treat as success — fall through to post-publish steps (push, tags, .commitmsg)
5651
+ }
5652
+ else {
5653
+ if (transformResult.transformed) {
5654
+ console.log('Restoring file: dependencies...');
5655
+ const failPkg = readPackageJson(cwd);
5656
+ restoreDeps(failPkg, verbose);
5657
+ writePackageJson(cwd, failPkg);
5658
+ runCommand('git', ['add', 'package.json'], { cwd, silent: true });
5659
+ gitCommit('Restore file: dependencies', cwd);
5660
+ }
5661
+ return false;
5654
5662
  }
5655
- return false;
5656
5663
  }
5657
5664
  // Determine what was published
5658
5665
  const finalAccess = effectiveNpmVisibility || currentAccess || (isScoped ? 'restricted' : 'public');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/npmglobalize",
3
- "version": "1.0.182",
3
+ "version": "1.0.183",
4
4
  "description": "Transform file: dependencies to npm versions for publishing",
5
5
  "main": "index.js",
6
6
  "type": "module",