@modernpoacher/deps 2.2.18 → 2.2.19
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 +161 -47
- package/bin/deps.mjs +6 -6
- package/bin/node/deps.mjs +5 -21
- package/bin/node/execute.mjs +137 -25
- package/bin/node/head.mjs +5 -21
- package/bin/node/install.mjs +5 -5
- package/bin/node/push.mjs +5 -21
- package/bin/node/wipe.mjs +5 -21
- package/eslint.config.mjs +86 -0
- package/index.d.mts +50 -0
- package/package.json +11 -9
- package/src/common/env/index.mjs +1 -1
- package/src/common/git/index.mjs +98 -62
- package/src/common/index.mjs +32 -55
- package/src/common/options/index.mjs +11 -18
- package/src/index.mjs +56 -44
- package/src/install/index.mjs +15 -19
- package/tsconfig.json +20 -0
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {DepsTypes.Options} Options
|
|
3
|
+
*/
|
|
4
|
+
|
|
1
5
|
import debug from 'debug'
|
|
2
6
|
|
|
3
7
|
import {
|
|
@@ -14,14 +18,17 @@ const {
|
|
|
14
18
|
}
|
|
15
19
|
} = process
|
|
16
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @type {Options}
|
|
23
|
+
*/
|
|
17
24
|
export const OPTIONS = {
|
|
18
25
|
maxBuffer: 1024 * 2000,
|
|
19
26
|
stdio: 'inherit',
|
|
20
27
|
env: {
|
|
21
28
|
DEBUG_COLORS: 'yes',
|
|
22
29
|
FORCE_COLOR: PLATFORM === 'win32'
|
|
23
|
-
? 3
|
|
24
|
-
: 2,
|
|
30
|
+
? '3'
|
|
31
|
+
: '2',
|
|
25
32
|
NODE_OPTIONS,
|
|
26
33
|
SSH_AUTH_SOCK,
|
|
27
34
|
HOME,
|
|
@@ -36,22 +43,8 @@ log(`\`common/options\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
|
36
43
|
/**
|
|
37
44
|
* @function getOptions
|
|
38
45
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @param {string} cwd normalized directory
|
|
42
|
-
* @returns {{
|
|
43
|
-
* maxBuffer: number,
|
|
44
|
-
* stdio: string
|
|
45
|
-
* env: {
|
|
46
|
-
* DEBUG_COLORS: string,
|
|
47
|
-
* FORCE_COLOR: number,
|
|
48
|
-
* NODE_OPTIONS: string,
|
|
49
|
-
* SSH_AUTH_SOCK?: string,
|
|
50
|
-
* HOME?: string,
|
|
51
|
-
* PATH?: string
|
|
52
|
-
* }
|
|
53
|
-
* cwd: string
|
|
54
|
-
* }}
|
|
46
|
+
* @param {string} [cwd] normalized directory
|
|
47
|
+
* @returns {Options & { cwd?: string }}
|
|
55
48
|
*/
|
|
56
49
|
export function getOptions (cwd) {
|
|
57
50
|
log('getOptions')
|
package/src/index.mjs
CHANGED
|
@@ -51,13 +51,25 @@ const info = debug('@modernpoacher/deps:info')
|
|
|
51
51
|
|
|
52
52
|
log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @param {string} v
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
*/
|
|
54
58
|
function filter (v) {
|
|
55
59
|
return Boolean(stripAnsi(v).trim())
|
|
56
60
|
}
|
|
57
61
|
|
|
62
|
+
/**
|
|
63
|
+
* @param {string} key
|
|
64
|
+
* @returns {(value: string) => void}
|
|
65
|
+
*/
|
|
58
66
|
export function use (key) {
|
|
59
67
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
60
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @param {string} v
|
|
71
|
+
* @returns {void}
|
|
72
|
+
*/
|
|
61
73
|
function write (v) {
|
|
62
74
|
log(v.trimEnd())
|
|
63
75
|
}
|
|
@@ -74,7 +86,7 @@ export function use (key) {
|
|
|
74
86
|
*
|
|
75
87
|
* Get the `npm install --save-exact` commands as a string
|
|
76
88
|
*
|
|
77
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
89
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
78
90
|
* @param {string} r - Registry
|
|
79
91
|
* @param {boolean} f - Force
|
|
80
92
|
* @returns {string}
|
|
@@ -92,7 +104,7 @@ export function getInstallSaveExactCommands (deps, r, f) {
|
|
|
92
104
|
*
|
|
93
105
|
* Get the `npm install` commands as a string
|
|
94
106
|
*
|
|
95
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
107
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
96
108
|
* @param {string} r - Registry
|
|
97
109
|
* @param {boolean} f - Force
|
|
98
110
|
* @returns {string}
|
|
@@ -110,7 +122,7 @@ export function getInstallCommands (deps, r, f) {
|
|
|
110
122
|
*
|
|
111
123
|
* Get the `npm install --save-bundle --save-exact` commands as a string
|
|
112
124
|
*
|
|
113
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
125
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
114
126
|
* @param {string} r - Registry
|
|
115
127
|
* @param {boolean} f - Force
|
|
116
128
|
* @returns {string}
|
|
@@ -132,7 +144,7 @@ export function getInstallSaveBundleSaveExactCommands (deps, r, f) {
|
|
|
132
144
|
*
|
|
133
145
|
* Get the `npm install --save-bundle` commands as a string
|
|
134
146
|
*
|
|
135
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
147
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
136
148
|
* @param {string} r - Registry
|
|
137
149
|
* @param {boolean} f - Force
|
|
138
150
|
* @returns {string}
|
|
@@ -154,7 +166,7 @@ export function getInstallSaveBundleCommands (deps, r, f) {
|
|
|
154
166
|
*
|
|
155
167
|
* Get the `npm install --save-optional --save-exact` commands as a string
|
|
156
168
|
*
|
|
157
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
169
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
158
170
|
* @param {string} r - Registry
|
|
159
171
|
* @param {boolean} f - Force
|
|
160
172
|
* @returns {string}
|
|
@@ -176,7 +188,7 @@ export function getInstallSaveOptionalSaveExactCommands (deps, r, f) {
|
|
|
176
188
|
*
|
|
177
189
|
* Get the `npm install --save-optional` commands as a string
|
|
178
190
|
*
|
|
179
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
191
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
180
192
|
* @param {string} r - Registry
|
|
181
193
|
* @param {boolean} f - Force
|
|
182
194
|
* @returns {string}
|
|
@@ -198,7 +210,7 @@ export function getInstallSaveOptionalCommands (deps, r, f) {
|
|
|
198
210
|
*
|
|
199
211
|
* Get the `npm install --save-dev --save-exact` commands as a string
|
|
200
212
|
*
|
|
201
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
213
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
202
214
|
* @param {string} r - Registry
|
|
203
215
|
* @param {boolean} f - Force
|
|
204
216
|
* @returns {string}
|
|
@@ -220,7 +232,7 @@ export function getInstallSaveDevSaveExactCommands (deps, r, f) {
|
|
|
220
232
|
*
|
|
221
233
|
* Get the `npm install --save-dev` commands as a string
|
|
222
234
|
*
|
|
223
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
235
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
224
236
|
* @param {string} r - Registry
|
|
225
237
|
* @param {boolean} f - Force
|
|
226
238
|
* @returns {string}
|
|
@@ -242,7 +254,7 @@ export function getInstallSaveDevCommands (deps, r, f) {
|
|
|
242
254
|
*
|
|
243
255
|
* Get the `npm install --save-prod --save-exact` commands as a string
|
|
244
256
|
*
|
|
245
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
257
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
246
258
|
* @param {string} r - Registry
|
|
247
259
|
* @param {boolean} f - Force
|
|
248
260
|
* @returns {string}
|
|
@@ -264,7 +276,7 @@ export function getInstallSaveProdSaveExactCommands (deps, r, f) {
|
|
|
264
276
|
*
|
|
265
277
|
* Get the `npm install --save-prod` commands as a string
|
|
266
278
|
*
|
|
267
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
279
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
268
280
|
* @param {string} r - Registry
|
|
269
281
|
* @param {boolean} f - Force
|
|
270
282
|
* @returns {string}
|
|
@@ -287,7 +299,7 @@ export function getInstallSaveProdCommands (deps, r, f) {
|
|
|
287
299
|
* Spawn the `npm install --save-bundle --save-exact` commands
|
|
288
300
|
*
|
|
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,7 +309,7 @@ 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) => {
|
|
@@ -313,8 +325,8 @@ export function installSaveBundleSaveExact (d, deps, r, f) {
|
|
|
313
325
|
|
|
314
326
|
const log = use('install-save-bundle-save-exact')
|
|
315
327
|
|
|
316
|
-
stdout.on('data', log)
|
|
317
|
-
stderr.on('data', log)
|
|
328
|
+
if (stdout) stdout.on('data', log)
|
|
329
|
+
if (stderr) stderr.on('data', log)
|
|
318
330
|
})
|
|
319
331
|
)
|
|
320
332
|
}
|
|
@@ -325,7 +337,7 @@ export function installSaveBundleSaveExact (d, deps, r, f) {
|
|
|
325
337
|
* Spawn the `npm install --save-bundle` commands
|
|
326
338
|
*
|
|
327
339
|
* @param {string} d - Directory
|
|
328
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
340
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
329
341
|
* @param {string} r - Registry
|
|
330
342
|
* @param {boolean} f - Force
|
|
331
343
|
* @returns {Promise<string>}
|
|
@@ -335,7 +347,7 @@ export function installSaveBundle (d, deps, r, f) {
|
|
|
335
347
|
|
|
336
348
|
const directory = normalize(d.trim())
|
|
337
349
|
|
|
338
|
-
|
|
350
|
+
info(`Directory is "${directory}"`)
|
|
339
351
|
|
|
340
352
|
return (
|
|
341
353
|
new Promise((resolve, reject) => {
|
|
@@ -351,8 +363,8 @@ export function installSaveBundle (d, deps, r, f) {
|
|
|
351
363
|
|
|
352
364
|
const log = use('install-save-bundle')
|
|
353
365
|
|
|
354
|
-
stdout.on('data', log)
|
|
355
|
-
stderr.on('data', log)
|
|
366
|
+
if (stdout) stdout.on('data', log)
|
|
367
|
+
if (stderr) stderr.on('data', log)
|
|
356
368
|
})
|
|
357
369
|
)
|
|
358
370
|
}
|
|
@@ -363,7 +375,7 @@ export function installSaveBundle (d, deps, r, f) {
|
|
|
363
375
|
* Spawn the `npm install --save-optional --save-exact` commands
|
|
364
376
|
*
|
|
365
377
|
* @param {string} d - Directory
|
|
366
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
378
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
367
379
|
* @param {string} r - Registry
|
|
368
380
|
* @param {boolean} f - Force
|
|
369
381
|
* @returns {Promise<string>}
|
|
@@ -373,7 +385,7 @@ export function installSaveOptionalSaveExact (d, deps, r, f) {
|
|
|
373
385
|
|
|
374
386
|
const directory = normalize(d.trim())
|
|
375
387
|
|
|
376
|
-
|
|
388
|
+
info(`Directory is "${directory}"`)
|
|
377
389
|
|
|
378
390
|
return (
|
|
379
391
|
new Promise((resolve, reject) => {
|
|
@@ -389,8 +401,8 @@ export function installSaveOptionalSaveExact (d, deps, r, f) {
|
|
|
389
401
|
|
|
390
402
|
const log = use('install-save-otional-save-exact')
|
|
391
403
|
|
|
392
|
-
stdout.on('data', log)
|
|
393
|
-
stderr.on('data', log)
|
|
404
|
+
if (stdout) stdout.on('data', log)
|
|
405
|
+
if (stderr) stderr.on('data', log)
|
|
394
406
|
})
|
|
395
407
|
)
|
|
396
408
|
}
|
|
@@ -401,21 +413,21 @@ export function installSaveOptionalSaveExact (d, deps, r, f) {
|
|
|
401
413
|
* Spawn the `npm install --save-optional` commands
|
|
402
414
|
*
|
|
403
415
|
* @param {string} d - Directory
|
|
404
|
-
* @param {
|
|
416
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependencies
|
|
405
417
|
* @param {string} r - Registry
|
|
406
418
|
* @param {boolean} f - Force
|
|
407
419
|
* @returns {Promise<string>}
|
|
408
420
|
*/
|
|
409
|
-
export function installSaveOptional (d,
|
|
421
|
+
export function installSaveOptional (d, deps, r, f) {
|
|
410
422
|
log('installSaveOptional')
|
|
411
423
|
|
|
412
424
|
const directory = normalize(d.trim())
|
|
413
425
|
|
|
414
|
-
|
|
426
|
+
info(`Directory is "${directory}"`)
|
|
415
427
|
|
|
416
428
|
return (
|
|
417
429
|
new Promise((resolve, reject) => {
|
|
418
|
-
const commands = getCommands(getInstallSaveOptionalCommands(
|
|
430
|
+
const commands = getCommands(getInstallSaveOptionalCommands(deps, r, f))
|
|
419
431
|
const options = getOptions(directory)
|
|
420
432
|
|
|
421
433
|
const {
|
|
@@ -427,8 +439,8 @@ export function installSaveOptional (d, dependencies, r, f) {
|
|
|
427
439
|
|
|
428
440
|
const log = use('install-save-otional')
|
|
429
441
|
|
|
430
|
-
stdout.on('data', log)
|
|
431
|
-
stderr.on('data', log)
|
|
442
|
+
if (stdout) stdout.on('data', log)
|
|
443
|
+
if (stderr) stderr.on('data', log)
|
|
432
444
|
})
|
|
433
445
|
)
|
|
434
446
|
}
|
|
@@ -439,7 +451,7 @@ export function installSaveOptional (d, dependencies, r, f) {
|
|
|
439
451
|
* Spawn the `npm install --save-dev --save-exact` commands
|
|
440
452
|
*
|
|
441
453
|
* @param {string} d - Directory
|
|
442
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
454
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
443
455
|
* @param {string} r - Registry
|
|
444
456
|
* @param {boolean} f - Force
|
|
445
457
|
* @returns {Promise<string>}
|
|
@@ -449,7 +461,7 @@ export function installSaveDevSaveExact (d, deps, r, f) {
|
|
|
449
461
|
|
|
450
462
|
const directory = normalize(d.trim())
|
|
451
463
|
|
|
452
|
-
|
|
464
|
+
info(`Directory is "${directory}"`)
|
|
453
465
|
|
|
454
466
|
return (
|
|
455
467
|
new Promise((resolve, reject) => {
|
|
@@ -465,8 +477,8 @@ export function installSaveDevSaveExact (d, deps, r, f) {
|
|
|
465
477
|
|
|
466
478
|
const log = use('install-save-dev-save-exact')
|
|
467
479
|
|
|
468
|
-
stdout.on('data', log)
|
|
469
|
-
stderr.on('data', log)
|
|
480
|
+
if (stdout) stdout.on('data', log)
|
|
481
|
+
if (stderr) stderr.on('data', log)
|
|
470
482
|
})
|
|
471
483
|
)
|
|
472
484
|
}
|
|
@@ -477,7 +489,7 @@ export function installSaveDevSaveExact (d, deps, r, f) {
|
|
|
477
489
|
* Spawn the `npm install --save-dev` commands
|
|
478
490
|
*
|
|
479
491
|
* @param {string} d - Directory
|
|
480
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
492
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
481
493
|
* @param {string} r - Registry
|
|
482
494
|
* @param {boolean} f - Force
|
|
483
495
|
* @returns {Promise<string>}
|
|
@@ -487,7 +499,7 @@ export function installSaveDev (d, deps, r, f) {
|
|
|
487
499
|
|
|
488
500
|
const directory = normalize(d.trim())
|
|
489
501
|
|
|
490
|
-
|
|
502
|
+
info(`Directory is "${directory}"`)
|
|
491
503
|
|
|
492
504
|
return (
|
|
493
505
|
new Promise((resolve, reject) => {
|
|
@@ -503,8 +515,8 @@ export function installSaveDev (d, deps, r, f) {
|
|
|
503
515
|
|
|
504
516
|
const log = use('install-save-dev')
|
|
505
517
|
|
|
506
|
-
stdout.on('data', log)
|
|
507
|
-
stderr.on('data', log)
|
|
518
|
+
if (stdout) stdout.on('data', log)
|
|
519
|
+
if (stderr) stderr.on('data', log)
|
|
508
520
|
})
|
|
509
521
|
)
|
|
510
522
|
}
|
|
@@ -515,7 +527,7 @@ export function installSaveDev (d, deps, r, f) {
|
|
|
515
527
|
* Spawn the `npm install --save-prod --save-exact` commands
|
|
516
528
|
*
|
|
517
529
|
* @param {string} d - Directory
|
|
518
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
530
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
519
531
|
* @param {string} r - Registry
|
|
520
532
|
* @param {boolean} f - Force
|
|
521
533
|
* @returns {Promise<string>}
|
|
@@ -525,7 +537,7 @@ export function installSaveProdSaveExact (d, deps, r, f) {
|
|
|
525
537
|
|
|
526
538
|
const directory = normalize(d.trim())
|
|
527
539
|
|
|
528
|
-
|
|
540
|
+
info(`Directory is "${directory}"`)
|
|
529
541
|
|
|
530
542
|
return (
|
|
531
543
|
new Promise((resolve, reject) => {
|
|
@@ -541,8 +553,8 @@ export function installSaveProdSaveExact (d, deps, r, f) {
|
|
|
541
553
|
|
|
542
554
|
const log = use('install-save-prod-save-exact')
|
|
543
555
|
|
|
544
|
-
stdout.on('data', log)
|
|
545
|
-
stderr.on('data', log)
|
|
556
|
+
if (stdout) stdout.on('data', log)
|
|
557
|
+
if (stderr) stderr.on('data', log)
|
|
546
558
|
})
|
|
547
559
|
)
|
|
548
560
|
}
|
|
@@ -553,7 +565,7 @@ export function installSaveProdSaveExact (d, deps, r, f) {
|
|
|
553
565
|
* Spawn the `npm install --save-prod` commands
|
|
554
566
|
*
|
|
555
567
|
* @param {string} d - Directory
|
|
556
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
568
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
557
569
|
* @param {string} r - Registry
|
|
558
570
|
* @param {boolean} f - Force
|
|
559
571
|
* @returns {Promise<string>}
|
|
@@ -563,7 +575,7 @@ export function installSaveProd (d, deps, r, f) {
|
|
|
563
575
|
|
|
564
576
|
const directory = normalize(d.trim())
|
|
565
577
|
|
|
566
|
-
|
|
578
|
+
info(`Directory is "${directory}"`)
|
|
567
579
|
|
|
568
580
|
return (
|
|
569
581
|
new Promise((resolve, reject) => {
|
|
@@ -579,8 +591,8 @@ export function installSaveProd (d, deps, r, f) {
|
|
|
579
591
|
|
|
580
592
|
const log = use('install-save-prod')
|
|
581
593
|
|
|
582
|
-
stdout.on('data', log)
|
|
583
|
-
stderr.on('data', log)
|
|
594
|
+
if (stdout) stdout.on('data', log)
|
|
595
|
+
if (stderr) stderr.on('data', log)
|
|
584
596
|
})
|
|
585
597
|
)
|
|
586
598
|
}
|
package/src/install/index.mjs
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @typedef {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A configuration
|
|
8
|
-
* @typedef {import('../common/index.mjs').Configuration} Configuration
|
|
2
|
+
* @typedef {DepsTypes.DependencyDescriptor} DependencyDescriptor
|
|
3
|
+
* @typedef {DepsTypes.Package} Package
|
|
4
|
+
* @typedef {DepsTypes.Configuration} Configuration
|
|
9
5
|
*/
|
|
10
6
|
|
|
11
7
|
import debug from 'debug'
|
|
@@ -51,7 +47,7 @@ log(`\`install\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
|
51
47
|
*
|
|
52
48
|
* Get the `install --save-exact` commands as a string
|
|
53
49
|
*
|
|
54
|
-
* @param {
|
|
50
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} p - Package
|
|
55
51
|
* @param {boolean} s - Save
|
|
56
52
|
* @param {string} r - Registry
|
|
57
53
|
* @param {boolean} f - Force
|
|
@@ -74,7 +70,7 @@ export function getInstallSaveExactCommands (p, s, r, f) {
|
|
|
74
70
|
*
|
|
75
71
|
* Get the `install` commands as a string
|
|
76
72
|
*
|
|
77
|
-
* @param {
|
|
73
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} p - Package
|
|
78
74
|
* @param {boolean} s - Save
|
|
79
75
|
* @param {string} r - Registry
|
|
80
76
|
* @param {boolean} f - Force
|
|
@@ -98,10 +94,10 @@ export function getInstallCommands (p, s, r, f) {
|
|
|
98
94
|
* Spawn the `install --save-exact` commands
|
|
99
95
|
*
|
|
100
96
|
* @param {string} d - Directory
|
|
101
|
-
* @param {
|
|
102
|
-
* @param {Configuration} c - Configuration
|
|
97
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} p - Package
|
|
103
98
|
* @param {boolean} s - Save
|
|
104
99
|
* @param {string} r - Registry
|
|
100
|
+
* @param {boolean} f - Force
|
|
105
101
|
* @returns {Promise<string>}
|
|
106
102
|
*/
|
|
107
103
|
export function installSaveExact (d, p, s, r, f) {
|
|
@@ -109,7 +105,7 @@ export function installSaveExact (d, p, s, r, f) {
|
|
|
109
105
|
|
|
110
106
|
const directory = normalize(d.trim())
|
|
111
107
|
|
|
112
|
-
|
|
108
|
+
info(`Directory is "${directory}"`)
|
|
113
109
|
|
|
114
110
|
return (
|
|
115
111
|
new Promise((resolve, reject) => {
|
|
@@ -123,8 +119,8 @@ export function installSaveExact (d, p, s, r, f) {
|
|
|
123
119
|
return (!e) ? resolve(v) : reject(e)
|
|
124
120
|
})
|
|
125
121
|
|
|
126
|
-
stdout.on('data', log)
|
|
127
|
-
stderr.on('data', log)
|
|
122
|
+
if (stdout) stdout.on('data', log)
|
|
123
|
+
if (stderr) stderr.on('data', log)
|
|
128
124
|
})
|
|
129
125
|
)
|
|
130
126
|
}
|
|
@@ -135,10 +131,10 @@ export function installSaveExact (d, p, s, r, f) {
|
|
|
135
131
|
* Spawn the `install` commands
|
|
136
132
|
*
|
|
137
133
|
* @param {string} d - Directory
|
|
138
|
-
* @param {
|
|
139
|
-
* @param {Configuration} c - Configuration
|
|
134
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} p - Package
|
|
140
135
|
* @param {boolean} s - Save
|
|
141
136
|
* @param {string} r - Registry
|
|
137
|
+
* @param {boolean} f - Force
|
|
142
138
|
* @returns {Promise<string>}
|
|
143
139
|
*/
|
|
144
140
|
export function install (d, p, s, r, f) {
|
|
@@ -146,7 +142,7 @@ export function install (d, p, s, r, f) {
|
|
|
146
142
|
|
|
147
143
|
const directory = normalize(d.trim())
|
|
148
144
|
|
|
149
|
-
|
|
145
|
+
info(`Directory is "${directory}"`)
|
|
150
146
|
|
|
151
147
|
return (
|
|
152
148
|
new Promise((resolve, reject) => {
|
|
@@ -160,8 +156,8 @@ export function install (d, p, s, r, f) {
|
|
|
160
156
|
return (!e) ? resolve(v) : reject(e)
|
|
161
157
|
})
|
|
162
158
|
|
|
163
|
-
stdout.on('data', log)
|
|
164
|
-
stderr.on('data', log)
|
|
159
|
+
if (stdout) stdout.on('data', log)
|
|
160
|
+
if (stderr) stderr.on('data', log)
|
|
165
161
|
})
|
|
166
162
|
)
|
|
167
163
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "NodeNext",
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"checkJs": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"baseUrl": "."
|
|
10
|
+
},
|
|
11
|
+
"include": [
|
|
12
|
+
"."
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"test",
|
|
16
|
+
".circleci",
|
|
17
|
+
".github",
|
|
18
|
+
".husky",
|
|
19
|
+
]
|
|
20
|
+
}
|