@bobfrankston/npmglobalize 1.0.166 → 1.0.167
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 +5 -0
- package/lib.js +56 -4
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -24,6 +24,7 @@ Release Options:
|
|
|
24
24
|
-minor Bump minor version
|
|
25
25
|
-major Bump major version
|
|
26
26
|
-nopublish, -np Just transform, don't publish (persisted to config)
|
|
27
|
+
-publish Clear a persisted -nopublish in .globalize.json5
|
|
27
28
|
-cleanup Restore from .dependencies
|
|
28
29
|
-m, -message <msg> Custom commit message (forces release even without changes)
|
|
29
30
|
If -m not given and a .commitmsg file exists in cwd, its
|
|
@@ -158,6 +159,10 @@ function parseArgs(args) {
|
|
|
158
159
|
options.noPublish = true;
|
|
159
160
|
options.explicitKeys.add('noPublish');
|
|
160
161
|
break;
|
|
162
|
+
case '-publish':
|
|
163
|
+
options.noPublish = false;
|
|
164
|
+
options.explicitKeys.add('noPublish');
|
|
165
|
+
break;
|
|
161
166
|
case '-cleanup':
|
|
162
167
|
options.cleanup = true;
|
|
163
168
|
break;
|
package/lib.js
CHANGED
|
@@ -3143,8 +3143,6 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3143
3143
|
settings.push('--dry-run');
|
|
3144
3144
|
if (configOptions.bump)
|
|
3145
3145
|
settings.push(`--bump ${configOptions.bump}`);
|
|
3146
|
-
if (configOptions.noPublish)
|
|
3147
|
-
settings.push('--no-publish');
|
|
3148
3146
|
if (configOptions.cleanup)
|
|
3149
3147
|
settings.push('--cleanup');
|
|
3150
3148
|
if (configOptions.wsl)
|
|
@@ -3172,6 +3170,9 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3172
3170
|
if (settings.length > 0) {
|
|
3173
3171
|
console.log(colors.dim(`Settings from .globalize.json5: ${settings.join(', ')}`));
|
|
3174
3172
|
}
|
|
3173
|
+
if (configOptions.noPublish) {
|
|
3174
|
+
console.log(colors.yellow(`! noPublish=true in .globalize.json5 — transform only, no npm publish (clear with -publish)`));
|
|
3175
|
+
}
|
|
3175
3176
|
}
|
|
3176
3177
|
console.log('');
|
|
3177
3178
|
// -local: skip all transform/publish, just install from local directory with file: deps intact
|
|
@@ -3526,10 +3527,14 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3526
3527
|
}
|
|
3527
3528
|
// Read package.json
|
|
3528
3529
|
const pkg = readPackageJson(cwd);
|
|
3530
|
+
// Ensure node_modules are present in this dir and every transitive file: dep
|
|
3531
|
+
// before doing anything else. Independent of build script presence — a dep
|
|
3532
|
+
// with new declared deps still needs its own `npm install` even if it has
|
|
3533
|
+
// no build step. CLI entrypoint already ran this, so skip when _fromCli.
|
|
3534
|
+
if (!options._fromCli && !dryRun)
|
|
3535
|
+
ensureFileDepModules(cwd, verbose);
|
|
3529
3536
|
// Run build step if package.json has a build script (skip if CLI already built)
|
|
3530
3537
|
if (pkg.scripts?.build && !options._fromCli) {
|
|
3531
|
-
if (!dryRun)
|
|
3532
|
-
ensureFileDepModules(cwd, verbose);
|
|
3533
3538
|
console.log(`${timestamp()} Running build...`);
|
|
3534
3539
|
if (!dryRun) {
|
|
3535
3540
|
// For workspace roots whose build invokes `--workspaces`, npm uses
|
|
@@ -4147,6 +4152,36 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
4147
4152
|
}
|
|
4148
4153
|
}
|
|
4149
4154
|
}
|
|
4155
|
+
// Highlighted summary so noPublish (and other surprises) don't slip past unnoticed
|
|
4156
|
+
const finalPkg2 = readPackageJson(cwd);
|
|
4157
|
+
const surprises = [];
|
|
4158
|
+
const fromConfig = (k) => k in configOptions ? ' (from .globalize.json5)' : '';
|
|
4159
|
+
surprises.push(`noPublish=true${fromConfig('noPublish')} — nothing was published; clear with -publish`);
|
|
4160
|
+
if (configOptions.forcePublish || forcePublish)
|
|
4161
|
+
surprises.push(`forcePublish=true${fromConfig('forcePublish')}`);
|
|
4162
|
+
if (configOptions.publishDeps === false || publishDeps === false)
|
|
4163
|
+
surprises.push(`publishDeps=false${fromConfig('publishDeps')} — file: deps NOT republished`);
|
|
4164
|
+
if (configOptions.usePaths === false || usePaths === false)
|
|
4165
|
+
surprises.push(`usePaths=false${fromConfig('usePaths')} — file: deps resolved from npm, not siblings`);
|
|
4166
|
+
if (configOptions.freeze || freeze)
|
|
4167
|
+
surprises.push(`freeze=true${fromConfig('freeze')}`);
|
|
4168
|
+
if (configOptions.local || local)
|
|
4169
|
+
surprises.push(`local=true${fromConfig('local')}`);
|
|
4170
|
+
if (configOptions.files === false || files === false)
|
|
4171
|
+
surprises.push(`files=false${fromConfig('files')} — npm versions left in package.json`);
|
|
4172
|
+
if (configOptions.allowTs === true || allowTs === true)
|
|
4173
|
+
surprises.push(`allowTs=true${fromConfig('allowTs')} — .ts source kept in tarball`);
|
|
4174
|
+
console.log('');
|
|
4175
|
+
console.log(colors.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
4176
|
+
console.log(colors.yellow('! Transform Summary (NO PUBLISH)'));
|
|
4177
|
+
console.log(colors.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
4178
|
+
console.log(` Package: ${colors.green(finalPkg2.name)}`);
|
|
4179
|
+
console.log(` Version: ${colors.green('v' + finalPkg2.version)}`);
|
|
4180
|
+
console.log(` Published: ${colors.red('✗')}`);
|
|
4181
|
+
for (const s of surprises)
|
|
4182
|
+
console.log(` ${colors.yellow('!')} ${s}`);
|
|
4183
|
+
console.log(colors.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
4184
|
+
console.log('');
|
|
4150
4185
|
return true;
|
|
4151
4186
|
}
|
|
4152
4187
|
// Skip if private
|
|
@@ -5208,6 +5243,23 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
5208
5243
|
if (files && transformResult.transformed) {
|
|
5209
5244
|
console.log(` Restored file: deps: ${colors.green('✓')}`);
|
|
5210
5245
|
}
|
|
5246
|
+
// Surface non-default settings the user may have forgotten about
|
|
5247
|
+
{
|
|
5248
|
+
const surprises = [];
|
|
5249
|
+
const fromConfig = (k) => k in configOptions ? ' (from .globalize.json5)' : '';
|
|
5250
|
+
if (configOptions.forcePublish || forcePublish)
|
|
5251
|
+
surprises.push(`forcePublish=true${fromConfig('forcePublish')}`);
|
|
5252
|
+
if (configOptions.publishDeps === false || publishDeps === false)
|
|
5253
|
+
surprises.push(`publishDeps=false${fromConfig('publishDeps')} — file: deps NOT republished`);
|
|
5254
|
+
if (configOptions.usePaths === false || usePaths === false)
|
|
5255
|
+
surprises.push(`usePaths=false${fromConfig('usePaths')} — file: deps resolved from npm, not siblings`);
|
|
5256
|
+
if (configOptions.files === false || files === false)
|
|
5257
|
+
surprises.push(`files=false${fromConfig('files')} — npm versions left in package.json`);
|
|
5258
|
+
if (configOptions.allowTs === true || allowTs === true)
|
|
5259
|
+
surprises.push(`allowTs=true${fromConfig('allowTs')} — .ts source kept in tarball`);
|
|
5260
|
+
for (const s of surprises)
|
|
5261
|
+
console.log(` ${colors.yellow('!')} ${s}`);
|
|
5262
|
+
}
|
|
5211
5263
|
console.log(colors.green('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
5212
5264
|
console.log('');
|
|
5213
5265
|
// Only show "To use run" message if package provides commands (has bin field)
|