@modernpoacher/deps 2.2.17 → 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 +6 -22
- package/eslint.config.mjs +86 -0
- package/index.d.mts +50 -0
- package/package.json +12 -10
- package/src/common/env/index.mjs +1 -1
- package/src/common/git/index.mjs +98 -62
- package/src/common/index.mjs +50 -59
- 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
package/src/common/index.mjs
CHANGED
|
@@ -1,40 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @typedef {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A dependency descriptor
|
|
9
|
-
*
|
|
10
|
-
* @typedef {Object} DependencyDescriptor
|
|
11
|
-
* @property {string} name - Dependency name in NPM.
|
|
12
|
-
* @property {string} version - Dependency version or "latest".
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* A package
|
|
17
|
-
*
|
|
18
|
-
* @typedef {Object} Package
|
|
19
|
-
* @property {string|{name: string, email: string}} author
|
|
20
|
-
* @property {Dependencies} dependencies - Production dependencies.
|
|
21
|
-
* @property {Dependencies} devDependencies - Development dependencies.
|
|
22
|
-
* @property {Dependencies} optionalDependencies - Optional dependencies.
|
|
23
|
-
* @property {Dependencies} bundleDependencies - Bundle dependencies.
|
|
24
|
-
* @property {Dependencies} peerDependencies - Peer dependencies
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* A configuration
|
|
29
|
-
*
|
|
30
|
-
* @typedef {Object} Configuration
|
|
31
|
-
* @property {string|{name: string, email: string}} author
|
|
32
|
-
* @property {boolean} ignore
|
|
33
|
-
* @property {Dependencies} dependencies - Production dependencies.
|
|
34
|
-
* @property {Dependencies} devDependencies - Development dependencies.
|
|
35
|
-
* @property {Dependencies} optionalDependencies - Optional dependencies.
|
|
36
|
-
* @property {Dependencies} bundleDependencies - Bundle dependencies.
|
|
37
|
-
* @property {Dependencies} peerDependencies - Peer dependencies
|
|
2
|
+
* @typedef {DepsTypes.Dependencies} Dependencies
|
|
3
|
+
* @typedef {DepsTypes.DependencyDescriptor} DependencyDescriptor
|
|
4
|
+
* @typedef {DepsTypes.Package} Package
|
|
5
|
+
* @typedef {DepsTypes.Configuration} Configuration
|
|
38
6
|
*/
|
|
39
7
|
|
|
40
8
|
import debug from 'debug'
|
|
@@ -62,8 +30,16 @@ const log = debug('@modernpoacher/deps')
|
|
|
62
30
|
|
|
63
31
|
log(`\`common\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
64
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @param {string} v
|
|
35
|
+
* @returns {string}
|
|
36
|
+
*/
|
|
65
37
|
export const tidy = (v) => v.replace(/\n{2,}}/gm, String.fromCharCode(10)).trim()
|
|
66
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} v
|
|
41
|
+
* @returns {string}
|
|
42
|
+
*/
|
|
67
43
|
export const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
|
|
68
44
|
|
|
69
45
|
/**
|
|
@@ -71,7 +47,7 @@ export const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd
|
|
|
71
47
|
*
|
|
72
48
|
* Get the `--save-prod` parameter
|
|
73
49
|
*
|
|
74
|
-
* @param {string}
|
|
50
|
+
* @param {string} commands commands string
|
|
75
51
|
* @returns {string}
|
|
76
52
|
*/
|
|
77
53
|
export const getSaveProdParameter = (commands) => commands.concat(' --save-prod')
|
|
@@ -81,7 +57,7 @@ export const getSaveProdParameter = (commands) => commands.concat(' --save-prod'
|
|
|
81
57
|
*
|
|
82
58
|
* Get the `--save-dev` parameter
|
|
83
59
|
*
|
|
84
|
-
* @param {string}
|
|
60
|
+
* @param {string} commands commands string
|
|
85
61
|
* @returns {string}
|
|
86
62
|
*/
|
|
87
63
|
export const getSaveDevParameter = (commands) => commands.concat(' --save-dev')
|
|
@@ -192,7 +168,7 @@ export const getCommands = PLATFORM === 'win32'
|
|
|
192
168
|
*
|
|
193
169
|
* Get the production dependencies by destructuring the package or configuration
|
|
194
170
|
*
|
|
195
|
-
* @param {Package|Configuration}
|
|
171
|
+
* @param {Package | Configuration} deps
|
|
196
172
|
* @returns {Dependencies}
|
|
197
173
|
*/
|
|
198
174
|
export const getProdDependencies = ({ dependencies = {} } = {}) => dependencies
|
|
@@ -202,7 +178,7 @@ export const getProdDependencies = ({ dependencies = {} } = {}) => dependencies
|
|
|
202
178
|
*
|
|
203
179
|
* Get the development dependencies by destructuring the package or configuration
|
|
204
180
|
*
|
|
205
|
-
* @param {Package|Configuration}
|
|
181
|
+
* @param {Package | Configuration} deps
|
|
206
182
|
* @returns {Dependencies}
|
|
207
183
|
*/
|
|
208
184
|
export const getDevDependencies = ({ devDependencies = {} } = {}) => devDependencies
|
|
@@ -212,7 +188,7 @@ export const getDevDependencies = ({ devDependencies = {} } = {}) => devDependen
|
|
|
212
188
|
*
|
|
213
189
|
* Get the optional dependencies by destructuring the package or configuration
|
|
214
190
|
*
|
|
215
|
-
* @param {Package|Configuration}
|
|
191
|
+
* @param {Package | Configuration} deps
|
|
216
192
|
* @returns {Dependencies}
|
|
217
193
|
*/
|
|
218
194
|
export const getOptionalDependencies = ({ optionalDependencies = {} } = {}) => optionalDependencies
|
|
@@ -222,7 +198,7 @@ export const getOptionalDependencies = ({ optionalDependencies = {} } = {}) => o
|
|
|
222
198
|
*
|
|
223
199
|
* Get the bundle dependencies by destructuring the package or configuration
|
|
224
200
|
*
|
|
225
|
-
* @param {Package|Configuration}
|
|
201
|
+
* @param {Package | Configuration} deps
|
|
226
202
|
* @returns {Dependencies}
|
|
227
203
|
*/
|
|
228
204
|
export const getBundleDependencies = ({ bundleDependencies = {} } = {}) => bundleDependencies
|
|
@@ -232,17 +208,17 @@ export const getBundleDependencies = ({ bundleDependencies = {} } = {}) => bundl
|
|
|
232
208
|
*
|
|
233
209
|
* Get the peer dependencies by destructuring the package or configuration
|
|
234
210
|
*
|
|
235
|
-
* @param {Package|Configuration}
|
|
211
|
+
* @param {Package | Configuration} deps
|
|
236
212
|
* @returns {Dependencies}
|
|
237
213
|
*/
|
|
238
|
-
export const getPeerDependencies = ({ peerDependencies } = {}) => peerDependencies
|
|
214
|
+
export const getPeerDependencies = ({ peerDependencies = {} } = {}) => peerDependencies
|
|
239
215
|
|
|
240
216
|
/**
|
|
241
217
|
* @function getIgnore
|
|
242
218
|
*
|
|
243
219
|
* Get the ignore flag by destructuring the configuration
|
|
244
220
|
*
|
|
245
|
-
* @param {Configuration}
|
|
221
|
+
* @param {Configuration} deps
|
|
246
222
|
* @returns {boolean}
|
|
247
223
|
*/
|
|
248
224
|
export const getIgnore = ({ ignore = false } = {}) => ignore === true
|
|
@@ -252,11 +228,12 @@ export const getIgnore = ({ ignore = false } = {}) => ignore === true
|
|
|
252
228
|
*
|
|
253
229
|
* Get the author by destructuring the package or configuration
|
|
254
230
|
*
|
|
255
|
-
* @param {Package|Configuration}
|
|
256
|
-
* @returns {string|null}
|
|
231
|
+
* @param {Package | Configuration} deps
|
|
232
|
+
* @returns {string | null}
|
|
257
233
|
*/
|
|
258
234
|
export const getAuthor = ({ author = '' } = {}) => {
|
|
259
|
-
if (
|
|
235
|
+
if (typeof author === 'string') return author
|
|
236
|
+
if (typeof (author || false) === 'object') {
|
|
260
237
|
const {
|
|
261
238
|
name: NAME = '',
|
|
262
239
|
email: EMAIL = ''
|
|
@@ -272,7 +249,7 @@ export const getAuthor = ({ author = '' } = {}) => {
|
|
|
272
249
|
)
|
|
273
250
|
}
|
|
274
251
|
|
|
275
|
-
return
|
|
252
|
+
return null
|
|
276
253
|
}
|
|
277
254
|
|
|
278
255
|
/**
|
|
@@ -280,8 +257,8 @@ export const getAuthor = ({ author = '' } = {}) => {
|
|
|
280
257
|
*
|
|
281
258
|
* Get the message by destructuring the configuration
|
|
282
259
|
*
|
|
283
|
-
* @param {Configuration}
|
|
284
|
-
* @returns {string|null}
|
|
260
|
+
* @param {Configuration} deps
|
|
261
|
+
* @returns {string | null}
|
|
285
262
|
*/
|
|
286
263
|
export const getMessage = ({ message = '' } = {}) => message || null
|
|
287
264
|
|
|
@@ -322,6 +299,16 @@ function excludeVersionIsExact ([name, version]) {
|
|
|
322
299
|
}
|
|
323
300
|
|
|
324
301
|
/**
|
|
302
|
+
* @function getMapToDepsExactVersionFromConfiguration
|
|
303
|
+
*
|
|
304
|
+
* Produces an array of objects from the entries of `packageDependencies` which have
|
|
305
|
+
* exact versions
|
|
306
|
+
*
|
|
307
|
+
* Entries have already been filtered to exclude non-exact versions
|
|
308
|
+
*
|
|
309
|
+
* Each entry is mapped to the same package name in `configurationDependencies` if it
|
|
310
|
+
* appears there. Otherwise, the `packageDependencies` version is used
|
|
311
|
+
*
|
|
325
312
|
* @param {Record<string, string>} configurationDependencies
|
|
326
313
|
* @returns {(entry: [name: string, version: string]) => {
|
|
327
314
|
* name: string,
|
|
@@ -330,10 +317,6 @@ function excludeVersionIsExact ([name, version]) {
|
|
|
330
317
|
*/
|
|
331
318
|
function getMapToDepsExactVersionFromConfiguration (configurationDependencies) {
|
|
332
319
|
/**
|
|
333
|
-
* We are producing an array of objects from the entries of the `packageDependencies`
|
|
334
|
-
*
|
|
335
|
-
* Each object in the array represents an entry (key and value) from `packageDependencies`
|
|
336
|
-
*
|
|
337
320
|
* @param {[name: string, version: string]} entry
|
|
338
321
|
* @returns {{
|
|
339
322
|
* name: string,
|
|
@@ -358,6 +341,14 @@ function getMapToDepsExactVersionFromConfiguration (configurationDependencies) {
|
|
|
358
341
|
}
|
|
359
342
|
|
|
360
343
|
/**
|
|
344
|
+
* @function mapToDepsVersion
|
|
345
|
+
*
|
|
346
|
+
* Produces an array of objects from the entries of `packageDependencies` which do not have
|
|
347
|
+
* exact versions
|
|
348
|
+
*
|
|
349
|
+
* Where the version is a pre-release, that version is used. Otherwise the version is
|
|
350
|
+
* set to `latest` to ensure that package is updated
|
|
351
|
+
*
|
|
361
352
|
* @param {[name: string, version: string]} entry
|
|
362
353
|
* @returns {{
|
|
363
354
|
* name: string,
|
|
@@ -425,13 +416,13 @@ export function getDeps (packageDependencies) {
|
|
|
425
416
|
*
|
|
426
417
|
* Normalise the commands string
|
|
427
418
|
*
|
|
428
|
-
* @param {string}
|
|
419
|
+
* @param {string} commands
|
|
429
420
|
* @returns {string}
|
|
430
421
|
*/
|
|
431
422
|
export function normalizeCommands (commands) {
|
|
432
423
|
const s = String.fromCharCode(32)
|
|
433
424
|
|
|
434
|
-
while (/\s{2,}
|
|
425
|
+
while (/\s{2,} | \n+/.test(commands)) {
|
|
435
426
|
commands = commands.replace(/\s{2,}/gm, s).replace(/\n+/gm, s)
|
|
436
427
|
}
|
|
437
428
|
|
|
@@ -445,7 +436,7 @@ export function normalizeCommands (commands) {
|
|
|
445
436
|
*
|
|
446
437
|
* Transform by destructuring the value
|
|
447
438
|
*
|
|
448
|
-
* @param {DependencyDescriptor}
|
|
439
|
+
* @param {DependencyDescriptor | { name?: string, version?: string }} dependencyDescriptor
|
|
449
440
|
* @returns {string}
|
|
450
441
|
*/
|
|
451
442
|
export const transformDependency = ({ name = '@modernpoacher/deps', version = 'latest' } = {}) => `${name}@${version}`
|
|
@@ -455,7 +446,7 @@ export const transformDependency = ({ name = '@modernpoacher/deps', version = 'l
|
|
|
455
446
|
*
|
|
456
447
|
* Transform the parameter to a string
|
|
457
448
|
*
|
|
458
|
-
* @param {DependencyDescriptor|DependencyDescriptor[]} value
|
|
449
|
+
* @param {DependencyDescriptor | DependencyDescriptor[]} value
|
|
459
450
|
* @returns {string}
|
|
460
451
|
*/
|
|
461
452
|
export function transform (value) {
|
|
@@ -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
|
}
|