@modernpoacher/deps 2.2.18 → 2.2.20
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 +162 -48
- package/bin/deps.mjs +10 -9
- package/bin/node/deps.mjs +5 -21
- package/bin/node/execute.mjs +152 -40
- package/bin/node/head.mjs +5 -21
- package/bin/node/install.mjs +9 -8
- package/bin/node/push.mjs +5 -21
- package/bin/node/wipe.mjs +5 -21
- package/eslint.config.mjs +103 -0
- package/index.d.mts +50 -0
- package/package.json +24 -18
- package/src/common/debug.mjs +2 -0
- package/src/common/env/index.mjs +5 -5
- package/src/common/git/index.mjs +230 -131
- package/src/common/index.mjs +79 -121
- package/src/common/options/index.mjs +14 -20
- package/src/index.mjs +178 -113
- package/src/install/index.mjs +49 -34
- package/tsconfig.json +20 -0
package/src/index.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import('node:child_process').ExecException} ExecException
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* Package or configuration dependencies
|
|
3
7
|
* @typedef {import('./common/index.mjs').Dependencies} Dependencies
|
|
@@ -8,7 +12,12 @@
|
|
|
8
12
|
* @typedef {import('./common/index.mjs').DependencyDescriptor} DependencyDescriptor
|
|
9
13
|
*/
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
/**
|
|
16
|
+
* @callback HandleComplete
|
|
17
|
+
* @param {ExecException | null} e
|
|
18
|
+
* @param {string} v
|
|
19
|
+
* @returns {void}
|
|
20
|
+
*/
|
|
12
21
|
|
|
13
22
|
import stripAnsi from 'strip-ansi'
|
|
14
23
|
|
|
@@ -20,6 +29,8 @@ import {
|
|
|
20
29
|
exec
|
|
21
30
|
} from 'node:child_process'
|
|
22
31
|
|
|
32
|
+
import debug from '#deps/src/common/debug'
|
|
33
|
+
|
|
23
34
|
import {
|
|
24
35
|
VERSION,
|
|
25
36
|
PLATFORM
|
|
@@ -51,13 +62,25 @@ const info = debug('@modernpoacher/deps:info')
|
|
|
51
62
|
|
|
52
63
|
log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
53
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @param {string} v
|
|
67
|
+
* @returns {boolean}
|
|
68
|
+
*/
|
|
54
69
|
function filter (v) {
|
|
55
70
|
return Boolean(stripAnsi(v).trim())
|
|
56
71
|
}
|
|
57
72
|
|
|
73
|
+
/**
|
|
74
|
+
* @param {string} key
|
|
75
|
+
* @returns {(value: string) => void}
|
|
76
|
+
*/
|
|
58
77
|
export function use (key) {
|
|
59
78
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
60
79
|
|
|
80
|
+
/**
|
|
81
|
+
* @param {string} v
|
|
82
|
+
* @returns {void}
|
|
83
|
+
*/
|
|
61
84
|
function write (v) {
|
|
62
85
|
log(v.trimEnd())
|
|
63
86
|
}
|
|
@@ -71,10 +94,9 @@ export function use (key) {
|
|
|
71
94
|
|
|
72
95
|
/**
|
|
73
96
|
* @function getInstallSaveExactCommands
|
|
74
|
-
*
|
|
97
|
+
* @description
|
|
75
98
|
* Get the `npm install --save-exact` commands as a string
|
|
76
|
-
*
|
|
77
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
99
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
78
100
|
* @param {string} r - Registry
|
|
79
101
|
* @param {boolean} f - Force
|
|
80
102
|
* @returns {string}
|
|
@@ -89,10 +111,9 @@ export function getInstallSaveExactCommands (deps, r, f) {
|
|
|
89
111
|
|
|
90
112
|
/**
|
|
91
113
|
* @function getInstallCommands
|
|
92
|
-
*
|
|
114
|
+
* @description
|
|
93
115
|
* Get the `npm install` commands as a string
|
|
94
|
-
*
|
|
95
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
116
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
96
117
|
* @param {string} r - Registry
|
|
97
118
|
* @param {boolean} f - Force
|
|
98
119
|
* @returns {string}
|
|
@@ -107,10 +128,9 @@ export function getInstallCommands (deps, r, f) {
|
|
|
107
128
|
|
|
108
129
|
/**
|
|
109
130
|
* @function getInstallSaveBundleSaveExactCommands
|
|
110
|
-
*
|
|
131
|
+
* @description
|
|
111
132
|
* Get the `npm install --save-bundle --save-exact` commands as a string
|
|
112
|
-
*
|
|
113
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
133
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
114
134
|
* @param {string} r - Registry
|
|
115
135
|
* @param {boolean} f - Force
|
|
116
136
|
* @returns {string}
|
|
@@ -129,10 +149,9 @@ export function getInstallSaveBundleSaveExactCommands (deps, r, f) {
|
|
|
129
149
|
|
|
130
150
|
/**
|
|
131
151
|
* @function getInstallSaveBundleCommands
|
|
132
|
-
*
|
|
152
|
+
* @description
|
|
133
153
|
* Get the `npm install --save-bundle` commands as a string
|
|
134
|
-
*
|
|
135
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
154
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
136
155
|
* @param {string} r - Registry
|
|
137
156
|
* @param {boolean} f - Force
|
|
138
157
|
* @returns {string}
|
|
@@ -151,10 +170,9 @@ export function getInstallSaveBundleCommands (deps, r, f) {
|
|
|
151
170
|
|
|
152
171
|
/**
|
|
153
172
|
* @function getInstallSaveOptionalSaveExactCommands
|
|
154
|
-
*
|
|
173
|
+
* @description
|
|
155
174
|
* Get the `npm install --save-optional --save-exact` commands as a string
|
|
156
|
-
*
|
|
157
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
175
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
158
176
|
* @param {string} r - Registry
|
|
159
177
|
* @param {boolean} f - Force
|
|
160
178
|
* @returns {string}
|
|
@@ -173,10 +191,9 @@ export function getInstallSaveOptionalSaveExactCommands (deps, r, f) {
|
|
|
173
191
|
|
|
174
192
|
/**
|
|
175
193
|
* @function getInstallSaveOptionalCommands
|
|
176
|
-
*
|
|
194
|
+
* @description
|
|
177
195
|
* Get the `npm install --save-optional` commands as a string
|
|
178
|
-
*
|
|
179
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
196
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
180
197
|
* @param {string} r - Registry
|
|
181
198
|
* @param {boolean} f - Force
|
|
182
199
|
* @returns {string}
|
|
@@ -195,10 +212,9 @@ export function getInstallSaveOptionalCommands (deps, r, f) {
|
|
|
195
212
|
|
|
196
213
|
/**
|
|
197
214
|
* @function getInstallSaveDevSaveExactCommands
|
|
198
|
-
*
|
|
215
|
+
* @description
|
|
199
216
|
* Get the `npm install --save-dev --save-exact` commands as a string
|
|
200
|
-
*
|
|
201
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
217
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
202
218
|
* @param {string} r - Registry
|
|
203
219
|
* @param {boolean} f - Force
|
|
204
220
|
* @returns {string}
|
|
@@ -217,10 +233,9 @@ export function getInstallSaveDevSaveExactCommands (deps, r, f) {
|
|
|
217
233
|
|
|
218
234
|
/**
|
|
219
235
|
* @function getInstallSaveDevCommands
|
|
220
|
-
*
|
|
236
|
+
* @description
|
|
221
237
|
* Get the `npm install --save-dev` commands as a string
|
|
222
|
-
*
|
|
223
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
238
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
224
239
|
* @param {string} r - Registry
|
|
225
240
|
* @param {boolean} f - Force
|
|
226
241
|
* @returns {string}
|
|
@@ -239,10 +254,9 @@ export function getInstallSaveDevCommands (deps, r, f) {
|
|
|
239
254
|
|
|
240
255
|
/**
|
|
241
256
|
* @function getInstallSaveProdSaveExactCommands
|
|
242
|
-
*
|
|
257
|
+
* @description
|
|
243
258
|
* Get the `npm install --save-prod --save-exact` commands as a string
|
|
244
|
-
*
|
|
245
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
259
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
246
260
|
* @param {string} r - Registry
|
|
247
261
|
* @param {boolean} f - Force
|
|
248
262
|
* @returns {string}
|
|
@@ -261,10 +275,9 @@ export function getInstallSaveProdSaveExactCommands (deps, r, f) {
|
|
|
261
275
|
|
|
262
276
|
/**
|
|
263
277
|
* @function getInstallSaveProdCommands
|
|
264
|
-
*
|
|
278
|
+
* @description
|
|
265
279
|
* Get the `npm install --save-prod` commands as a string
|
|
266
|
-
*
|
|
267
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
280
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
268
281
|
* @param {string} r - Registry
|
|
269
282
|
* @param {boolean} f - Force
|
|
270
283
|
* @returns {string}
|
|
@@ -283,11 +296,10 @@ export function getInstallSaveProdCommands (deps, r, f) {
|
|
|
283
296
|
|
|
284
297
|
/**
|
|
285
298
|
* @function installSaveBundleSaveExact
|
|
286
|
-
*
|
|
299
|
+
* @description
|
|
287
300
|
* Spawn the `npm install --save-bundle --save-exact` commands
|
|
288
|
-
*
|
|
289
301
|
* @param {string} d - Directory
|
|
290
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
302
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
291
303
|
* @param {string} r - Registry
|
|
292
304
|
* @param {boolean} f - Force
|
|
293
305
|
* @returns {Promise<string>}
|
|
@@ -297,35 +309,42 @@ export function installSaveBundleSaveExact (d, deps, r, f) {
|
|
|
297
309
|
|
|
298
310
|
const directory = normalize(d.trim())
|
|
299
311
|
|
|
300
|
-
|
|
312
|
+
info(`Directory is "${directory}"`)
|
|
301
313
|
|
|
302
314
|
return (
|
|
303
315
|
new Promise((resolve, reject) => {
|
|
304
316
|
const commands = getCommands(getInstallSaveBundleSaveExactCommands(deps, r, f))
|
|
305
317
|
const options = getOptions(directory)
|
|
318
|
+
/**
|
|
319
|
+
* @type {HandleComplete}
|
|
320
|
+
*/
|
|
321
|
+
function handleComplete (e, v) {
|
|
322
|
+
if (!e) {
|
|
323
|
+
resolve(v)
|
|
324
|
+
} else {
|
|
325
|
+
reject(e)
|
|
326
|
+
}
|
|
327
|
+
}
|
|
306
328
|
|
|
307
329
|
const {
|
|
308
330
|
stdout,
|
|
309
331
|
stderr
|
|
310
|
-
} = exec(commands, options,
|
|
311
|
-
return (!e) ? resolve(v) : reject(e)
|
|
312
|
-
})
|
|
332
|
+
} = exec(commands, options, handleComplete)
|
|
313
333
|
|
|
314
334
|
const log = use('install-save-bundle-save-exact')
|
|
315
335
|
|
|
316
|
-
stdout.on('data', log)
|
|
317
|
-
stderr.on('data', log)
|
|
336
|
+
if (stdout) stdout.on('data', log)
|
|
337
|
+
if (stderr) stderr.on('data', log)
|
|
318
338
|
})
|
|
319
339
|
)
|
|
320
340
|
}
|
|
321
341
|
|
|
322
342
|
/**
|
|
323
343
|
* @function installSaveBundle
|
|
324
|
-
*
|
|
344
|
+
* @description
|
|
325
345
|
* Spawn the `npm install --save-bundle` commands
|
|
326
|
-
*
|
|
327
346
|
* @param {string} d - Directory
|
|
328
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
347
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
329
348
|
* @param {string} r - Registry
|
|
330
349
|
* @param {boolean} f - Force
|
|
331
350
|
* @returns {Promise<string>}
|
|
@@ -335,35 +354,42 @@ export function installSaveBundle (d, deps, r, f) {
|
|
|
335
354
|
|
|
336
355
|
const directory = normalize(d.trim())
|
|
337
356
|
|
|
338
|
-
|
|
357
|
+
info(`Directory is "${directory}"`)
|
|
339
358
|
|
|
340
359
|
return (
|
|
341
360
|
new Promise((resolve, reject) => {
|
|
342
361
|
const commands = getCommands(getInstallSaveBundleCommands(deps, r, f))
|
|
343
362
|
const options = getOptions(directory)
|
|
363
|
+
/**
|
|
364
|
+
* @type {HandleComplete}
|
|
365
|
+
*/
|
|
366
|
+
function handleComplete (e, v) {
|
|
367
|
+
if (!e) {
|
|
368
|
+
resolve(v)
|
|
369
|
+
} else {
|
|
370
|
+
reject(e)
|
|
371
|
+
}
|
|
372
|
+
}
|
|
344
373
|
|
|
345
374
|
const {
|
|
346
375
|
stdout,
|
|
347
376
|
stderr
|
|
348
|
-
} = exec(commands, options,
|
|
349
|
-
return (!e) ? resolve(v) : reject(e)
|
|
350
|
-
})
|
|
377
|
+
} = exec(commands, options, handleComplete)
|
|
351
378
|
|
|
352
379
|
const log = use('install-save-bundle')
|
|
353
380
|
|
|
354
|
-
stdout.on('data', log)
|
|
355
|
-
stderr.on('data', log)
|
|
381
|
+
if (stdout) stdout.on('data', log)
|
|
382
|
+
if (stderr) stderr.on('data', log)
|
|
356
383
|
})
|
|
357
384
|
)
|
|
358
385
|
}
|
|
359
386
|
|
|
360
387
|
/**
|
|
361
388
|
* @function installSaveOptionalSaveExact
|
|
362
|
-
*
|
|
389
|
+
* @description
|
|
363
390
|
* Spawn the `npm install --save-optional --save-exact` commands
|
|
364
|
-
*
|
|
365
391
|
* @param {string} d - Directory
|
|
366
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
392
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
367
393
|
* @param {string} r - Registry
|
|
368
394
|
* @param {boolean} f - Force
|
|
369
395
|
* @returns {Promise<string>}
|
|
@@ -373,73 +399,87 @@ export function installSaveOptionalSaveExact (d, deps, r, f) {
|
|
|
373
399
|
|
|
374
400
|
const directory = normalize(d.trim())
|
|
375
401
|
|
|
376
|
-
|
|
402
|
+
info(`Directory is "${directory}"`)
|
|
377
403
|
|
|
378
404
|
return (
|
|
379
405
|
new Promise((resolve, reject) => {
|
|
380
406
|
const commands = getCommands(getInstallSaveOptionalSaveExactCommands(deps, r, f))
|
|
381
407
|
const options = getOptions(directory)
|
|
408
|
+
/**
|
|
409
|
+
* @type {HandleComplete}
|
|
410
|
+
*/
|
|
411
|
+
function handleComplete (e, v) {
|
|
412
|
+
if (!e) {
|
|
413
|
+
resolve(v)
|
|
414
|
+
} else {
|
|
415
|
+
reject(e)
|
|
416
|
+
}
|
|
417
|
+
}
|
|
382
418
|
|
|
383
419
|
const {
|
|
384
420
|
stdout,
|
|
385
421
|
stderr
|
|
386
|
-
} = exec(commands, options,
|
|
387
|
-
return (!e) ? resolve(v) : reject(e)
|
|
388
|
-
})
|
|
422
|
+
} = exec(commands, options, handleComplete)
|
|
389
423
|
|
|
390
424
|
const log = use('install-save-otional-save-exact')
|
|
391
425
|
|
|
392
|
-
stdout.on('data', log)
|
|
393
|
-
stderr.on('data', log)
|
|
426
|
+
if (stdout) stdout.on('data', log)
|
|
427
|
+
if (stderr) stderr.on('data', log)
|
|
394
428
|
})
|
|
395
429
|
)
|
|
396
430
|
}
|
|
397
431
|
|
|
398
432
|
/**
|
|
399
433
|
* @function installSaveOptional
|
|
400
|
-
*
|
|
434
|
+
* @description
|
|
401
435
|
* Spawn the `npm install --save-optional` commands
|
|
402
|
-
*
|
|
403
436
|
* @param {string} d - Directory
|
|
404
|
-
* @param {
|
|
437
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependencies
|
|
405
438
|
* @param {string} r - Registry
|
|
406
439
|
* @param {boolean} f - Force
|
|
407
440
|
* @returns {Promise<string>}
|
|
408
441
|
*/
|
|
409
|
-
export function installSaveOptional (d,
|
|
442
|
+
export function installSaveOptional (d, deps, r, f) {
|
|
410
443
|
log('installSaveOptional')
|
|
411
444
|
|
|
412
445
|
const directory = normalize(d.trim())
|
|
413
446
|
|
|
414
|
-
|
|
447
|
+
info(`Directory is "${directory}"`)
|
|
415
448
|
|
|
416
449
|
return (
|
|
417
450
|
new Promise((resolve, reject) => {
|
|
418
|
-
const commands = getCommands(getInstallSaveOptionalCommands(
|
|
451
|
+
const commands = getCommands(getInstallSaveOptionalCommands(deps, r, f))
|
|
419
452
|
const options = getOptions(directory)
|
|
453
|
+
/**
|
|
454
|
+
* @type {HandleComplete}
|
|
455
|
+
*/
|
|
456
|
+
function handleComplete (e, v) {
|
|
457
|
+
if (!e) {
|
|
458
|
+
resolve(v)
|
|
459
|
+
} else {
|
|
460
|
+
reject(e)
|
|
461
|
+
}
|
|
462
|
+
}
|
|
420
463
|
|
|
421
464
|
const {
|
|
422
465
|
stdout,
|
|
423
466
|
stderr
|
|
424
|
-
} = exec(commands, options,
|
|
425
|
-
return (!e) ? resolve(v) : reject(e)
|
|
426
|
-
})
|
|
467
|
+
} = exec(commands, options, handleComplete)
|
|
427
468
|
|
|
428
469
|
const log = use('install-save-otional')
|
|
429
470
|
|
|
430
|
-
stdout.on('data', log)
|
|
431
|
-
stderr.on('data', log)
|
|
471
|
+
if (stdout) stdout.on('data', log)
|
|
472
|
+
if (stderr) stderr.on('data', log)
|
|
432
473
|
})
|
|
433
474
|
)
|
|
434
475
|
}
|
|
435
476
|
|
|
436
477
|
/**
|
|
437
478
|
* @function installSaveDevSaveExact
|
|
438
|
-
*
|
|
479
|
+
* @description
|
|
439
480
|
* Spawn the `npm install --save-dev --save-exact` commands
|
|
440
|
-
*
|
|
441
481
|
* @param {string} d - Directory
|
|
442
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
482
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
443
483
|
* @param {string} r - Registry
|
|
444
484
|
* @param {boolean} f - Force
|
|
445
485
|
* @returns {Promise<string>}
|
|
@@ -449,35 +489,42 @@ export function installSaveDevSaveExact (d, deps, r, f) {
|
|
|
449
489
|
|
|
450
490
|
const directory = normalize(d.trim())
|
|
451
491
|
|
|
452
|
-
|
|
492
|
+
info(`Directory is "${directory}"`)
|
|
453
493
|
|
|
454
494
|
return (
|
|
455
495
|
new Promise((resolve, reject) => {
|
|
456
496
|
const commands = getCommands(getInstallSaveDevSaveExactCommands(deps, r, f))
|
|
457
497
|
const options = getOptions(directory)
|
|
498
|
+
/**
|
|
499
|
+
* @type {HandleComplete}
|
|
500
|
+
*/
|
|
501
|
+
function handleComplete (e, v) {
|
|
502
|
+
if (!e) {
|
|
503
|
+
resolve(v)
|
|
504
|
+
} else {
|
|
505
|
+
reject(e)
|
|
506
|
+
}
|
|
507
|
+
}
|
|
458
508
|
|
|
459
509
|
const {
|
|
460
510
|
stdout,
|
|
461
511
|
stderr
|
|
462
|
-
} = exec(commands, options,
|
|
463
|
-
return (!e) ? resolve(v) : reject(e)
|
|
464
|
-
})
|
|
512
|
+
} = exec(commands, options, handleComplete)
|
|
465
513
|
|
|
466
514
|
const log = use('install-save-dev-save-exact')
|
|
467
515
|
|
|
468
|
-
stdout.on('data', log)
|
|
469
|
-
stderr.on('data', log)
|
|
516
|
+
if (stdout) stdout.on('data', log)
|
|
517
|
+
if (stderr) stderr.on('data', log)
|
|
470
518
|
})
|
|
471
519
|
)
|
|
472
520
|
}
|
|
473
521
|
|
|
474
522
|
/**
|
|
475
523
|
* @function installSaveDev
|
|
476
|
-
*
|
|
524
|
+
* @description
|
|
477
525
|
* Spawn the `npm install --save-dev` commands
|
|
478
|
-
*
|
|
479
526
|
* @param {string} d - Directory
|
|
480
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
527
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
481
528
|
* @param {string} r - Registry
|
|
482
529
|
* @param {boolean} f - Force
|
|
483
530
|
* @returns {Promise<string>}
|
|
@@ -487,35 +534,42 @@ export function installSaveDev (d, deps, r, f) {
|
|
|
487
534
|
|
|
488
535
|
const directory = normalize(d.trim())
|
|
489
536
|
|
|
490
|
-
|
|
537
|
+
info(`Directory is "${directory}"`)
|
|
491
538
|
|
|
492
539
|
return (
|
|
493
540
|
new Promise((resolve, reject) => {
|
|
494
541
|
const commands = getCommands(getInstallSaveDevCommands(deps, r, f))
|
|
495
542
|
const options = getOptions(directory)
|
|
543
|
+
/**
|
|
544
|
+
* @type {HandleComplete}
|
|
545
|
+
*/
|
|
546
|
+
function handleComplete (e, v) {
|
|
547
|
+
if (!e) {
|
|
548
|
+
resolve(v)
|
|
549
|
+
} else {
|
|
550
|
+
reject(e)
|
|
551
|
+
}
|
|
552
|
+
}
|
|
496
553
|
|
|
497
554
|
const {
|
|
498
555
|
stdout,
|
|
499
556
|
stderr
|
|
500
|
-
} = exec(commands, options,
|
|
501
|
-
return (!e) ? resolve(v) : reject(e)
|
|
502
|
-
})
|
|
557
|
+
} = exec(commands, options, handleComplete)
|
|
503
558
|
|
|
504
559
|
const log = use('install-save-dev')
|
|
505
560
|
|
|
506
|
-
stdout.on('data', log)
|
|
507
|
-
stderr.on('data', log)
|
|
561
|
+
if (stdout) stdout.on('data', log)
|
|
562
|
+
if (stderr) stderr.on('data', log)
|
|
508
563
|
})
|
|
509
564
|
)
|
|
510
565
|
}
|
|
511
566
|
|
|
512
567
|
/**
|
|
513
568
|
* @function installSaveProdSaveExact
|
|
514
|
-
*
|
|
569
|
+
* @description
|
|
515
570
|
* Spawn the `npm install --save-prod --save-exact` commands
|
|
516
|
-
*
|
|
517
571
|
* @param {string} d - Directory
|
|
518
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
572
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
519
573
|
* @param {string} r - Registry
|
|
520
574
|
* @param {boolean} f - Force
|
|
521
575
|
* @returns {Promise<string>}
|
|
@@ -525,35 +579,42 @@ export function installSaveProdSaveExact (d, deps, r, f) {
|
|
|
525
579
|
|
|
526
580
|
const directory = normalize(d.trim())
|
|
527
581
|
|
|
528
|
-
|
|
582
|
+
info(`Directory is "${directory}"`)
|
|
529
583
|
|
|
530
584
|
return (
|
|
531
585
|
new Promise((resolve, reject) => {
|
|
532
586
|
const commands = getCommands(getInstallSaveProdSaveExactCommands(deps, r, f))
|
|
533
587
|
const options = getOptions(directory)
|
|
588
|
+
/**
|
|
589
|
+
* @type {HandleComplete}
|
|
590
|
+
*/
|
|
591
|
+
function handleComplete (e, v) {
|
|
592
|
+
if (!e) {
|
|
593
|
+
resolve(v)
|
|
594
|
+
} else {
|
|
595
|
+
reject(e)
|
|
596
|
+
}
|
|
597
|
+
}
|
|
534
598
|
|
|
535
599
|
const {
|
|
536
600
|
stdout,
|
|
537
601
|
stderr
|
|
538
|
-
} = exec(commands, options,
|
|
539
|
-
return (!e) ? resolve(v) : reject(e)
|
|
540
|
-
})
|
|
602
|
+
} = exec(commands, options, handleComplete)
|
|
541
603
|
|
|
542
604
|
const log = use('install-save-prod-save-exact')
|
|
543
605
|
|
|
544
|
-
stdout.on('data', log)
|
|
545
|
-
stderr.on('data', log)
|
|
606
|
+
if (stdout) stdout.on('data', log)
|
|
607
|
+
if (stderr) stderr.on('data', log)
|
|
546
608
|
})
|
|
547
609
|
)
|
|
548
610
|
}
|
|
549
611
|
|
|
550
612
|
/**
|
|
551
613
|
* @function installSaveProd
|
|
552
|
-
*
|
|
614
|
+
* @description
|
|
553
615
|
* Spawn the `npm install --save-prod` commands
|
|
554
|
-
*
|
|
555
616
|
* @param {string} d - Directory
|
|
556
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
617
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
557
618
|
* @param {string} r - Registry
|
|
558
619
|
* @param {boolean} f - Force
|
|
559
620
|
* @returns {Promise<string>}
|
|
@@ -563,33 +624,40 @@ export function installSaveProd (d, deps, r, f) {
|
|
|
563
624
|
|
|
564
625
|
const directory = normalize(d.trim())
|
|
565
626
|
|
|
566
|
-
|
|
627
|
+
info(`Directory is "${directory}"`)
|
|
567
628
|
|
|
568
629
|
return (
|
|
569
630
|
new Promise((resolve, reject) => {
|
|
570
631
|
const commands = getCommands(getInstallSaveProdCommands(deps, r, f))
|
|
571
632
|
const options = getOptions(directory)
|
|
633
|
+
/**
|
|
634
|
+
* @type {HandleComplete}
|
|
635
|
+
*/
|
|
636
|
+
function handleComplete (e, v) {
|
|
637
|
+
if (!e) {
|
|
638
|
+
resolve(v)
|
|
639
|
+
} else {
|
|
640
|
+
reject(e)
|
|
641
|
+
}
|
|
642
|
+
}
|
|
572
643
|
|
|
573
644
|
const {
|
|
574
645
|
stdout,
|
|
575
646
|
stderr
|
|
576
|
-
} = exec(commands, options,
|
|
577
|
-
return (!e) ? resolve(v) : reject(e)
|
|
578
|
-
})
|
|
647
|
+
} = exec(commands, options, handleComplete)
|
|
579
648
|
|
|
580
649
|
const log = use('install-save-prod')
|
|
581
650
|
|
|
582
|
-
stdout.on('data', log)
|
|
583
|
-
stderr.on('data', log)
|
|
651
|
+
if (stdout) stdout.on('data', log)
|
|
652
|
+
if (stderr) stderr.on('data', log)
|
|
584
653
|
})
|
|
585
654
|
)
|
|
586
655
|
}
|
|
587
656
|
|
|
588
657
|
/**
|
|
589
658
|
* @function executeBundle
|
|
590
|
-
*
|
|
659
|
+
* @description
|
|
591
660
|
* Execute the `npm install --save-bundle --save-exact` and `npm install --save-bundle` commands
|
|
592
|
-
*
|
|
593
661
|
* @param {string} d - Directory
|
|
594
662
|
* @param {Dependencies} packageDependencies - Package dependencies
|
|
595
663
|
* @param {Dependencies} configurationDependencies - Configuration dependencies
|
|
@@ -611,9 +679,8 @@ export async function executeBundle (d = DIRECTORY, packageDependencies = {}, co
|
|
|
611
679
|
|
|
612
680
|
/**
|
|
613
681
|
* @function executeOptional
|
|
614
|
-
*
|
|
682
|
+
* @description
|
|
615
683
|
* Execute the `npm install --save-optional --save-exact` and `npm install --save-optional` commands
|
|
616
|
-
*
|
|
617
684
|
* @param {string} d - Directory
|
|
618
685
|
* @param {Dependencies} packageDependencies - Package dependencies
|
|
619
686
|
* @param {Dependencies} configurationDependencies - Configuration dependencies
|
|
@@ -635,9 +702,8 @@ export async function executeOptional (d = DIRECTORY, packageDependencies = {},
|
|
|
635
702
|
|
|
636
703
|
/**
|
|
637
704
|
* @function executeDev
|
|
638
|
-
*
|
|
705
|
+
* @description
|
|
639
706
|
* Execute the `npm install --save-dev --save-exact` and `npm install --save-dev` commands
|
|
640
|
-
*
|
|
641
707
|
* @param {string} d - Directory
|
|
642
708
|
* @param {Dependencies} packageDependencies - Package dependencies
|
|
643
709
|
* @param {Dependencies} configurationDependencies - Configuration dependencies
|
|
@@ -659,9 +725,8 @@ export async function executeDev (d = DIRECTORY, packageDependencies = {}, confi
|
|
|
659
725
|
|
|
660
726
|
/**
|
|
661
727
|
* @function executeProd
|
|
662
|
-
*
|
|
728
|
+
* @description
|
|
663
729
|
* Execute the `npm install --save-prod --save-exact` and `npm install --save-prod` commands
|
|
664
|
-
*
|
|
665
730
|
* @param {string} d - Directory
|
|
666
731
|
* @param {Dependencies} packageDependencies - Package dependencies
|
|
667
732
|
* @param {Dependencies} configurationDependencies - Configuration dependencies
|