@bobfrankston/npmglobalize 1.0.31 → 1.0.32
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/cli.js +3 -0
- package/lib.d.ts +2 -0
- package/lib.js +32 -1
- package/package.json +1 -1
package/cli.js
CHANGED
package/lib.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export interface GlobalizeOptions {
|
|
|
49
49
|
fixTags?: boolean;
|
|
50
50
|
/** Automatically rebase if local is behind remote */
|
|
51
51
|
rebase?: boolean;
|
|
52
|
+
/** Show package.json dependency changes */
|
|
53
|
+
show?: boolean;
|
|
52
54
|
}
|
|
53
55
|
/** Read and parse package.json from a directory */
|
|
54
56
|
export declare function readPackageJson(dir: string): any;
|
package/lib.js
CHANGED
|
@@ -1085,7 +1085,7 @@ export function getToolVersion() {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
export async function globalize(cwd, options = {}) {
|
|
1087
1087
|
const { bump = 'patch', noPublish = false, cleanup = false, install = false, wsl = false, force = false, files = true, dryRun = false, quiet = true, verbose = false, init = false, gitVisibility = 'private', npmVisibility = 'public', message, conform = false, asis = false, updateDeps = false, updateMajor = false, publishDeps = true, // Default to publishing deps for safety
|
|
1088
|
-
forcePublish = false, fix = false, fixTags = false, rebase = false } = options;
|
|
1088
|
+
forcePublish = false, fix = false, fixTags = false, rebase = false, show = false } = options;
|
|
1089
1089
|
// Show tool version
|
|
1090
1090
|
const toolVersion = getToolVersion();
|
|
1091
1091
|
console.log(colors.italic(`npmglobalize v${toolVersion}`));
|
|
@@ -1344,6 +1344,27 @@ export async function globalize(cwd, options = {}) {
|
|
|
1344
1344
|
const transformResult = transformDeps(pkg, cwd, verbose, forcePublish);
|
|
1345
1345
|
if (transformResult.transformed) {
|
|
1346
1346
|
console.log(' Dependencies transformed.');
|
|
1347
|
+
// Show dependency changes if requested
|
|
1348
|
+
if (show || verbose) {
|
|
1349
|
+
console.log('');
|
|
1350
|
+
console.log(colors.italic('Dependency changes:'));
|
|
1351
|
+
for (const key of DEP_KEYS) {
|
|
1352
|
+
const backupKey = '.' + key;
|
|
1353
|
+
if (pkg[backupKey]) {
|
|
1354
|
+
console.log('');
|
|
1355
|
+
console.log(colors.yellow(`${key}:`));
|
|
1356
|
+
const original = pkg[backupKey];
|
|
1357
|
+
const transformed = pkg[key];
|
|
1358
|
+
for (const [name, origValue] of Object.entries(original)) {
|
|
1359
|
+
const newValue = transformed?.[name];
|
|
1360
|
+
console.log(` ${name}:`);
|
|
1361
|
+
console.log(` ${colors.red('- ' + origValue)}`);
|
|
1362
|
+
console.log(` ${colors.green('+ ' + newValue)}`);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
console.log('');
|
|
1367
|
+
}
|
|
1347
1368
|
// Check if target packages need to be published
|
|
1348
1369
|
if (transformResult.unpublished.length > 0) {
|
|
1349
1370
|
console.log('');
|
|
@@ -1531,6 +1552,11 @@ export async function globalize(cwd, options = {}) {
|
|
|
1531
1552
|
delete pkg.scripts.postversion;
|
|
1532
1553
|
writePackageJson(cwd, pkg);
|
|
1533
1554
|
postversDisabled = true;
|
|
1555
|
+
// Commit this change so working directory is clean for version bump
|
|
1556
|
+
const addResult = runCommand('git', ['add', 'package.json'], { cwd, silent: true });
|
|
1557
|
+
if (addResult.success) {
|
|
1558
|
+
runCommand('git', ['commit', '-m', 'Temporarily disable postversion hook'], { cwd, silent: true });
|
|
1559
|
+
}
|
|
1534
1560
|
}
|
|
1535
1561
|
try {
|
|
1536
1562
|
// Use libnpmversion - it will create commit and tag automatically
|
|
@@ -1545,6 +1571,11 @@ export async function globalize(cwd, options = {}) {
|
|
|
1545
1571
|
updatedPkg.scripts = {};
|
|
1546
1572
|
updatedPkg.scripts.postversion = originalPostversion;
|
|
1547
1573
|
writePackageJson(cwd, updatedPkg);
|
|
1574
|
+
// Commit the restoration
|
|
1575
|
+
const addResult = runCommand('git', ['add', 'package.json'], { cwd, silent: true });
|
|
1576
|
+
if (addResult.success) {
|
|
1577
|
+
runCommand('git', ['commit', '--amend', '--no-edit'], { cwd, silent: true });
|
|
1578
|
+
}
|
|
1548
1579
|
if (verbose) {
|
|
1549
1580
|
console.log('Restored postversion hook');
|
|
1550
1581
|
}
|