@bobfrankston/npmglobalize 1.0.81 → 1.0.82
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/README.md +72 -19
- package/lib.js +6 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -224,29 +224,36 @@ Publishing requires being on a branch so commits and tags can be properly tracke
|
|
|
224
224
|
|
|
225
225
|
## Command Reference
|
|
226
226
|
|
|
227
|
+
<!-- NOTE: Keep this in sync with the --help output in cli.ts printHelp().
|
|
228
|
+
The README expands on options with examples and context;
|
|
229
|
+
cli.ts is the concise quick-reference. Update both when adding/changing flags. -->
|
|
230
|
+
|
|
227
231
|
### Release Options
|
|
228
232
|
```
|
|
229
|
-
--patch
|
|
230
|
-
--minor
|
|
231
|
-
--major
|
|
232
|
-
--nopublish, -np
|
|
233
|
-
--cleanup
|
|
233
|
+
--patch Bump patch version (default)
|
|
234
|
+
--minor Bump minor version
|
|
235
|
+
--major Bump major version
|
|
236
|
+
--nopublish, -np Just transform, don't publish
|
|
237
|
+
--cleanup Restore file: dependencies from backup
|
|
238
|
+
-m, --message <msg> Custom commit message (forces release even without changes)
|
|
234
239
|
```
|
|
235
240
|
|
|
236
241
|
### Dependency Options
|
|
237
242
|
```
|
|
238
|
-
--update-deps
|
|
239
|
-
--update-major
|
|
240
|
-
--no-publish-deps, -npd
|
|
241
|
-
--force-publish
|
|
242
|
-
--fix
|
|
243
|
-
--no-fix
|
|
243
|
+
--update-deps, -ud Update package.json to latest versions (safe: minor/patch)
|
|
244
|
+
--update-major Allow major version updates (breaking changes)
|
|
245
|
+
--no-publish-deps, -npd Skip auto-publishing file: dependencies
|
|
246
|
+
--force-publish Republish dependencies even if version exists
|
|
247
|
+
--fix Run npm audit fix after transformation
|
|
248
|
+
--no-fix Don't run npm audit
|
|
244
249
|
```
|
|
245
250
|
|
|
246
251
|
### Install Options
|
|
247
252
|
```
|
|
248
|
-
--install, -i Install globally after publish (
|
|
253
|
+
--install, -i Install globally after publish (from registry)
|
|
254
|
+
--link Install globally via symlink (npm install -g .)
|
|
249
255
|
--wsl Also install in WSL
|
|
256
|
+
--once Don't persist flags to .globalize.json5
|
|
250
257
|
```
|
|
251
258
|
|
|
252
259
|
### Mode Options
|
|
@@ -258,14 +265,23 @@ Publishing requires being on a branch so commits and tags can be properly tracke
|
|
|
258
265
|
### Git/npm Visibility
|
|
259
266
|
```
|
|
260
267
|
--git private Make git repo private (default)
|
|
261
|
-
--git public Make git repo public
|
|
262
|
-
--npm private Mark package private (skip publish) (default)
|
|
268
|
+
--git public Make git repo public (requires confirmation)
|
|
269
|
+
--npm private Mark npm package private (skip publish) (default)
|
|
263
270
|
--npm public Publish to npm
|
|
264
271
|
```
|
|
265
272
|
|
|
273
|
+
### Workspace Options
|
|
274
|
+
```
|
|
275
|
+
-w, --workspace <pkg> Filter to specific package (repeatable)
|
|
276
|
+
--no-workspace Disable workspace mode at a workspace root
|
|
277
|
+
--continue-on-error Continue if a package fails in workspace mode
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Workspace mode is auto-detected when run from a root with `"private": true` and a `workspaces` field.
|
|
281
|
+
|
|
266
282
|
### Other Options
|
|
267
283
|
```
|
|
268
|
-
--init Initialize git/npm if needed (creates .gitignore, .npmignore,
|
|
284
|
+
--init Initialize git/npm if needed (creates .gitignore, .npmignore,
|
|
269
285
|
.gitattributes, and configures git for LF line endings)
|
|
270
286
|
--force Continue despite git errors
|
|
271
287
|
--dry-run Preview what would happen
|
|
@@ -273,13 +289,41 @@ Publishing requires being on a branch so commits and tags can be properly tracke
|
|
|
273
289
|
--verbose Show detailed output
|
|
274
290
|
--conform Update .gitignore/.npmignore/.gitattributes to best practices
|
|
275
291
|
and configure git for LF line endings (fixes existing repos)
|
|
276
|
-
--asis Skip ignore file checks
|
|
292
|
+
--asis Skip ignore file checks (or set "asis": true in .globalize.json5)
|
|
277
293
|
--fix-tags Automatically fix version/tag mismatches
|
|
278
294
|
--rebase Automatically rebase if local is behind remote
|
|
279
|
-
--
|
|
280
|
-
--
|
|
295
|
+
--show Show package.json dependency changes
|
|
296
|
+
--package, -pkg Update package.json scripts to use npmglobalize (see below)
|
|
297
|
+
-h, --help Show help
|
|
298
|
+
-v, --version Show version
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Using in package.json
|
|
302
|
+
|
|
303
|
+
You can wire npmglobalize into your package.json `scripts` so that `npm run release` handles publishing:
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"scripts": {
|
|
308
|
+
"release": "npmglobalize"
|
|
309
|
+
}
|
|
310
|
+
}
|
|
281
311
|
```
|
|
282
312
|
|
|
313
|
+
The `--package` (`-pkg`) flag does this automatically — it adds a `release` script (renaming any existing `release`/`installer` scripts to `old-release`/`old-installer`):
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
npmglobalize --package # Sets up "release": "npmglobalize" in package.json
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
After that, publishing is just:
|
|
320
|
+
```bash
|
|
321
|
+
npm run release # Same as running npmglobalize directly
|
|
322
|
+
npm run release -- --minor # Pass flags through
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
You can also combine it with `.globalize.json5` for persistent options so `npm run release` always uses your preferred settings (install, visibility, etc.).
|
|
326
|
+
|
|
283
327
|
## Configuration File
|
|
284
328
|
|
|
285
329
|
Settings can be saved in `.globalize.json5`:
|
|
@@ -375,12 +419,21 @@ npmglobalize -np --update-deps
|
|
|
375
419
|
# Force republish all dependencies
|
|
376
420
|
npmglobalize --force-publish --update-major
|
|
377
421
|
|
|
378
|
-
# Release + install on Windows and WSL
|
|
422
|
+
# Release + install on Windows and WSL (from registry)
|
|
379
423
|
npmglobalize --install --wsl
|
|
380
424
|
|
|
425
|
+
# Release + link on Windows and WSL (symlink)
|
|
426
|
+
npmglobalize --link --wsl
|
|
427
|
+
|
|
381
428
|
# Restore original file: references
|
|
382
429
|
npmglobalize --cleanup
|
|
383
430
|
|
|
431
|
+
# Initialize new git repo + release
|
|
432
|
+
npmglobalize --init
|
|
433
|
+
|
|
434
|
+
# Migrate package.json scripts to use npmglobalize
|
|
435
|
+
npmglobalize --package
|
|
436
|
+
|
|
384
437
|
# Preview what would happen
|
|
385
438
|
npmglobalize --dry-run --verbose
|
|
386
439
|
```
|
package/lib.js
CHANGED
|
@@ -744,9 +744,8 @@ function waitForNpmVersion(pkgName, version, maxWaitMs = 60000) {
|
|
|
744
744
|
export function runCommand(cmd, args, options = {}) {
|
|
745
745
|
const { silent = false, cwd } = options;
|
|
746
746
|
try {
|
|
747
|
-
//
|
|
748
|
-
|
|
749
|
-
const needsShell = cmd === 'npm' || cmd === 'npm.cmd';
|
|
747
|
+
// Use shell:true for npm/gh commands which need it on Windows
|
|
748
|
+
const needsShell = cmd === 'npm' || cmd === 'npm.cmd' || cmd === 'gh';
|
|
750
749
|
// Debug: log the command being executed
|
|
751
750
|
if (!silent) {
|
|
752
751
|
console.log(colors.dim(`[DEBUG] Running: ${cmd} ${args.join(' ')}`));
|
|
@@ -803,13 +802,13 @@ function getGitHubRepo(pkg) {
|
|
|
803
802
|
}
|
|
804
803
|
/** Run a command and throw on failure */
|
|
805
804
|
export function runCommandOrThrow(cmd, args, options = {}) {
|
|
806
|
-
|
|
807
|
-
const captureOptions = { ...options, silent: true };
|
|
805
|
+
const needsShell = cmd === 'npm' || cmd === 'npm.cmd' || cmd === 'gh';
|
|
808
806
|
const result = spawnSync(cmd, args, {
|
|
809
807
|
encoding: 'utf-8',
|
|
810
808
|
stdio: 'pipe',
|
|
811
|
-
cwd:
|
|
812
|
-
|
|
809
|
+
cwd: options.cwd,
|
|
810
|
+
env: process.env,
|
|
811
|
+
shell: needsShell
|
|
813
812
|
});
|
|
814
813
|
const stdout = result.stdout || '';
|
|
815
814
|
const stderr = result.stderr || '';
|