@bobfrankston/npmglobalize 1.0.136 → 1.0.137
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 +12 -8
- package/package.json +1 -1
package/lib.js
CHANGED
|
@@ -697,7 +697,18 @@ function hasLocalChanges(packageName, version, targetPath, verbose) {
|
|
|
697
697
|
}
|
|
698
698
|
return true;
|
|
699
699
|
}
|
|
700
|
-
// Check 2: Compare latest commit time
|
|
700
|
+
// Check 2: Compare latest non-bookkeeping commit time vs npm publish time
|
|
701
|
+
// Skip npmglobalize's own commits (restore deps, pre-release, cleanup)
|
|
702
|
+
const bookkeepingPatterns = ['Restore file: dependencies', 'Pre-release commit', 'Pre-version cleanup', 'Untrack node_modules'];
|
|
703
|
+
const logResult = spawnSafe('git', ['-C', targetPath, 'log', '-1', '--format=%aI',
|
|
704
|
+
'--invert-grep', ...bookkeepingPatterns.map(p => `--grep=${p}`),
|
|
705
|
+
'--', '.'], {
|
|
706
|
+
encoding: 'utf-8',
|
|
707
|
+
stdio: 'pipe',
|
|
708
|
+
shell: true
|
|
709
|
+
});
|
|
710
|
+
if (logResult.status !== 0 || !logResult.stdout.trim())
|
|
711
|
+
return false;
|
|
701
712
|
const timeResult = spawnSafe('npm', ['view', packageName, 'time', '--json'], {
|
|
702
713
|
encoding: 'utf-8',
|
|
703
714
|
stdio: 'pipe',
|
|
@@ -710,13 +721,6 @@ function hasLocalChanges(packageName, version, targetPath, verbose) {
|
|
|
710
721
|
if (!publishTime)
|
|
711
722
|
return false;
|
|
712
723
|
const publishDate = new Date(publishTime);
|
|
713
|
-
const logResult = spawnSafe('git', ['-C', targetPath, 'log', '-1', '--format=%aI', '--', '.'], {
|
|
714
|
-
encoding: 'utf-8',
|
|
715
|
-
stdio: 'pipe',
|
|
716
|
-
shell: true
|
|
717
|
-
});
|
|
718
|
-
if (logResult.status !== 0 || !logResult.stdout.trim())
|
|
719
|
-
return false;
|
|
720
724
|
const latestCommitDate = new Date(logResult.stdout.trim());
|
|
721
725
|
if (latestCommitDate > publishDate) {
|
|
722
726
|
if (verbose) {
|