@modernpoacher/deps 1.4.12 → 1.4.16
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/app.js +10 -7
- package/bin/common/index.js +14 -9
- package/bin/execute/app.js +21 -18
- package/bin/install/app.js +10 -7
- package/lib/common/git/index.js +2 -2
- package/lib/common/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/install/index.js +1 -1
- package/package.json +15 -15
- package/src/common/git/index.js +21 -7
- package/src/common/index.js +12 -0
- package/src/index.js +77 -86
- package/src/install/index.js +16 -17
- package/test/index.spec.js +288 -0
- package/test/install/index.spec.js +154 -0
package/src/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
DIRECTORY,
|
|
13
13
|
REGISTRY,
|
|
14
14
|
getRegistryParameter,
|
|
15
|
+
getForceParameter,
|
|
15
16
|
getSaveExactParameter,
|
|
16
17
|
getSaveBundleParameter,
|
|
17
18
|
getSaveOptionalParameter,
|
|
@@ -34,19 +35,18 @@ log(`\`deps\` (${platform}) is awake`)
|
|
|
34
35
|
* Get the `npm install --save-exact` commands as a string of parameters and arguments
|
|
35
36
|
*
|
|
36
37
|
* @param {Object} p - Packages
|
|
37
|
-
* @param {Object} c - Configuration
|
|
38
38
|
* @param {String} r - Registry
|
|
39
|
-
* @param {Boolean}
|
|
39
|
+
* @param {Boolean} f - Force
|
|
40
40
|
*
|
|
41
41
|
* @return {Array}
|
|
42
42
|
*/
|
|
43
|
-
export const getInstallSaveExactCommands = (p,
|
|
43
|
+
export const getInstallSaveExactCommands = (p, r, f) => {
|
|
44
44
|
log('getInstallSaveExactCommands')
|
|
45
45
|
|
|
46
|
-
const commands = `npm i ${transform(p
|
|
46
|
+
const commands = `npm i ${transform(p)}`
|
|
47
47
|
|
|
48
48
|
return normalise(
|
|
49
|
-
getRegistryParameter(r, getSaveExactParameter(commands))
|
|
49
|
+
getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands)))
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -56,19 +56,18 @@ export const getInstallSaveExactCommands = (p, c, r) => {
|
|
|
56
56
|
* Get the `npm install` commands as a string of parameters and arguments
|
|
57
57
|
*
|
|
58
58
|
* @param {Object} p - Packages
|
|
59
|
-
* @param {Object} c - Configuration
|
|
60
59
|
* @param {String} r - Registry
|
|
61
|
-
* @param {Boolean}
|
|
60
|
+
* @param {Boolean} f - Force
|
|
62
61
|
*
|
|
63
62
|
* @return {Array}
|
|
64
63
|
*/
|
|
65
|
-
export const getInstallCommands = (p,
|
|
64
|
+
export const getInstallCommands = (p, r, f) => {
|
|
66
65
|
log('getInstallCommands')
|
|
67
66
|
|
|
68
|
-
const commands = `npm i ${transform(p
|
|
67
|
+
const commands = `npm i ${transform(p)}`
|
|
69
68
|
|
|
70
69
|
return normalise(
|
|
71
|
-
getRegistryParameter(r, commands)
|
|
70
|
+
getRegistryParameter(r, getForceParameter(f, commands))
|
|
72
71
|
)
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -78,16 +77,15 @@ export const getInstallCommands = (p, c, r) => {
|
|
|
78
77
|
* Get the `npm install --save-bundle --save-exact` commands as a string of parameters and arguments
|
|
79
78
|
*
|
|
80
79
|
* @param {Object} p - Packages
|
|
81
|
-
* @param {Object} c - Configuration
|
|
82
80
|
* @param {String} r - Registry
|
|
83
|
-
* @param {Boolean}
|
|
81
|
+
* @param {Boolean} f - Force
|
|
84
82
|
*
|
|
85
83
|
* @return {Array}
|
|
86
84
|
*/
|
|
87
|
-
export function getInstallSaveBundleSaveExactCommands (p,
|
|
85
|
+
export function getInstallSaveBundleSaveExactCommands (p, r, f) {
|
|
88
86
|
log('getInstallSaveBundleSaveExactCommands')
|
|
89
87
|
|
|
90
|
-
const commands = getInstallSaveExactCommands(p,
|
|
88
|
+
const commands = getInstallSaveExactCommands(p, r, f)
|
|
91
89
|
|
|
92
90
|
return normalise(
|
|
93
91
|
getSaveBundleParameter(commands)
|
|
@@ -100,16 +98,15 @@ export function getInstallSaveBundleSaveExactCommands (p, c, r) {
|
|
|
100
98
|
* Get the `npm install --save-bundle` commands as a string of parameters and arguments
|
|
101
99
|
*
|
|
102
100
|
* @param {Object} p - Packages
|
|
103
|
-
* @param {Object} c - Configuration
|
|
104
101
|
* @param {String} r - Registry
|
|
105
|
-
* @param {Boolean}
|
|
102
|
+
* @param {Boolean} f - Force
|
|
106
103
|
*
|
|
107
104
|
* @return {Array}
|
|
108
105
|
*/
|
|
109
|
-
export function getInstallSaveBundleCommands (p,
|
|
106
|
+
export function getInstallSaveBundleCommands (p, r, f) {
|
|
110
107
|
log('getInstallSaveBundleCommands')
|
|
111
108
|
|
|
112
|
-
const commands = getInstallCommands(p,
|
|
109
|
+
const commands = getInstallCommands(p, r, f)
|
|
113
110
|
|
|
114
111
|
return normalise(
|
|
115
112
|
getSaveBundleParameter(commands)
|
|
@@ -122,16 +119,15 @@ export function getInstallSaveBundleCommands (p, c, r) {
|
|
|
122
119
|
* Get the `npm install --save-optional --save-exact` commands as a string of parameters and arguments
|
|
123
120
|
*
|
|
124
121
|
* @param {Object} p - Packages
|
|
125
|
-
* @param {Object} c - Configuration
|
|
126
122
|
* @param {String} r - Registry
|
|
127
|
-
* @param {Boolean}
|
|
123
|
+
* @param {Boolean} f - Force
|
|
128
124
|
*
|
|
129
125
|
* @return {Array}
|
|
130
126
|
*/
|
|
131
|
-
export function getInstallSaveOptionalSaveExactCommands (p,
|
|
127
|
+
export function getInstallSaveOptionalSaveExactCommands (p, r, f) {
|
|
132
128
|
log('getInstallSaveOptionalSaveExactCommands')
|
|
133
129
|
|
|
134
|
-
const commands = getInstallSaveExactCommands(p,
|
|
130
|
+
const commands = getInstallSaveExactCommands(p, r, f)
|
|
135
131
|
|
|
136
132
|
return normalise(
|
|
137
133
|
getSaveOptionalParameter(commands)
|
|
@@ -144,16 +140,15 @@ export function getInstallSaveOptionalSaveExactCommands (p, c, r) {
|
|
|
144
140
|
* Get the `npm install --save-optional` commands as a string of parameters and arguments
|
|
145
141
|
*
|
|
146
142
|
* @param {Object} p - Packages
|
|
147
|
-
* @param {Object} c - Configuration
|
|
148
143
|
* @param {String} r - Registry
|
|
149
|
-
* @param {Boolean}
|
|
144
|
+
* @param {Boolean} f - Force
|
|
150
145
|
*
|
|
151
146
|
* @return {Array}
|
|
152
147
|
*/
|
|
153
|
-
export function getInstallSaveOptionalCommands (p,
|
|
148
|
+
export function getInstallSaveOptionalCommands (p, r, f) {
|
|
154
149
|
log('getInstallSaveOptionalCommands')
|
|
155
150
|
|
|
156
|
-
const commands = getInstallCommands(p,
|
|
151
|
+
const commands = getInstallCommands(p, r, f)
|
|
157
152
|
|
|
158
153
|
return normalise(
|
|
159
154
|
getSaveOptionalParameter(commands)
|
|
@@ -166,16 +161,15 @@ export function getInstallSaveOptionalCommands (p, c, r) {
|
|
|
166
161
|
* Get the `npm install --save-dev --save-exact` commands as a string of parameters and arguments
|
|
167
162
|
*
|
|
168
163
|
* @param {Object} p - Packages
|
|
169
|
-
* @param {Object} c - Configuration
|
|
170
164
|
* @param {String} r - Registry
|
|
171
|
-
* @param {Boolean}
|
|
165
|
+
* @param {Boolean} f - Force
|
|
172
166
|
*
|
|
173
167
|
* @return {Array}
|
|
174
168
|
*/
|
|
175
|
-
export function getInstallSaveDevSaveExactCommands (p,
|
|
169
|
+
export function getInstallSaveDevSaveExactCommands (p, r, f) {
|
|
176
170
|
log('getInstallSaveDevSaveExactCommands')
|
|
177
171
|
|
|
178
|
-
const commands = getInstallSaveExactCommands(p,
|
|
172
|
+
const commands = getInstallSaveExactCommands(p, r, f)
|
|
179
173
|
|
|
180
174
|
return normalise(
|
|
181
175
|
getSaveDevParameter(commands)
|
|
@@ -188,16 +182,15 @@ export function getInstallSaveDevSaveExactCommands (p, c, r) {
|
|
|
188
182
|
* Get the `npm install --save-dev` commands as a string of parameters and arguments
|
|
189
183
|
*
|
|
190
184
|
* @param {Object} p - Packages
|
|
191
|
-
* @param {Object} c - Configuration
|
|
192
185
|
* @param {String} r - Registry
|
|
193
|
-
* @param {Boolean}
|
|
186
|
+
* @param {Boolean} f - Force
|
|
194
187
|
*
|
|
195
188
|
* @return {Array}
|
|
196
189
|
*/
|
|
197
|
-
export function getInstallSaveDevCommands (p,
|
|
190
|
+
export function getInstallSaveDevCommands (p, r, f) {
|
|
198
191
|
log('getInstallSaveDevCommands')
|
|
199
192
|
|
|
200
|
-
const commands = getInstallCommands(p,
|
|
193
|
+
const commands = getInstallCommands(p, r, f)
|
|
201
194
|
|
|
202
195
|
return normalise(
|
|
203
196
|
getSaveDevParameter(commands)
|
|
@@ -210,16 +203,15 @@ export function getInstallSaveDevCommands (p, c, r) {
|
|
|
210
203
|
* Get the `npm install --save-prod --save-exact` commands as a string of parameters and arguments
|
|
211
204
|
*
|
|
212
205
|
* @param {Object} p - Packages
|
|
213
|
-
* @param {Object} c - Configuration
|
|
214
206
|
* @param {String} r - Registry
|
|
215
|
-
* @param {Boolean}
|
|
207
|
+
* @param {Boolean} f - Force
|
|
216
208
|
*
|
|
217
209
|
* @return {Array}
|
|
218
210
|
*/
|
|
219
|
-
export function getInstallSaveProdSaveExactCommands (p,
|
|
211
|
+
export function getInstallSaveProdSaveExactCommands (p, r, f) {
|
|
220
212
|
log('getInstallSaveProdSaveExactCommands')
|
|
221
213
|
|
|
222
|
-
const commands = getInstallSaveExactCommands(p,
|
|
214
|
+
const commands = getInstallSaveExactCommands(p, r, f)
|
|
223
215
|
|
|
224
216
|
return normalise(
|
|
225
217
|
getSaveProdParameter(commands)
|
|
@@ -232,16 +224,15 @@ export function getInstallSaveProdSaveExactCommands (p, c, r) {
|
|
|
232
224
|
* Get the `npm install --save-prod` commands as a string of parameters and arguments
|
|
233
225
|
*
|
|
234
226
|
* @param {Object} p - Packages
|
|
235
|
-
* @param {Object} c - Configuration
|
|
236
227
|
* @param {String} r - Registry
|
|
237
|
-
* @param {Boolean}
|
|
228
|
+
* @param {Boolean} f - Force
|
|
238
229
|
*
|
|
239
230
|
* @return {Array}
|
|
240
231
|
*/
|
|
241
|
-
export function getInstallSaveProdCommands (p,
|
|
232
|
+
export function getInstallSaveProdCommands (p, r, f) {
|
|
242
233
|
log('getInstallSaveProdCommands')
|
|
243
234
|
|
|
244
|
-
const commands = getInstallCommands(p,
|
|
235
|
+
const commands = getInstallCommands(p, r, f)
|
|
245
236
|
|
|
246
237
|
return normalise(
|
|
247
238
|
getSaveProdParameter(commands)
|
|
@@ -255,17 +246,17 @@ export function getInstallSaveProdCommands (p, c, r) {
|
|
|
255
246
|
*
|
|
256
247
|
* @param {String} d - Directory
|
|
257
248
|
* @param {Object} p - Packages
|
|
258
|
-
* @param {Object} c - Configuration
|
|
259
249
|
* @param {String} r - Registry
|
|
250
|
+
* @param {Boolean} f - Force
|
|
260
251
|
*
|
|
261
252
|
* @return {Promise}
|
|
262
253
|
*/
|
|
263
|
-
export function installSaveBundleSaveExact (d, p,
|
|
254
|
+
export function installSaveBundleSaveExact (d, p, r, f) {
|
|
264
255
|
log('installSaveBundleSaveExact')
|
|
265
256
|
|
|
266
257
|
return (
|
|
267
258
|
new Promise((resolve, reject) => {
|
|
268
|
-
const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p,
|
|
259
|
+
const commands = getCommands(d, getInstallSaveBundleSaveExactCommands(p, r, f))
|
|
269
260
|
|
|
270
261
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
271
262
|
.on('close', resolve)
|
|
@@ -281,17 +272,17 @@ export function installSaveBundleSaveExact (d, p, c, r) {
|
|
|
281
272
|
*
|
|
282
273
|
* @param {String} d - Directory
|
|
283
274
|
* @param {Object} p - Packages
|
|
284
|
-
* @param {Object} c - Configuration
|
|
285
275
|
* @param {String} r - Registry
|
|
276
|
+
* @param {Boolean} f - Force
|
|
286
277
|
*
|
|
287
278
|
* @return {Promise}
|
|
288
279
|
*/
|
|
289
|
-
export function installSaveBundle (d, p,
|
|
280
|
+
export function installSaveBundle (d, p, r, f) {
|
|
290
281
|
log('installSaveBundle')
|
|
291
282
|
|
|
292
283
|
return (
|
|
293
284
|
new Promise((resolve, reject) => {
|
|
294
|
-
const commands = getCommands(d, getInstallSaveBundleCommands(p,
|
|
285
|
+
const commands = getCommands(d, getInstallSaveBundleCommands(p, r, f))
|
|
295
286
|
|
|
296
287
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
297
288
|
.on('close', resolve)
|
|
@@ -307,17 +298,17 @@ export function installSaveBundle (d, p, c, r) {
|
|
|
307
298
|
*
|
|
308
299
|
* @param {String} d - Directory
|
|
309
300
|
* @param {Object} p - Packages
|
|
310
|
-
* @param {Object} c - Configuration
|
|
311
301
|
* @param {String} r - Registry
|
|
302
|
+
* @param {Boolean} f - Force
|
|
312
303
|
*
|
|
313
304
|
* @return {Promise}
|
|
314
305
|
*/
|
|
315
|
-
export function installSaveOptionalSaveExact (d, p,
|
|
306
|
+
export function installSaveOptionalSaveExact (d, p, r, f) {
|
|
316
307
|
log('installSaveOptionalSaveExact')
|
|
317
308
|
|
|
318
309
|
return (
|
|
319
310
|
new Promise((resolve, reject) => {
|
|
320
|
-
const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p,
|
|
311
|
+
const commands = getCommands(d, getInstallSaveOptionalSaveExactCommands(p, r, f))
|
|
321
312
|
|
|
322
313
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
323
314
|
.on('close', resolve)
|
|
@@ -333,17 +324,17 @@ export function installSaveOptionalSaveExact (d, p, c, r) {
|
|
|
333
324
|
*
|
|
334
325
|
* @param {String} d - Directory
|
|
335
326
|
* @param {Object} p - Packages
|
|
336
|
-
* @param {Object} c - Configuration
|
|
337
327
|
* @param {String} r - Registry
|
|
328
|
+
* @param {Boolean} f - Force
|
|
338
329
|
*
|
|
339
330
|
* @return {Promise}
|
|
340
331
|
*/
|
|
341
|
-
export function installSaveOptional (d, p,
|
|
332
|
+
export function installSaveOptional (d, p, r, f) {
|
|
342
333
|
log('installSaveOptional')
|
|
343
334
|
|
|
344
335
|
return (
|
|
345
336
|
new Promise((resolve, reject) => {
|
|
346
|
-
const commands = getCommands(d, getInstallSaveOptionalCommands(p,
|
|
337
|
+
const commands = getCommands(d, getInstallSaveOptionalCommands(p, r, f))
|
|
347
338
|
|
|
348
339
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
349
340
|
.on('close', resolve)
|
|
@@ -359,17 +350,17 @@ export function installSaveOptional (d, p, c, r) {
|
|
|
359
350
|
*
|
|
360
351
|
* @param {String} d - Directory
|
|
361
352
|
* @param {Object} p - Packages
|
|
362
|
-
* @param {Object} c - Configuration
|
|
363
353
|
* @param {String} r - Registry
|
|
354
|
+
* @param {Boolean} f - Force
|
|
364
355
|
*
|
|
365
356
|
* @return {Promise}
|
|
366
357
|
*/
|
|
367
|
-
export function installSaveDevSaveExact (d, p,
|
|
358
|
+
export function installSaveDevSaveExact (d, p, r, f) {
|
|
368
359
|
log('installSaveDevSaveExact')
|
|
369
360
|
|
|
370
361
|
return (
|
|
371
362
|
new Promise((resolve, reject) => {
|
|
372
|
-
const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p,
|
|
363
|
+
const commands = getCommands(d, getInstallSaveDevSaveExactCommands(p, r, f))
|
|
373
364
|
|
|
374
365
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
375
366
|
.on('close', resolve)
|
|
@@ -385,17 +376,17 @@ export function installSaveDevSaveExact (d, p, c, r) {
|
|
|
385
376
|
*
|
|
386
377
|
* @param {String} d - Directory
|
|
387
378
|
* @param {Object} p - Packages
|
|
388
|
-
* @param {Object} c - Configuration
|
|
389
379
|
* @param {String} r - Registry
|
|
380
|
+
* @param {Boolean} f - Force
|
|
390
381
|
*
|
|
391
382
|
* @return {Promise}
|
|
392
383
|
*/
|
|
393
|
-
export function installSaveDev (d, p,
|
|
384
|
+
export function installSaveDev (d, p, r, f) {
|
|
394
385
|
log('installSaveDev')
|
|
395
386
|
|
|
396
387
|
return (
|
|
397
388
|
new Promise((resolve, reject) => {
|
|
398
|
-
const commands = getCommands(d, getInstallSaveDevCommands(p,
|
|
389
|
+
const commands = getCommands(d, getInstallSaveDevCommands(p, r, f))
|
|
399
390
|
|
|
400
391
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
401
392
|
.on('close', resolve)
|
|
@@ -411,17 +402,17 @@ export function installSaveDev (d, p, c, r) {
|
|
|
411
402
|
*
|
|
412
403
|
* @param {String} d - Directory
|
|
413
404
|
* @param {Object} p - Packages
|
|
414
|
-
* @param {Object} c - Configuration
|
|
415
405
|
* @param {String} r - Registry
|
|
406
|
+
* @param {Boolean} f - Force
|
|
416
407
|
*
|
|
417
408
|
* @return {Promise}
|
|
418
409
|
*/
|
|
419
|
-
export function installSaveProdSaveExact (d, p,
|
|
410
|
+
export function installSaveProdSaveExact (d, p, r, f) {
|
|
420
411
|
log('installSaveProdSaveExact')
|
|
421
412
|
|
|
422
413
|
return (
|
|
423
414
|
new Promise((resolve, reject) => {
|
|
424
|
-
const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p,
|
|
415
|
+
const commands = getCommands(d, getInstallSaveProdSaveExactCommands(p, r, f))
|
|
425
416
|
|
|
426
417
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
427
418
|
.on('close', resolve)
|
|
@@ -437,17 +428,17 @@ export function installSaveProdSaveExact (d, p, c, r) {
|
|
|
437
428
|
*
|
|
438
429
|
* @param {String} d - Directory
|
|
439
430
|
* @param {Object} p - Packages
|
|
440
|
-
* @param {Object} c - Configuration
|
|
441
431
|
* @param {String} r - Registry
|
|
432
|
+
* @param {Boolean} f - Force
|
|
442
433
|
*
|
|
443
434
|
* @return {Promise}
|
|
444
435
|
*/
|
|
445
|
-
export function installSaveProd (d, p,
|
|
436
|
+
export function installSaveProd (d, p, r, f) {
|
|
446
437
|
log('installSaveProd')
|
|
447
438
|
|
|
448
439
|
return (
|
|
449
440
|
new Promise((resolve, reject) => {
|
|
450
|
-
const commands = getCommands(d, getInstallSaveProdCommands(p,
|
|
441
|
+
const commands = getCommands(d, getInstallSaveProdCommands(p, r, f))
|
|
451
442
|
|
|
452
443
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
453
444
|
.on('close', resolve)
|
|
@@ -464,21 +455,21 @@ export function installSaveProd (d, p, c, r) {
|
|
|
464
455
|
* @param {String} d - Directory
|
|
465
456
|
* @param {Object} p - Packages
|
|
466
457
|
* @param {Object} c - Configuration
|
|
467
|
-
* @param {Boolean} s - Save
|
|
468
458
|
* @param {String} r - Registry
|
|
459
|
+
* @param {Boolean} f - Force
|
|
469
460
|
*
|
|
470
461
|
* @return {Promise}
|
|
471
462
|
*/
|
|
472
|
-
export async function executeBundle (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY) {
|
|
463
|
+
export async function executeBundle (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
473
464
|
log('executeBundle')
|
|
474
465
|
|
|
475
|
-
const
|
|
466
|
+
const depsExact = getDepsExact(packages, configuration)
|
|
476
467
|
|
|
477
|
-
if (
|
|
468
|
+
if (depsExact.length) await installSaveBundleSaveExact(directory, depsExact, registry, force)
|
|
478
469
|
|
|
479
470
|
const deps = getDeps(packages)
|
|
480
471
|
|
|
481
|
-
if (deps.length) await installSaveBundle(directory, deps,
|
|
472
|
+
if (deps.length) await installSaveBundle(directory, deps, registry, force)
|
|
482
473
|
}
|
|
483
474
|
|
|
484
475
|
/**
|
|
@@ -489,21 +480,21 @@ export async function executeBundle (directory = DIRECTORY, packages = {}, confi
|
|
|
489
480
|
* @param {String} d - Directory
|
|
490
481
|
* @param {Object} p - Packages
|
|
491
482
|
* @param {Object} c - Configuration
|
|
492
|
-
* @param {Boolean} s - Save
|
|
493
483
|
* @param {String} r - Registry
|
|
484
|
+
* @param {Boolean} f - Force
|
|
494
485
|
*
|
|
495
486
|
* @return {Promise}
|
|
496
487
|
*/
|
|
497
|
-
export async function executeOptional (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY) {
|
|
488
|
+
export async function executeOptional (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
498
489
|
log('executeOptional')
|
|
499
490
|
|
|
500
|
-
const
|
|
491
|
+
const depsExact = getDepsExact(packages, configuration)
|
|
501
492
|
|
|
502
|
-
if (
|
|
493
|
+
if (depsExact.length) await installSaveOptionalSaveExact(directory, depsExact, registry)
|
|
503
494
|
|
|
504
495
|
const deps = getDeps(packages)
|
|
505
496
|
|
|
506
|
-
if (deps.length) await installSaveOptional(directory, deps,
|
|
497
|
+
if (deps.length) await installSaveOptional(directory, deps, registry)
|
|
507
498
|
}
|
|
508
499
|
|
|
509
500
|
/**
|
|
@@ -514,21 +505,21 @@ export async function executeOptional (directory = DIRECTORY, packages = {}, con
|
|
|
514
505
|
* @param {String} d - Directory
|
|
515
506
|
* @param {Object} p - Packages
|
|
516
507
|
* @param {Object} c - Configuration
|
|
517
|
-
* @param {Boolean} s - Save
|
|
518
508
|
* @param {String} r - Registry
|
|
509
|
+
* @param {Boolean} f - Force
|
|
519
510
|
*
|
|
520
511
|
* @return {Promise}
|
|
521
512
|
*/
|
|
522
|
-
export async function executeDev (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY) {
|
|
513
|
+
export async function executeDev (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
523
514
|
log('executeDev')
|
|
524
515
|
|
|
525
|
-
const
|
|
516
|
+
const depsExact = getDepsExact(packages, configuration)
|
|
526
517
|
|
|
527
|
-
if (
|
|
518
|
+
if (depsExact.length) await installSaveDevSaveExact(directory, depsExact, registry, force)
|
|
528
519
|
|
|
529
520
|
const deps = getDeps(packages)
|
|
530
521
|
|
|
531
|
-
if (deps.length) await installSaveDev(directory, deps,
|
|
522
|
+
if (deps.length) await installSaveDev(directory, deps, registry, force)
|
|
532
523
|
}
|
|
533
524
|
|
|
534
525
|
/**
|
|
@@ -539,19 +530,19 @@ export async function executeDev (directory = DIRECTORY, packages = {}, configur
|
|
|
539
530
|
* @param {String} d - Directory
|
|
540
531
|
* @param {Object} p - Packages
|
|
541
532
|
* @param {Object} c - Configuration
|
|
542
|
-
* @param {Boolean} s - Save
|
|
543
533
|
* @param {String} r - Registry
|
|
534
|
+
* @param {Boolean} f - Force
|
|
544
535
|
*
|
|
545
536
|
* @return {Promise}
|
|
546
537
|
*/
|
|
547
|
-
export async function executeProd (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY) {
|
|
538
|
+
export async function executeProd (directory = DIRECTORY, packages = {}, configuration = {}, registry = REGISTRY, force = false) {
|
|
548
539
|
log('executeProd')
|
|
549
540
|
|
|
550
|
-
const
|
|
541
|
+
const depsExact = getDepsExact(packages, configuration)
|
|
551
542
|
|
|
552
|
-
if (
|
|
543
|
+
if (depsExact.length) await installSaveProdSaveExact(directory, depsExact, registry, force)
|
|
553
544
|
|
|
554
545
|
const deps = getDeps(packages)
|
|
555
546
|
|
|
556
|
-
if (deps.length) await installSaveProd(directory, deps,
|
|
547
|
+
if (deps.length) await installSaveProd(directory, deps, registry, force)
|
|
557
548
|
}
|
package/src/install/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
REGISTRY,
|
|
14
14
|
getNoSaveParameter,
|
|
15
15
|
getRegistryParameter,
|
|
16
|
+
getForceParameter,
|
|
16
17
|
getSaveExactParameter,
|
|
17
18
|
getCommands,
|
|
18
19
|
normalise,
|
|
@@ -31,20 +32,19 @@ log(`\`install\` (${platform}) is awake`)
|
|
|
31
32
|
* Get the `install --save-exact` commands as a string of parameters and arguments
|
|
32
33
|
*
|
|
33
34
|
* @param {Object} p - Packages
|
|
34
|
-
* @param {Object} c - Configuration
|
|
35
35
|
* @param {Boolean} s - Save
|
|
36
36
|
* @param {String} r - Registry
|
|
37
|
-
* @param {Boolean}
|
|
37
|
+
* @param {Boolean} f - Force
|
|
38
38
|
*
|
|
39
39
|
* @return {Array}
|
|
40
40
|
*/
|
|
41
|
-
export const getInstallSaveExactCommands = (p,
|
|
41
|
+
export const getInstallSaveExactCommands = (p, s, r, f) => {
|
|
42
42
|
log('getInstallSaveExactCommands')
|
|
43
43
|
|
|
44
|
-
const commands = `npm i ${transform(p
|
|
44
|
+
const commands = `npm i ${transform(p)}`
|
|
45
45
|
|
|
46
46
|
return normalise(
|
|
47
|
-
getNoSaveParameter(s, getRegistryParameter(r, getSaveExactParameter(commands)))
|
|
47
|
+
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(commands))))
|
|
48
48
|
)
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -54,20 +54,19 @@ export const getInstallSaveExactCommands = (p, c, s, r) => {
|
|
|
54
54
|
* Get the `install` commands as a string of parameters and arguments
|
|
55
55
|
*
|
|
56
56
|
* @param {Object} p - Packages
|
|
57
|
-
* @param {Object} c - Configuration
|
|
58
57
|
* @param {Boolean} s - Save
|
|
59
58
|
* @param {String} r - Registry
|
|
60
|
-
* @param {Boolean}
|
|
59
|
+
* @param {Boolean} f - Force
|
|
61
60
|
*
|
|
62
61
|
* @return {Array}
|
|
63
62
|
*/
|
|
64
|
-
export const getInstallCommands = (p,
|
|
63
|
+
export const getInstallCommands = (p, s, r, f) => {
|
|
65
64
|
log('getInstallCommands')
|
|
66
65
|
|
|
67
|
-
const commands = `npm i ${transform(p
|
|
66
|
+
const commands = `npm i ${transform(p)}`
|
|
68
67
|
|
|
69
68
|
return normalise(
|
|
70
|
-
getNoSaveParameter(s, getRegistryParameter(r, commands))
|
|
69
|
+
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, commands)))
|
|
71
70
|
)
|
|
72
71
|
}
|
|
73
72
|
|
|
@@ -84,12 +83,12 @@ export const getInstallCommands = (p, c, s, r) => {
|
|
|
84
83
|
*
|
|
85
84
|
* @return {Promise}
|
|
86
85
|
*/
|
|
87
|
-
export function installSaveExact (d, p,
|
|
86
|
+
export function installSaveExact (d, p, s, r, f) {
|
|
88
87
|
log('installSaveExact')
|
|
89
88
|
|
|
90
89
|
return (
|
|
91
90
|
new Promise((resolve, reject) => {
|
|
92
|
-
const commands = getCommands(d, getInstallSaveExactCommands(p,
|
|
91
|
+
const commands = getCommands(d, getInstallSaveExactCommands(p, s, r, f))
|
|
93
92
|
|
|
94
93
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
95
94
|
.on('close', resolve)
|
|
@@ -111,12 +110,12 @@ export function installSaveExact (d, p, c, s, r) {
|
|
|
111
110
|
*
|
|
112
111
|
* @return {Promise}
|
|
113
112
|
*/
|
|
114
|
-
export function install (d, p,
|
|
113
|
+
export function install (d, p, s, r, f) {
|
|
115
114
|
log('install')
|
|
116
115
|
|
|
117
116
|
return (
|
|
118
117
|
new Promise((resolve, reject) => {
|
|
119
|
-
const commands = getCommands(d, getInstallCommands(p,
|
|
118
|
+
const commands = getCommands(d, getInstallCommands(p, s, r, f))
|
|
120
119
|
|
|
121
120
|
spawn('/bin/bash', ['-c', commands], { shell: true, stdio: 'inherit' }, (e) => (!e) ? resolve() : reject(e))
|
|
122
121
|
.on('close', resolve)
|
|
@@ -138,14 +137,14 @@ export function install (d, p, c, s, r) {
|
|
|
138
137
|
*
|
|
139
138
|
* @return {Promise}
|
|
140
139
|
*/
|
|
141
|
-
export async function execute (directory = DIRECTORY, packages = {}, configuration = {}, save = false, registry = REGISTRY) {
|
|
140
|
+
export async function execute (directory = DIRECTORY, packages = {}, configuration = {}, save = false, registry = REGISTRY, force = false) {
|
|
142
141
|
log('execute')
|
|
143
142
|
|
|
144
143
|
const depsExact = getDepsExact(packages, configuration)
|
|
145
144
|
|
|
146
|
-
if (depsExact.length) await installSaveExact(directory, depsExact,
|
|
145
|
+
if (depsExact.length) await installSaveExact(directory, depsExact, save, registry, force)
|
|
147
146
|
|
|
148
147
|
const deps = getDeps(packages)
|
|
149
148
|
|
|
150
|
-
if (deps.length) await install(directory, deps,
|
|
149
|
+
if (deps.length) await install(directory, deps, save, registry, force)
|
|
151
150
|
}
|