@bobfrankston/npmglobalize 1.0.134 → 1.0.136
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 +9 -0
- package/package.json +1 -1
package/lib.js
CHANGED
|
@@ -1894,6 +1894,15 @@ function ensureGitignore(cwd) {
|
|
|
1894
1894
|
fs.writeFileSync(gitignorePath, content);
|
|
1895
1895
|
console.log(colors.green(' ✓ .gitignore updated'));
|
|
1896
1896
|
}
|
|
1897
|
+
// Untrack node_modules if already committed to git
|
|
1898
|
+
const nmTracked = spawnSafe('git', ['ls-files', 'node_modules/'], {
|
|
1899
|
+
cwd, encoding: 'utf-8', stdio: 'pipe', shell: true
|
|
1900
|
+
});
|
|
1901
|
+
if (nmTracked.status === 0 && nmTracked.stdout?.trim()) {
|
|
1902
|
+
console.log(colors.yellow(' Untracking node_modules from git...'));
|
|
1903
|
+
runCommand('git', ['rm', '-r', '--cached', 'node_modules/'], { cwd, silent: true });
|
|
1904
|
+
gitCommit('Untrack node_modules', cwd);
|
|
1905
|
+
}
|
|
1897
1906
|
}
|
|
1898
1907
|
/** Ensure .npmignore exists with recommended patterns */
|
|
1899
1908
|
function ensureNpmignore(cwd) {
|