@bobfrankston/npmglobalize 1.0.130 → 1.0.132
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.
- package/lib.js +31 -3
- package/package.json +1 -1
package/lib.js
CHANGED
|
@@ -3451,6 +3451,19 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3451
3451
|
console.log(' Pulled latest from remote');
|
|
3452
3452
|
}
|
|
3453
3453
|
}
|
|
3454
|
+
// Ensure clean working tree before version bump (catch stray changes from pull/rebase/watchers)
|
|
3455
|
+
if (!dryRun) {
|
|
3456
|
+
const preVersionStatus = spawnSafe('git', ['status', '--porcelain'], {
|
|
3457
|
+
encoding: 'utf-8', stdio: 'pipe', shell: true
|
|
3458
|
+
});
|
|
3459
|
+
if (preVersionStatus.status === 0 && preVersionStatus.stdout.trim()) {
|
|
3460
|
+
if (verbose) {
|
|
3461
|
+
console.log('Committing stray changes before version bump...');
|
|
3462
|
+
}
|
|
3463
|
+
runCommand('git', ['add', '-A'], { cwd, silent: true });
|
|
3464
|
+
gitCommit('Pre-version cleanup', cwd);
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3454
3467
|
// Version bump (skip if republishing a version that's already bumped locally)
|
|
3455
3468
|
if (skipVersionBump) {
|
|
3456
3469
|
console.log(`Skipping version bump — ${pkg.version} already set locally.`);
|
|
@@ -3826,7 +3839,12 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3826
3839
|
console.error(' Just run npmglobalize again (it will bump to next version)');
|
|
3827
3840
|
console.error('');
|
|
3828
3841
|
if (transformResult.transformed) {
|
|
3829
|
-
console.log('
|
|
3842
|
+
console.log('Restoring file: dependencies...');
|
|
3843
|
+
const failPkg = readPackageJson(cwd);
|
|
3844
|
+
restoreDeps(failPkg, verbose);
|
|
3845
|
+
writePackageJson(cwd, failPkg);
|
|
3846
|
+
runCommand('git', ['add', 'package.json'], { cwd, silent: true });
|
|
3847
|
+
gitCommit('Restore file: dependencies', cwd);
|
|
3830
3848
|
}
|
|
3831
3849
|
return false;
|
|
3832
3850
|
}
|
|
@@ -3838,7 +3856,12 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3838
3856
|
console.error(' 3. Scope (@username) requires authentication');
|
|
3839
3857
|
console.error('');
|
|
3840
3858
|
if (transformResult.transformed) {
|
|
3841
|
-
console.log('
|
|
3859
|
+
console.log('Restoring file: dependencies...');
|
|
3860
|
+
const failPkg = readPackageJson(cwd);
|
|
3861
|
+
restoreDeps(failPkg, verbose);
|
|
3862
|
+
writePackageJson(cwd, failPkg);
|
|
3863
|
+
runCommand('git', ['add', 'package.json'], { cwd, silent: true });
|
|
3864
|
+
gitCommit('Restore file: dependencies', cwd);
|
|
3842
3865
|
}
|
|
3843
3866
|
return false;
|
|
3844
3867
|
}
|
|
@@ -3857,7 +3880,12 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3857
3880
|
console.error('');
|
|
3858
3881
|
}
|
|
3859
3882
|
if (transformResult.transformed) {
|
|
3860
|
-
console.log('
|
|
3883
|
+
console.log('Restoring file: dependencies...');
|
|
3884
|
+
const failPkg = readPackageJson(cwd);
|
|
3885
|
+
restoreDeps(failPkg, verbose);
|
|
3886
|
+
writePackageJson(cwd, failPkg);
|
|
3887
|
+
runCommand('git', ['add', 'package.json'], { cwd, silent: true });
|
|
3888
|
+
gitCommit('Restore file: dependencies', cwd);
|
|
3861
3889
|
}
|
|
3862
3890
|
return false;
|
|
3863
3891
|
}
|