@modernpoacher/deps 2.0.16 → 2.0.18
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/execute/app.mjs +47 -5
- package/package.json +7 -7
- package/src/common/git/index.mjs +50 -55
- package/src/common/index.mjs +111 -80
- package/src/index.mjs +210 -176
- package/src/install/index.mjs +56 -39
package/src/index.mjs
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package or configuration dependencies
|
|
3
|
+
* @typedef {import('./common/index.mjs').Dependencies} Dependencies
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Dependency descriptor
|
|
8
|
+
* @typedef {import('./common/index.mjs').DependencyDescriptor} DependencyDescriptor
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import debug from 'debug'
|
|
2
12
|
|
|
3
13
|
import {
|
|
@@ -65,16 +75,16 @@ function use (key) {
|
|
|
65
75
|
*
|
|
66
76
|
* Get the `npm install --save-exact` commands as a string of parameters and arguments
|
|
67
77
|
*
|
|
68
|
-
* @param {
|
|
69
|
-
* @param {
|
|
70
|
-
* @param {
|
|
78
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
79
|
+
* @param {string} r - Registry
|
|
80
|
+
* @param {boolean} f - Force
|
|
71
81
|
*
|
|
72
|
-
* @return {
|
|
82
|
+
* @return {string}
|
|
73
83
|
*/
|
|
74
|
-
export function getInstallSaveExactCommands (
|
|
84
|
+
export function getInstallSaveExactCommands (deps, r, f) {
|
|
75
85
|
log('getInstallSaveExactCommands')
|
|
76
86
|
|
|
77
|
-
const c = transform(
|
|
87
|
+
const c = transform(deps)
|
|
78
88
|
const commands = `npm i ${c}`
|
|
79
89
|
|
|
80
90
|
return normalizeCommands(
|
|
@@ -87,16 +97,16 @@ export function getInstallSaveExactCommands (p, r, f) {
|
|
|
87
97
|
*
|
|
88
98
|
* Get the `npm install` commands as a string of parameters and arguments
|
|
89
99
|
*
|
|
90
|
-
* @param {
|
|
91
|
-
* @param {
|
|
92
|
-
* @param {
|
|
100
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
101
|
+
* @param {string} r - Registry
|
|
102
|
+
* @param {boolean} f - Force
|
|
93
103
|
*
|
|
94
|
-
* @return {
|
|
104
|
+
* @return {string}
|
|
95
105
|
*/
|
|
96
|
-
export function getInstallCommands (
|
|
106
|
+
export function getInstallCommands (deps, r, f) {
|
|
97
107
|
log('getInstallCommands')
|
|
98
108
|
|
|
99
|
-
const c = transform(
|
|
109
|
+
const c = transform(deps)
|
|
100
110
|
const commands = `npm i ${c}`
|
|
101
111
|
|
|
102
112
|
return normalizeCommands(
|
|
@@ -109,16 +119,16 @@ export function getInstallCommands (p, r, f) {
|
|
|
109
119
|
*
|
|
110
120
|
* Get the `npm install --save-bundle --save-exact` commands as a string of parameters and arguments
|
|
111
121
|
*
|
|
112
|
-
* @param {
|
|
113
|
-
* @param {
|
|
114
|
-
* @param {
|
|
122
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
123
|
+
* @param {string} r - Registry
|
|
124
|
+
* @param {boolean} f - Force
|
|
115
125
|
*
|
|
116
|
-
* @return {
|
|
126
|
+
* @return {string}
|
|
117
127
|
*/
|
|
118
|
-
export function getInstallSaveBundleSaveExactCommands (
|
|
128
|
+
export function getInstallSaveBundleSaveExactCommands (deps, r, f) {
|
|
119
129
|
log('getInstallSaveBundleSaveExactCommands')
|
|
120
130
|
|
|
121
|
-
const commands = getInstallSaveExactCommands(
|
|
131
|
+
const commands = getInstallSaveExactCommands(deps, r, f)
|
|
122
132
|
|
|
123
133
|
return normalizeCommands(
|
|
124
134
|
getSaveBundleParameter(commands)
|
|
@@ -130,16 +140,16 @@ export function getInstallSaveBundleSaveExactCommands (p, r, f) {
|
|
|
130
140
|
*
|
|
131
141
|
* Get the `npm install --save-bundle` commands as a string of parameters and arguments
|
|
132
142
|
*
|
|
133
|
-
* @param {
|
|
134
|
-
* @param {
|
|
135
|
-
* @param {
|
|
143
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
144
|
+
* @param {string} r - Registry
|
|
145
|
+
* @param {boolean} f - Force
|
|
136
146
|
*
|
|
137
|
-
* @return {
|
|
147
|
+
* @return {string}
|
|
138
148
|
*/
|
|
139
|
-
export function getInstallSaveBundleCommands (
|
|
149
|
+
export function getInstallSaveBundleCommands (deps, r, f) {
|
|
140
150
|
log('getInstallSaveBundleCommands')
|
|
141
151
|
|
|
142
|
-
const commands = getInstallCommands(
|
|
152
|
+
const commands = getInstallCommands(deps, r, f)
|
|
143
153
|
|
|
144
154
|
return normalizeCommands(
|
|
145
155
|
getSaveBundleParameter(commands)
|
|
@@ -151,16 +161,16 @@ export function getInstallSaveBundleCommands (p, r, f) {
|
|
|
151
161
|
*
|
|
152
162
|
* Get the `npm install --save-optional --save-exact` commands as a string of parameters and arguments
|
|
153
163
|
*
|
|
154
|
-
* @param {
|
|
155
|
-
* @param {
|
|
156
|
-
* @param {
|
|
164
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
165
|
+
* @param {string} r - Registry
|
|
166
|
+
* @param {boolean} f - Force
|
|
157
167
|
*
|
|
158
|
-
* @return {
|
|
168
|
+
* @return {string}
|
|
159
169
|
*/
|
|
160
|
-
export function getInstallSaveOptionalSaveExactCommands (
|
|
170
|
+
export function getInstallSaveOptionalSaveExactCommands (deps, r, f) {
|
|
161
171
|
log('getInstallSaveOptionalSaveExactCommands')
|
|
162
172
|
|
|
163
|
-
const commands = getInstallSaveExactCommands(
|
|
173
|
+
const commands = getInstallSaveExactCommands(deps, r, f)
|
|
164
174
|
|
|
165
175
|
return normalizeCommands(
|
|
166
176
|
getSaveOptionalParameter(commands)
|
|
@@ -172,16 +182,16 @@ export function getInstallSaveOptionalSaveExactCommands (p, r, f) {
|
|
|
172
182
|
*
|
|
173
183
|
* Get the `npm install --save-optional` commands as a string of parameters and arguments
|
|
174
184
|
*
|
|
175
|
-
* @param {
|
|
176
|
-
* @param {
|
|
177
|
-
* @param {
|
|
185
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
186
|
+
* @param {string} r - Registry
|
|
187
|
+
* @param {boolean} f - Force
|
|
178
188
|
*
|
|
179
|
-
* @return {
|
|
189
|
+
* @return {string}
|
|
180
190
|
*/
|
|
181
|
-
export function getInstallSaveOptionalCommands (
|
|
191
|
+
export function getInstallSaveOptionalCommands (deps, r, f) {
|
|
182
192
|
log('getInstallSaveOptionalCommands')
|
|
183
193
|
|
|
184
|
-
const commands = getInstallCommands(
|
|
194
|
+
const commands = getInstallCommands(deps, r, f)
|
|
185
195
|
|
|
186
196
|
return normalizeCommands(
|
|
187
197
|
getSaveOptionalParameter(commands)
|
|
@@ -193,16 +203,16 @@ export function getInstallSaveOptionalCommands (p, r, f) {
|
|
|
193
203
|
*
|
|
194
204
|
* Get the `npm install --save-dev --save-exact` commands as a string of parameters and arguments
|
|
195
205
|
*
|
|
196
|
-
* @param {
|
|
197
|
-
* @param {
|
|
198
|
-
* @param {
|
|
206
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
207
|
+
* @param {string} r - Registry
|
|
208
|
+
* @param {boolean} f - Force
|
|
199
209
|
*
|
|
200
|
-
* @return {
|
|
210
|
+
* @return {string}
|
|
201
211
|
*/
|
|
202
|
-
export function getInstallSaveDevSaveExactCommands (
|
|
212
|
+
export function getInstallSaveDevSaveExactCommands (deps, r, f) {
|
|
203
213
|
log('getInstallSaveDevSaveExactCommands')
|
|
204
214
|
|
|
205
|
-
const commands = getInstallSaveExactCommands(
|
|
215
|
+
const commands = getInstallSaveExactCommands(deps, r, f)
|
|
206
216
|
|
|
207
217
|
return normalizeCommands(
|
|
208
218
|
getSaveDevParameter(commands)
|
|
@@ -214,16 +224,16 @@ export function getInstallSaveDevSaveExactCommands (p, r, f) {
|
|
|
214
224
|
*
|
|
215
225
|
* Get the `npm install --save-dev` commands as a string of parameters and arguments
|
|
216
226
|
*
|
|
217
|
-
* @param {
|
|
218
|
-
* @param {
|
|
219
|
-
* @param {
|
|
227
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
228
|
+
* @param {string} r - Registry
|
|
229
|
+
* @param {boolean} f - Force
|
|
220
230
|
*
|
|
221
|
-
* @return {
|
|
231
|
+
* @return {string}
|
|
222
232
|
*/
|
|
223
|
-
export function getInstallSaveDevCommands (
|
|
233
|
+
export function getInstallSaveDevCommands (deps, r, f) {
|
|
224
234
|
log('getInstallSaveDevCommands')
|
|
225
235
|
|
|
226
|
-
const commands = getInstallCommands(
|
|
236
|
+
const commands = getInstallCommands(deps, r, f)
|
|
227
237
|
|
|
228
238
|
return normalizeCommands(
|
|
229
239
|
getSaveDevParameter(commands)
|
|
@@ -235,16 +245,16 @@ export function getInstallSaveDevCommands (p, r, f) {
|
|
|
235
245
|
*
|
|
236
246
|
* Get the `npm install --save-prod --save-exact` commands as a string of parameters and arguments
|
|
237
247
|
*
|
|
238
|
-
* @param {
|
|
239
|
-
* @param {
|
|
240
|
-
* @param {
|
|
248
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
249
|
+
* @param {string} r - Registry
|
|
250
|
+
* @param {boolean} f - Force
|
|
241
251
|
*
|
|
242
|
-
* @return {
|
|
252
|
+
* @return {string}
|
|
243
253
|
*/
|
|
244
|
-
export function getInstallSaveProdSaveExactCommands (
|
|
254
|
+
export function getInstallSaveProdSaveExactCommands (deps, r, f) {
|
|
245
255
|
log('getInstallSaveProdSaveExactCommands')
|
|
246
256
|
|
|
247
|
-
const commands = getInstallSaveExactCommands(
|
|
257
|
+
const commands = getInstallSaveExactCommands(deps, r, f)
|
|
248
258
|
|
|
249
259
|
return normalizeCommands(
|
|
250
260
|
getSaveProdParameter(commands)
|
|
@@ -256,16 +266,16 @@ export function getInstallSaveProdSaveExactCommands (p, r, f) {
|
|
|
256
266
|
*
|
|
257
267
|
* Get the `npm install --save-prod` commands as a string of parameters and arguments
|
|
258
268
|
*
|
|
259
|
-
* @param {
|
|
260
|
-
* @param {
|
|
261
|
-
* @param {
|
|
269
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
270
|
+
* @param {string} r - Registry
|
|
271
|
+
* @param {boolean} f - Force
|
|
262
272
|
*
|
|
263
|
-
* @return {
|
|
273
|
+
* @return {string}
|
|
264
274
|
*/
|
|
265
|
-
export function getInstallSaveProdCommands (
|
|
275
|
+
export function getInstallSaveProdCommands (deps, r, f) {
|
|
266
276
|
log('getInstallSaveProdCommands')
|
|
267
277
|
|
|
268
|
-
const commands = getInstallCommands(
|
|
278
|
+
const commands = getInstallCommands(deps, r, f)
|
|
269
279
|
|
|
270
280
|
return normalizeCommands(
|
|
271
281
|
getSaveProdParameter(commands)
|
|
@@ -277,25 +287,28 @@ export function getInstallSaveProdCommands (p, r, f) {
|
|
|
277
287
|
*
|
|
278
288
|
* Spawn the `npm install --save-bundle --save-exact` commands
|
|
279
289
|
*
|
|
280
|
-
* @param {
|
|
281
|
-
* @param {
|
|
282
|
-
* @param {
|
|
283
|
-
* @param {
|
|
290
|
+
* @param {string} d - Directory
|
|
291
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
292
|
+
* @param {string} r - Registry
|
|
293
|
+
* @param {boolean} f - Force
|
|
284
294
|
*
|
|
285
|
-
* @return {Promise}
|
|
295
|
+
* @return {Promise<string>}
|
|
286
296
|
*/
|
|
287
|
-
export function installSaveBundleSaveExact (d,
|
|
297
|
+
export function installSaveBundleSaveExact (d, deps, r, f) {
|
|
288
298
|
log('installSaveBundleSaveExact')
|
|
289
299
|
|
|
300
|
+
const directory = normalize(d)
|
|
301
|
+
|
|
302
|
+
log(`Directory is "${directory}"`)
|
|
303
|
+
|
|
290
304
|
return (
|
|
291
305
|
new Promise((resolve, reject) => {
|
|
292
|
-
const
|
|
293
|
-
const commands = getCommands(D, getInstallSaveBundleSaveExactCommands(p, r, f))
|
|
306
|
+
const commands = getCommands(getInstallSaveBundleSaveExactCommands(deps, r, f))
|
|
294
307
|
|
|
295
308
|
const {
|
|
296
309
|
stdout,
|
|
297
310
|
stderr
|
|
298
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
311
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => {
|
|
299
312
|
(!e)
|
|
300
313
|
? resolve(v)
|
|
301
314
|
: reject(e)
|
|
@@ -314,25 +327,28 @@ export function installSaveBundleSaveExact (d, p, r, f) {
|
|
|
314
327
|
*
|
|
315
328
|
* Spawn the `npm install --save-bundle` commands
|
|
316
329
|
*
|
|
317
|
-
* @param {
|
|
318
|
-
* @param {
|
|
319
|
-
* @param {
|
|
320
|
-
* @param {
|
|
330
|
+
* @param {string} d - Directory
|
|
331
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
332
|
+
* @param {string} r - Registry
|
|
333
|
+
* @param {boolean} f - Force
|
|
321
334
|
*
|
|
322
|
-
* @return {Promise}
|
|
335
|
+
* @return {Promise<string>}
|
|
323
336
|
*/
|
|
324
|
-
export function installSaveBundle (d,
|
|
337
|
+
export function installSaveBundle (d, deps, r, f) {
|
|
325
338
|
log('installSaveBundle')
|
|
326
339
|
|
|
340
|
+
const directory = normalize(d)
|
|
341
|
+
|
|
342
|
+
log(`Directory is "${directory}"`)
|
|
343
|
+
|
|
327
344
|
return (
|
|
328
345
|
new Promise((resolve, reject) => {
|
|
329
|
-
const
|
|
330
|
-
const commands = getCommands(D, getInstallSaveBundleCommands(p, r, f))
|
|
346
|
+
const commands = getCommands(getInstallSaveBundleCommands(deps, r, f))
|
|
331
347
|
|
|
332
348
|
const {
|
|
333
349
|
stdout,
|
|
334
350
|
stderr
|
|
335
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
351
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => {
|
|
336
352
|
(!e)
|
|
337
353
|
? resolve(v)
|
|
338
354
|
: reject(e)
|
|
@@ -351,25 +367,28 @@ export function installSaveBundle (d, p, r, f) {
|
|
|
351
367
|
*
|
|
352
368
|
* Spawn the `npm install --save-optional --save-exact` commands
|
|
353
369
|
*
|
|
354
|
-
* @param {
|
|
355
|
-
* @param {
|
|
356
|
-
* @param {
|
|
357
|
-
* @param {
|
|
370
|
+
* @param {string} d - Directory
|
|
371
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
372
|
+
* @param {string} r - Registry
|
|
373
|
+
* @param {boolean} f - Force
|
|
358
374
|
*
|
|
359
|
-
* @return {Promise}
|
|
375
|
+
* @return {Promise<string>}
|
|
360
376
|
*/
|
|
361
|
-
export function installSaveOptionalSaveExact (d,
|
|
377
|
+
export function installSaveOptionalSaveExact (d, deps, r, f) {
|
|
362
378
|
log('installSaveOptionalSaveExact')
|
|
363
379
|
|
|
380
|
+
const directory = normalize(d)
|
|
381
|
+
|
|
382
|
+
log(`Directory is "${directory}"`)
|
|
383
|
+
|
|
364
384
|
return (
|
|
365
385
|
new Promise((resolve, reject) => {
|
|
366
|
-
const
|
|
367
|
-
const commands = getCommands(D, getInstallSaveOptionalSaveExactCommands(p, r, f))
|
|
386
|
+
const commands = getCommands(getInstallSaveOptionalSaveExactCommands(deps, r, f))
|
|
368
387
|
|
|
369
388
|
const {
|
|
370
389
|
stdout,
|
|
371
390
|
stderr
|
|
372
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
391
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => {
|
|
373
392
|
(!e)
|
|
374
393
|
? resolve(v)
|
|
375
394
|
: reject(e)
|
|
@@ -388,25 +407,28 @@ export function installSaveOptionalSaveExact (d, p, r, f) {
|
|
|
388
407
|
*
|
|
389
408
|
* Spawn the `npm install --save-optional` commands
|
|
390
409
|
*
|
|
391
|
-
* @param {
|
|
392
|
-
* @param {
|
|
393
|
-
* @param {
|
|
394
|
-
* @param {
|
|
410
|
+
* @param {string} d - Directory
|
|
411
|
+
* @param {Dependencies} dependencies - Dependencies
|
|
412
|
+
* @param {string} r - Registry
|
|
413
|
+
* @param {boolean} f - Force
|
|
395
414
|
*
|
|
396
|
-
* @return {Promise}
|
|
415
|
+
* @return {Promise<string>}
|
|
397
416
|
*/
|
|
398
|
-
export function installSaveOptional (d,
|
|
417
|
+
export function installSaveOptional (d, dependencies, r, f) {
|
|
399
418
|
log('installSaveOptional')
|
|
400
419
|
|
|
420
|
+
const directory = normalize(d)
|
|
421
|
+
|
|
422
|
+
log(`Directory is "${directory}"`)
|
|
423
|
+
|
|
401
424
|
return (
|
|
402
425
|
new Promise((resolve, reject) => {
|
|
403
|
-
const
|
|
404
|
-
const commands = getCommands(D, getInstallSaveOptionalCommands(p, r, f))
|
|
426
|
+
const commands = getCommands(getInstallSaveOptionalCommands(dependencies, r, f))
|
|
405
427
|
|
|
406
428
|
const {
|
|
407
429
|
stdout,
|
|
408
430
|
stderr
|
|
409
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
431
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => {
|
|
410
432
|
(!e)
|
|
411
433
|
? resolve(v)
|
|
412
434
|
: reject(e)
|
|
@@ -425,25 +447,28 @@ export function installSaveOptional (d, p, r, f) {
|
|
|
425
447
|
*
|
|
426
448
|
* Spawn the `npm install --save-dev --save-exact` commands
|
|
427
449
|
*
|
|
428
|
-
* @param {
|
|
429
|
-
* @param {
|
|
430
|
-
* @param {
|
|
431
|
-
* @param {
|
|
450
|
+
* @param {string} d - Directory
|
|
451
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
452
|
+
* @param {string} r - Registry
|
|
453
|
+
* @param {boolean} f - Force
|
|
432
454
|
*
|
|
433
|
-
* @return {Promise}
|
|
455
|
+
* @return {Promise<string>}
|
|
434
456
|
*/
|
|
435
|
-
export function installSaveDevSaveExact (d,
|
|
457
|
+
export function installSaveDevSaveExact (d, deps, r, f) {
|
|
436
458
|
log('installSaveDevSaveExact')
|
|
437
459
|
|
|
460
|
+
const directory = normalize(d)
|
|
461
|
+
|
|
462
|
+
log(`Directory is "${directory}"`)
|
|
463
|
+
|
|
438
464
|
return (
|
|
439
465
|
new Promise((resolve, reject) => {
|
|
440
|
-
const
|
|
441
|
-
const commands = getCommands(D, getInstallSaveDevSaveExactCommands(p, r, f))
|
|
466
|
+
const commands = getCommands(getInstallSaveDevSaveExactCommands(deps, r, f))
|
|
442
467
|
|
|
443
468
|
const {
|
|
444
469
|
stdout,
|
|
445
470
|
stderr
|
|
446
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
471
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => {
|
|
447
472
|
(!e)
|
|
448
473
|
? resolve(v)
|
|
449
474
|
: reject(e)
|
|
@@ -462,25 +487,28 @@ export function installSaveDevSaveExact (d, p, r, f) {
|
|
|
462
487
|
*
|
|
463
488
|
* Spawn the `npm install --save-dev` commands
|
|
464
489
|
*
|
|
465
|
-
* @param {
|
|
466
|
-
* @param {
|
|
467
|
-
* @param {
|
|
468
|
-
* @param {
|
|
490
|
+
* @param {string} d - Directory
|
|
491
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
492
|
+
* @param {string} r - Registry
|
|
493
|
+
* @param {boolean} f - Force
|
|
469
494
|
*
|
|
470
|
-
* @return {Promise}
|
|
495
|
+
* @return {Promise<string>}
|
|
471
496
|
*/
|
|
472
|
-
export function installSaveDev (d,
|
|
497
|
+
export function installSaveDev (d, deps, r, f) {
|
|
473
498
|
log('installSaveDev')
|
|
474
499
|
|
|
500
|
+
const directory = normalize(d)
|
|
501
|
+
|
|
502
|
+
log(`Directory is "${directory}"`)
|
|
503
|
+
|
|
475
504
|
return (
|
|
476
505
|
new Promise((resolve, reject) => {
|
|
477
|
-
const
|
|
478
|
-
const commands = getCommands(D, getInstallSaveDevCommands(p, r, f))
|
|
506
|
+
const commands = getCommands(getInstallSaveDevCommands(deps, r, f))
|
|
479
507
|
|
|
480
508
|
const {
|
|
481
509
|
stdout,
|
|
482
510
|
stderr
|
|
483
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
511
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => {
|
|
484
512
|
(!e)
|
|
485
513
|
? resolve(v)
|
|
486
514
|
: reject(e)
|
|
@@ -499,25 +527,28 @@ export function installSaveDev (d, p, r, f) {
|
|
|
499
527
|
*
|
|
500
528
|
* Spawn the `npm install --save-prod --save-exact` commands
|
|
501
529
|
*
|
|
502
|
-
* @param {
|
|
503
|
-
* @param {
|
|
504
|
-
* @param {
|
|
505
|
-
* @param {
|
|
530
|
+
* @param {string} d - Directory
|
|
531
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
532
|
+
* @param {string} r - Registry
|
|
533
|
+
* @param {boolean} f - Force
|
|
506
534
|
*
|
|
507
|
-
* @return {Promise}
|
|
535
|
+
* @return {Promise<string>}
|
|
508
536
|
*/
|
|
509
|
-
export function installSaveProdSaveExact (d,
|
|
537
|
+
export function installSaveProdSaveExact (d, deps, r, f) {
|
|
510
538
|
log('installSaveProdSaveExact')
|
|
511
539
|
|
|
540
|
+
const directory = normalize(d)
|
|
541
|
+
|
|
542
|
+
log(`Directory is "${directory}"`)
|
|
543
|
+
|
|
512
544
|
return (
|
|
513
545
|
new Promise((resolve, reject) => {
|
|
514
|
-
const
|
|
515
|
-
const commands = getCommands(D, getInstallSaveProdSaveExactCommands(p, r, f))
|
|
546
|
+
const commands = getCommands(getInstallSaveProdSaveExactCommands(deps, r, f))
|
|
516
547
|
|
|
517
548
|
const {
|
|
518
549
|
stdout,
|
|
519
550
|
stderr
|
|
520
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
551
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => {
|
|
521
552
|
(!e)
|
|
522
553
|
? resolve(v)
|
|
523
554
|
: reject(e)
|
|
@@ -536,25 +567,28 @@ export function installSaveProdSaveExact (d, p, r, f) {
|
|
|
536
567
|
*
|
|
537
568
|
* Spawn the `npm install --save-prod` commands
|
|
538
569
|
*
|
|
539
|
-
* @param {
|
|
540
|
-
* @param {
|
|
541
|
-
* @param {
|
|
542
|
-
* @param {
|
|
570
|
+
* @param {string} d - Directory
|
|
571
|
+
* @param {DependencyDescriptor|DependencyDescriptor[]} deps - Dependency descriptor(s)
|
|
572
|
+
* @param {string} r - Registry
|
|
573
|
+
* @param {boolean} f - Force
|
|
543
574
|
*
|
|
544
|
-
* @return {Promise}
|
|
575
|
+
* @return {Promise<string>}
|
|
545
576
|
*/
|
|
546
|
-
export function installSaveProd (d,
|
|
577
|
+
export function installSaveProd (d, deps, r, f) {
|
|
547
578
|
log('installSaveProd')
|
|
548
579
|
|
|
580
|
+
const directory = normalize(d)
|
|
581
|
+
|
|
582
|
+
log(`Directory is "${directory}"`)
|
|
583
|
+
|
|
549
584
|
return (
|
|
550
585
|
new Promise((resolve, reject) => {
|
|
551
|
-
const
|
|
552
|
-
const commands = getCommands(D, getInstallSaveProdCommands(p, r, f))
|
|
586
|
+
const commands = getCommands(getInstallSaveProdCommands(deps, r, f))
|
|
553
587
|
|
|
554
588
|
const {
|
|
555
589
|
stdout,
|
|
556
590
|
stderr
|
|
557
|
-
} = exec(commands, { ...OPTIONS, cwd:
|
|
591
|
+
} = exec(commands, { ...OPTIONS, cwd: directory }, (e, v) => {
|
|
558
592
|
(!e)
|
|
559
593
|
? resolve(v)
|
|
560
594
|
: reject(e)
|
|
@@ -573,24 +607,24 @@ export function installSaveProd (d, p, r, f) {
|
|
|
573
607
|
*
|
|
574
608
|
* Execute the `npm install --save-bundle --save-exact` and `npm install --save-bundle` commands according to configuration and parameters
|
|
575
609
|
*
|
|
576
|
-
* @param {
|
|
577
|
-
* @param {
|
|
578
|
-
* @param {
|
|
579
|
-
* @param {
|
|
580
|
-
* @param {
|
|
610
|
+
* @param {string} d - Directory
|
|
611
|
+
* @param {Dependencies} packageDependencies - Package dependencies
|
|
612
|
+
* @param {Dependencies} configurationDependencies - Configuration dependencies
|
|
613
|
+
* @param {string} r - Registry
|
|
614
|
+
* @param {boolean} f - Force
|
|
581
615
|
*
|
|
582
|
-
* @return {Promise}
|
|
616
|
+
* @return {Promise<void>}
|
|
583
617
|
*/
|
|
584
|
-
export async function executeBundle (
|
|
618
|
+
export async function executeBundle (d = DIRECTORY, packageDependencies = {}, configurationDependencies = {}, r = REGISTRY, f = false) {
|
|
585
619
|
log('executeBundle')
|
|
586
620
|
|
|
587
|
-
const depsExact = getDepsExact(
|
|
621
|
+
const depsExact = getDepsExact(packageDependencies, configurationDependencies)
|
|
588
622
|
|
|
589
|
-
if (depsExact.length) await installSaveBundleSaveExact(
|
|
623
|
+
if (depsExact.length) await installSaveBundleSaveExact(d, depsExact, r, f)
|
|
590
624
|
|
|
591
|
-
const deps = getDeps(
|
|
625
|
+
const deps = getDeps(packageDependencies)
|
|
592
626
|
|
|
593
|
-
if (deps.length) await installSaveBundle(
|
|
627
|
+
if (deps.length) await installSaveBundle(d, deps, r, f)
|
|
594
628
|
}
|
|
595
629
|
|
|
596
630
|
/**
|
|
@@ -598,24 +632,24 @@ export async function executeBundle (directory = DIRECTORY, packages = {}, confi
|
|
|
598
632
|
*
|
|
599
633
|
* Execute the `npm install --save-optional --save-exact` and `npm install --save-optional` commands according to configuration and parameters
|
|
600
634
|
*
|
|
601
|
-
* @param {
|
|
602
|
-
* @param {
|
|
603
|
-
* @param {
|
|
604
|
-
* @param {
|
|
605
|
-
* @param {
|
|
635
|
+
* @param {string} d - Directory
|
|
636
|
+
* @param {Dependencies} packageDependencies - Package dependencies
|
|
637
|
+
* @param {Dependencies} configurationDependencies - Configuration dependencies
|
|
638
|
+
* @param {string} r - Registry
|
|
639
|
+
* @param {boolean} f - Force
|
|
606
640
|
*
|
|
607
|
-
* @return {Promise}
|
|
641
|
+
* @return {Promise<void>}
|
|
608
642
|
*/
|
|
609
|
-
export async function executeOptional (
|
|
643
|
+
export async function executeOptional (d = DIRECTORY, packageDependencies = {}, configurationDependencies = {}, r = REGISTRY, f = false) {
|
|
610
644
|
log('executeOptional')
|
|
611
645
|
|
|
612
|
-
const depsExact = getDepsExact(
|
|
646
|
+
const depsExact = getDepsExact(packageDependencies, configurationDependencies)
|
|
613
647
|
|
|
614
|
-
if (depsExact.length) await installSaveOptionalSaveExact(
|
|
648
|
+
if (depsExact.length) await installSaveOptionalSaveExact(d, depsExact, r, f)
|
|
615
649
|
|
|
616
|
-
const deps = getDeps(
|
|
650
|
+
const deps = getDeps(packageDependencies)
|
|
617
651
|
|
|
618
|
-
if (deps.length) await installSaveOptional(
|
|
652
|
+
if (deps.length) await installSaveOptional(d, deps, r, f)
|
|
619
653
|
}
|
|
620
654
|
|
|
621
655
|
/**
|
|
@@ -623,24 +657,24 @@ export async function executeOptional (directory = DIRECTORY, packages = {}, con
|
|
|
623
657
|
*
|
|
624
658
|
* Execute the `npm install --save-dev --save-exact` and `npm install --save-dev` commands according to configuration and parameters
|
|
625
659
|
*
|
|
626
|
-
* @param {
|
|
627
|
-
* @param {
|
|
628
|
-
* @param {
|
|
629
|
-
* @param {
|
|
630
|
-
* @param {
|
|
660
|
+
* @param {string} d - Directory
|
|
661
|
+
* @param {Dependencies} packageDependencies - Package dependencies
|
|
662
|
+
* @param {Dependencies} configurationDependencies - Configuration dependencies
|
|
663
|
+
* @param {string} r - Registry
|
|
664
|
+
* @param {boolean} f - Force
|
|
631
665
|
*
|
|
632
|
-
* @return {Promise}
|
|
666
|
+
* @return {Promise<void>}
|
|
633
667
|
*/
|
|
634
|
-
export async function executeDev (
|
|
668
|
+
export async function executeDev (d = DIRECTORY, packageDependencies = {}, configurationDependencies = {}, r = REGISTRY, f = false) {
|
|
635
669
|
log('executeDev')
|
|
636
670
|
|
|
637
|
-
const depsExact = getDepsExact(
|
|
671
|
+
const depsExact = getDepsExact(packageDependencies, configurationDependencies)
|
|
638
672
|
|
|
639
|
-
if (depsExact.length) await installSaveDevSaveExact(
|
|
673
|
+
if (depsExact.length) await installSaveDevSaveExact(d, depsExact, r, f)
|
|
640
674
|
|
|
641
|
-
const deps = getDeps(
|
|
675
|
+
const deps = getDeps(packageDependencies)
|
|
642
676
|
|
|
643
|
-
if (deps.length) await installSaveDev(
|
|
677
|
+
if (deps.length) await installSaveDev(d, deps, r, f)
|
|
644
678
|
}
|
|
645
679
|
|
|
646
680
|
/**
|
|
@@ -648,22 +682,22 @@ export async function executeDev (directory = DIRECTORY, packages = {}, configur
|
|
|
648
682
|
*
|
|
649
683
|
* Execute the `npm install --save-prod --save-exact` and `npm install --save-prod` commands according to configuration and parameters
|
|
650
684
|
*
|
|
651
|
-
* @param {
|
|
652
|
-
* @param {
|
|
653
|
-
* @param {
|
|
654
|
-
* @param {
|
|
655
|
-
* @param {
|
|
685
|
+
* @param {string} d - Directory
|
|
686
|
+
* @param {Dependencies} packageDependencies - Package dependencies
|
|
687
|
+
* @param {Dependencies} configurationDependencies - Configuration dependencies
|
|
688
|
+
* @param {string} r - Registry
|
|
689
|
+
* @param {boolean} f - Force
|
|
656
690
|
*
|
|
657
|
-
* @return {Promise}
|
|
691
|
+
* @return {Promise<void>}
|
|
658
692
|
*/
|
|
659
|
-
export async function executeProd (
|
|
693
|
+
export async function executeProd (d = DIRECTORY, packageDependencies = {}, configurationDependencies = {}, r = REGISTRY, f = false) {
|
|
660
694
|
log('executeProd')
|
|
661
695
|
|
|
662
|
-
const depsExact = getDepsExact(
|
|
696
|
+
const depsExact = getDepsExact(packageDependencies, configurationDependencies)
|
|
663
697
|
|
|
664
|
-
if (depsExact.length) await installSaveProdSaveExact(
|
|
698
|
+
if (depsExact.length) await installSaveProdSaveExact(d, depsExact, r, f)
|
|
665
699
|
|
|
666
|
-
const deps = getDeps(
|
|
700
|
+
const deps = getDeps(packageDependencies)
|
|
667
701
|
|
|
668
|
-
if (deps.length) await installSaveProd(
|
|
702
|
+
if (deps.length) await installSaveProd(d, deps, r, f)
|
|
669
703
|
}
|