@modernpoacher/deps 2.4.0 → 2.4.1
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/bin/common/index.mjs +13 -9
- package/bin/deps.mjs +1 -1
- package/bin/node/execute.mjs +28 -17
- package/bin/node/install.mjs +7 -5
- package/package.json +1 -1
package/bin/common/index.mjs
CHANGED
|
@@ -63,9 +63,11 @@ import {
|
|
|
63
63
|
REGISTRY,
|
|
64
64
|
AUTHOR,
|
|
65
65
|
getRegistryParameter,
|
|
66
|
+
getUserConfigParameter,
|
|
66
67
|
getForceParameter,
|
|
67
68
|
getNvm,
|
|
68
|
-
getBin
|
|
69
|
+
getBin,
|
|
70
|
+
USERCONFIG
|
|
69
71
|
} from '#deps/src/common'
|
|
70
72
|
|
|
71
73
|
const log = debug('@modernpoacher/deps')
|
|
@@ -91,12 +93,12 @@ rm -rf node_modules package-lock.json
|
|
|
91
93
|
`))
|
|
92
94
|
|
|
93
95
|
const getNpmiCommands = PLATFORM === 'win32'
|
|
94
|
-
? (registry = REGISTRY, force = false) => trim(tidy(getRegistryParameter(registry, getForceParameter(force, 'npm i'))))
|
|
95
|
-
: (registry = REGISTRY, force = false) => trim(tidy(getBin(getNvm(getRegistryParameter(registry, getForceParameter(force, 'npm i'))))))
|
|
96
|
+
? (registry = REGISTRY, userconfig = USERCONFIG, force = false) => trim(tidy(getRegistryParameter(registry, getUserConfigParameter(userconfig, getForceParameter(force, 'npm i')))))
|
|
97
|
+
: (registry = REGISTRY, userconfig = USERCONFIG, force = false) => trim(tidy(getBin(getNvm(getRegistryParameter(registry, getUserConfigParameter(userconfig, getForceParameter(force, 'npm i')))))))
|
|
96
98
|
|
|
97
99
|
const getDepsCommands = PLATFORM === 'win32'
|
|
98
|
-
? (registry = REGISTRY, force = false) => trim(tidy(getRegistryParameter(registry, getForceParameter(force, 'deps'))))
|
|
99
|
-
: (registry = REGISTRY, force = false) => trim(tidy(getBin(getNvm(getRegistryParameter(registry, getForceParameter(force, 'deps'))))))
|
|
100
|
+
? (registry = REGISTRY, userconfig = USERCONFIG, force = false) => trim(tidy(getRegistryParameter(registry, getUserConfigParameter(userconfig, getForceParameter(force, 'deps')))))
|
|
101
|
+
: (registry = REGISTRY, userconfig = USERCONFIG, force = false) => trim(tidy(getBin(getNvm(getRegistryParameter(registry, getUserConfigParameter(userconfig, getForceParameter(force, 'deps')))))))
|
|
100
102
|
|
|
101
103
|
export const DEPS = PLATFORM === 'win32'
|
|
102
104
|
? `bash "${join(BIN, '.\\bash\\deps.sh')}"`
|
|
@@ -395,17 +397,18 @@ function rmrf (d = DIRECTORY) {
|
|
|
395
397
|
/**
|
|
396
398
|
* @param {string} [d]
|
|
397
399
|
* @param {string} [registry]
|
|
400
|
+
* @param {string} [userconfig]
|
|
398
401
|
* @param {boolean} [force]
|
|
399
402
|
* @returns {Promise<string>}
|
|
400
403
|
*/
|
|
401
|
-
function npmi (d = DIRECTORY, registry = REGISTRY, force = false) {
|
|
404
|
+
function npmi (d = DIRECTORY, registry = REGISTRY, userconfig = USERCONFIG, force = false) {
|
|
402
405
|
log('npmi')
|
|
403
406
|
|
|
404
407
|
const directory = normalize(d.trim())
|
|
405
408
|
|
|
406
409
|
return (
|
|
407
410
|
new Promise((resolve, reject) => {
|
|
408
|
-
const commands = getNpmiCommands(registry, force)
|
|
411
|
+
const commands = getNpmiCommands(registry, userconfig, force)
|
|
409
412
|
const options = getOptions(directory)
|
|
410
413
|
/**
|
|
411
414
|
* @type {HandleComplete}
|
|
@@ -436,17 +439,18 @@ function npmi (d = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
436
439
|
/**
|
|
437
440
|
* @param {string} [d]
|
|
438
441
|
* @param {string} [registry]
|
|
442
|
+
* @param {string} [userconfig]
|
|
439
443
|
* @param {boolean} [force]
|
|
440
444
|
* @returns {Promise<string>}
|
|
441
445
|
*/
|
|
442
|
-
function deps (d = DIRECTORY, registry = REGISTRY, force = false) {
|
|
446
|
+
function deps (d = DIRECTORY, registry = REGISTRY, userconfig = USERCONFIG, force = false) {
|
|
443
447
|
log('deps')
|
|
444
448
|
|
|
445
449
|
const directory = normalize(d.trim())
|
|
446
450
|
|
|
447
451
|
return (
|
|
448
452
|
new Promise((resolve, reject) => {
|
|
449
|
-
const commands = getDepsCommands(registry, force)
|
|
453
|
+
const commands = getDepsCommands(registry, userconfig, force)
|
|
450
454
|
const options = getOptions(directory)
|
|
451
455
|
/**
|
|
452
456
|
* @type {HandleComplete}
|
package/bin/deps.mjs
CHANGED
|
@@ -64,7 +64,7 @@ async function app () {
|
|
|
64
64
|
.option('-O, --save-optional [optionalDependencies]', 'Install `optionalDependencies`', false)
|
|
65
65
|
.option('-B, --save-bundle [bundleDependencies]', 'Install `bundleDependencies`', false)
|
|
66
66
|
.option('--registry [registry]', 'Installation registry')
|
|
67
|
-
.option('--userconfig [userconfig]', 'User
|
|
67
|
+
.option('--userconfig [userconfig]', 'User config')
|
|
68
68
|
.option('--force [force]', 'Force installation`', false)
|
|
69
69
|
.parse(argv)
|
|
70
70
|
|
package/bin/node/execute.mjs
CHANGED
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
import {
|
|
48
48
|
DIRECTORY,
|
|
49
49
|
REGISTRY,
|
|
50
|
+
USERCONFIG,
|
|
50
51
|
getIgnore,
|
|
51
52
|
getAuthor,
|
|
52
53
|
getMessage
|
|
@@ -283,12 +284,13 @@ async function * genDirectory (directory) {
|
|
|
283
284
|
/**
|
|
284
285
|
* @param {string} directory
|
|
285
286
|
* @param {string} registry
|
|
287
|
+
* @param {string} userconfig
|
|
286
288
|
* @param {boolean} force
|
|
287
289
|
* @param {string} message
|
|
288
290
|
* @param {string | { name: string; email: string }} author
|
|
289
291
|
* @returns {Promise<void>}
|
|
290
292
|
*/
|
|
291
|
-
async function iterate (directory, registry, force, message, author) {
|
|
293
|
+
async function iterate (directory, registry, userconfig, force, message, author) {
|
|
292
294
|
log('iterate')
|
|
293
295
|
|
|
294
296
|
if (directory) {
|
|
@@ -302,7 +304,7 @@ async function iterate (directory, registry, force, message, author) {
|
|
|
302
304
|
const ignore = await getIgnoreFromConfiguration(D)
|
|
303
305
|
|
|
304
306
|
if (!ignore) {
|
|
305
|
-
await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
|
|
307
|
+
await execute(D, registry, userconfig, force, await toMessage(message, D), await toAuthor(author, D))
|
|
306
308
|
}
|
|
307
309
|
}
|
|
308
310
|
}
|
|
@@ -315,36 +317,39 @@ async function iterate (directory, registry, force, message, author) {
|
|
|
315
317
|
/**
|
|
316
318
|
* @param {string} directory
|
|
317
319
|
* @param {string} registry
|
|
320
|
+
* @param {string} userconfig
|
|
318
321
|
* @param {boolean} force
|
|
319
322
|
* @param {string} message
|
|
320
323
|
* @param {string | { name: string; email: string }} author
|
|
321
324
|
* @returns {Promise<void>}
|
|
322
325
|
*/
|
|
323
|
-
async function iteratePath (directory, registry, force, message, author) {
|
|
326
|
+
async function iteratePath (directory, registry, userconfig, force, message, author) {
|
|
324
327
|
log('iteratePath')
|
|
325
328
|
|
|
326
329
|
if (directory) {
|
|
327
330
|
const D = resolve(directory)
|
|
328
331
|
|
|
329
|
-
for await (const d of genDirectory(D)) await iterate(d, registry, force, message, author)
|
|
332
|
+
for await (const d of genDirectory(D)) await iterate(d, registry, userconfig, force, message, author)
|
|
330
333
|
}
|
|
331
334
|
}
|
|
332
335
|
|
|
333
336
|
/**
|
|
334
337
|
* @param {string} directory
|
|
335
338
|
* @param {string} registry
|
|
339
|
+
* @param {string} userconfig
|
|
336
340
|
* @param {boolean} force
|
|
337
341
|
* @param {string} message
|
|
338
342
|
* @param {string | { name: string; email: string }} author
|
|
339
343
|
* @returns {Promise<void>}
|
|
340
344
|
*/
|
|
341
|
-
async function execute (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
|
|
345
|
+
async function execute (directory = DIRECTORY, registry = REGISTRY, userconfig = USERCONFIG, force = false, message = MESSAGE, author = AUTHOR) {
|
|
342
346
|
log('execute')
|
|
343
347
|
|
|
344
348
|
try {
|
|
345
349
|
table({
|
|
346
350
|
directory: formatDirectory(directory),
|
|
347
351
|
registry,
|
|
352
|
+
userconfig,
|
|
348
353
|
force,
|
|
349
354
|
message
|
|
350
355
|
})
|
|
@@ -353,8 +358,8 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
|
|
|
353
358
|
|
|
354
359
|
await gitPull(directory)
|
|
355
360
|
await rmrf(directory)
|
|
356
|
-
await npmi(directory, registry, force)
|
|
357
|
-
await deps(directory, registry, force)
|
|
361
|
+
await npmi(directory, registry, userconfig, force)
|
|
362
|
+
await deps(directory, registry, userconfig, force)
|
|
358
363
|
await gitAdd(directory)
|
|
359
364
|
await gitCommit(directory, message, author)
|
|
360
365
|
await gitPush(directory)
|
|
@@ -367,12 +372,13 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
|
|
|
367
372
|
/**
|
|
368
373
|
* @param {string} directory
|
|
369
374
|
* @param {string} registry
|
|
375
|
+
* @param {string} userconfig
|
|
370
376
|
* @param {boolean} force
|
|
371
377
|
* @param {string} message
|
|
372
378
|
* @param {string | { name: string; email: string }} author
|
|
373
379
|
* @returns {Promise<void>}
|
|
374
380
|
*/
|
|
375
|
-
async function executeFrom (directory, registry, force, message, author) {
|
|
381
|
+
async function executeFrom (directory, registry, userconfig, force, message, author) {
|
|
376
382
|
log('executeFrom')
|
|
377
383
|
|
|
378
384
|
if (directory) {
|
|
@@ -386,7 +392,7 @@ async function executeFrom (directory, registry, force, message, author) {
|
|
|
386
392
|
const ignore = await getIgnoreFromConfiguration(D)
|
|
387
393
|
|
|
388
394
|
if (!ignore) {
|
|
389
|
-
await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
|
|
395
|
+
await execute(D, registry, userconfig, force, await toMessage(message, D), await toAuthor(author, D))
|
|
390
396
|
}
|
|
391
397
|
}
|
|
392
398
|
}
|
|
@@ -399,12 +405,13 @@ async function executeFrom (directory, registry, force, message, author) {
|
|
|
399
405
|
/**
|
|
400
406
|
* @param {string} directory
|
|
401
407
|
* @param {string} registry
|
|
408
|
+
* @param {string} userconfig
|
|
402
409
|
* @param {boolean} force
|
|
403
410
|
* @param {string} message
|
|
404
411
|
* @param {string | { name: string; email: string }} author
|
|
405
412
|
* @returns {Promise<void>}
|
|
406
413
|
*/
|
|
407
|
-
async function executeOnly (directory, registry, force, message, author) {
|
|
414
|
+
async function executeOnly (directory, registry, userconfig, force, message, author) {
|
|
408
415
|
log('executeOnly')
|
|
409
416
|
|
|
410
417
|
if (directory) {
|
|
@@ -418,7 +425,7 @@ async function executeOnly (directory, registry, force, message, author) {
|
|
|
418
425
|
const ignore = await getIgnoreFromConfiguration(D)
|
|
419
426
|
|
|
420
427
|
if (!ignore) {
|
|
421
|
-
await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
|
|
428
|
+
await execute(D, registry, userconfig, force, await toMessage(message, D), await toAuthor(author, D))
|
|
422
429
|
}
|
|
423
430
|
}
|
|
424
431
|
}
|
|
@@ -431,12 +438,13 @@ async function executeOnly (directory, registry, force, message, author) {
|
|
|
431
438
|
/**
|
|
432
439
|
* @param {string} directory
|
|
433
440
|
* @param {string} registry
|
|
441
|
+
* @param {string} userconfig
|
|
434
442
|
* @param {boolean} force
|
|
435
443
|
* @param {string} message
|
|
436
444
|
* @param {string | { name: string; email: string }} author
|
|
437
445
|
* @returns {Promise<void>}
|
|
438
446
|
*/
|
|
439
|
-
async function executePath (directory, registry, force, message, author) {
|
|
447
|
+
async function executePath (directory, registry, userconfig, force, message, author) {
|
|
440
448
|
log('executePath')
|
|
441
449
|
|
|
442
450
|
if (directory) {
|
|
@@ -450,7 +458,7 @@ async function executePath (directory, registry, force, message, author) {
|
|
|
450
458
|
const ignore = await getIgnoreFromConfiguration(D)
|
|
451
459
|
|
|
452
460
|
if (!ignore) {
|
|
453
|
-
await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
|
|
461
|
+
await execute(D, registry, userconfig, force, await toMessage(message, D), await toAuthor(author, D))
|
|
454
462
|
}
|
|
455
463
|
}
|
|
456
464
|
}
|
|
@@ -461,7 +469,7 @@ async function executePath (directory, registry, force, message, author) {
|
|
|
461
469
|
|
|
462
470
|
if (code === 128) {
|
|
463
471
|
return (
|
|
464
|
-
await iteratePath(directory, registry, force, message, author)
|
|
472
|
+
await iteratePath(directory, registry, userconfig, force, message, author)
|
|
465
473
|
)
|
|
466
474
|
}
|
|
467
475
|
|
|
@@ -491,6 +499,7 @@ async function app () {
|
|
|
491
499
|
.option('-f, --from [from]', 'Update from directory')
|
|
492
500
|
.option('-o, --only [only]', 'Update only directory')
|
|
493
501
|
.option('--registry [registry]', 'Installation registry')
|
|
502
|
+
.option('--userconfig [userconfig]', 'User config')
|
|
494
503
|
.option('--force [force]', 'Force installation`', false)
|
|
495
504
|
.option('-m, --message [message]', 'Git commit message')
|
|
496
505
|
.option('-a, --author [author]', 'Git commit author')
|
|
@@ -501,6 +510,7 @@ async function app () {
|
|
|
501
510
|
from: F,
|
|
502
511
|
only: O,
|
|
503
512
|
registry,
|
|
513
|
+
userconfig,
|
|
504
514
|
force,
|
|
505
515
|
message,
|
|
506
516
|
author
|
|
@@ -511,6 +521,7 @@ async function app () {
|
|
|
511
521
|
...(F ? { from: F } : {}),
|
|
512
522
|
...(O ? { only: O } : {}),
|
|
513
523
|
...(registry ? { registry } : {}),
|
|
524
|
+
...(userconfig ? { userconfig } : {}),
|
|
514
525
|
...(force ? { force } : {}),
|
|
515
526
|
...(message ? { message } : {}),
|
|
516
527
|
...(author ? { author } : {})
|
|
@@ -520,7 +531,7 @@ async function app () {
|
|
|
520
531
|
log('Path')
|
|
521
532
|
|
|
522
533
|
try {
|
|
523
|
-
await executePath(P, registry, force, message, author)
|
|
534
|
+
await executePath(P, registry, userconfig, force, message, author)
|
|
524
535
|
} catch (e) {
|
|
525
536
|
if (e instanceof Error) handleError(e)
|
|
526
537
|
}
|
|
@@ -529,7 +540,7 @@ async function app () {
|
|
|
529
540
|
log('From')
|
|
530
541
|
|
|
531
542
|
try {
|
|
532
|
-
await executeFrom(P, registry, force, message, author)
|
|
543
|
+
await executeFrom(P, registry, userconfig, force, message, author)
|
|
533
544
|
} catch (e) {
|
|
534
545
|
if (e instanceof Error) handleError(e)
|
|
535
546
|
}
|
|
@@ -538,7 +549,7 @@ async function app () {
|
|
|
538
549
|
log('Only')
|
|
539
550
|
|
|
540
551
|
try {
|
|
541
|
-
await executeOnly(P, registry, force, message, author)
|
|
552
|
+
await executeOnly(P, registry, userconfig, force, message, author)
|
|
542
553
|
} catch (e) {
|
|
543
554
|
if (e instanceof Error) handleError(e)
|
|
544
555
|
}
|
package/bin/node/install.mjs
CHANGED
|
@@ -80,6 +80,7 @@ async function app () {
|
|
|
80
80
|
peer: p,
|
|
81
81
|
save,
|
|
82
82
|
registry,
|
|
83
|
+
userconfig,
|
|
83
84
|
force
|
|
84
85
|
} = commander.opts()
|
|
85
86
|
|
|
@@ -91,6 +92,7 @@ async function app () {
|
|
|
91
92
|
peer: p,
|
|
92
93
|
save,
|
|
93
94
|
...(registry ? { registry } : {}),
|
|
95
|
+
...(userconfig ? { userconfig } : {}),
|
|
94
96
|
...(force ? { force } : {})
|
|
95
97
|
})
|
|
96
98
|
|
|
@@ -117,7 +119,7 @@ async function app () {
|
|
|
117
119
|
log('Prod')
|
|
118
120
|
|
|
119
121
|
try {
|
|
120
|
-
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force)
|
|
122
|
+
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, userconfig, force)
|
|
121
123
|
} catch (e) {
|
|
122
124
|
if (e instanceof Error) handleError(e)
|
|
123
125
|
}
|
|
@@ -126,7 +128,7 @@ async function app () {
|
|
|
126
128
|
log('Dev')
|
|
127
129
|
|
|
128
130
|
try {
|
|
129
|
-
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force)
|
|
131
|
+
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, userconfig, force)
|
|
130
132
|
} catch (e) {
|
|
131
133
|
if (e instanceof Error) handleError(e)
|
|
132
134
|
}
|
|
@@ -135,7 +137,7 @@ async function app () {
|
|
|
135
137
|
log('Optional')
|
|
136
138
|
|
|
137
139
|
try {
|
|
138
|
-
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force)
|
|
140
|
+
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, userconfig, force)
|
|
139
141
|
} catch (e) {
|
|
140
142
|
if (e instanceof Error) handleError(e)
|
|
141
143
|
}
|
|
@@ -144,7 +146,7 @@ async function app () {
|
|
|
144
146
|
log('Bundle')
|
|
145
147
|
|
|
146
148
|
try {
|
|
147
|
-
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force)
|
|
149
|
+
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, userconfig, force)
|
|
148
150
|
} catch (e) {
|
|
149
151
|
if (e instanceof Error) handleError(e)
|
|
150
152
|
}
|
|
@@ -153,7 +155,7 @@ async function app () {
|
|
|
153
155
|
log('Peer')
|
|
154
156
|
|
|
155
157
|
try {
|
|
156
|
-
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force)
|
|
158
|
+
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, userconfig, force)
|
|
157
159
|
} catch (e) {
|
|
158
160
|
if (e instanceof Error) handleError(e)
|
|
159
161
|
}
|