@modernpoacher/deps 2.2.20 → 2.2.22
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 +66 -16
- package/package.json +6 -6
- package/src/common/git/index.mjs +1 -1
- package/src/common/index.mjs +2 -2
- package/src/index.mjs +27 -41
- package/src/install/index.mjs +6 -10
package/bin/common/index.mjs
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import('node:child_process').ExecException} ExecException
|
|
5
|
+
*/
|
|
6
|
+
|
|
3
7
|
/**
|
|
4
8
|
* @typedef {DepsTypes.Package} Package
|
|
5
9
|
* @typedef {DepsTypes.Configuration} Configuration
|
|
6
10
|
*/
|
|
7
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @callback HandleComplete
|
|
14
|
+
* @param {ExecException | null} e
|
|
15
|
+
* @param {string} v
|
|
16
|
+
* @returns {void}
|
|
17
|
+
*/
|
|
18
|
+
|
|
8
19
|
import stripAnsi from 'strip-ansi'
|
|
9
20
|
|
|
10
21
|
import {
|
|
@@ -65,17 +76,26 @@ const CODE = 0
|
|
|
65
76
|
|
|
66
77
|
const MESSAGE = 'Either no error message has been defined or no error has been supplied'
|
|
67
78
|
|
|
79
|
+
const LF = String.fromCodePoint(10)
|
|
80
|
+
const SP = String.fromCodePoint(32)
|
|
81
|
+
|
|
68
82
|
/**
|
|
69
83
|
* @param {string} v
|
|
70
84
|
* @returns {string}
|
|
71
85
|
*/
|
|
72
|
-
export const
|
|
86
|
+
export const trimEnd = (v) => v.trimEnd()
|
|
73
87
|
|
|
74
88
|
/**
|
|
75
89
|
* @param {string} v
|
|
76
90
|
* @returns {string}
|
|
77
91
|
*/
|
|
78
|
-
export const
|
|
92
|
+
export const tidy = (v) => v.replace(/\n{2,}}/gm, LF).trim()
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @param {string} v
|
|
96
|
+
* @returns {string}
|
|
97
|
+
*/
|
|
98
|
+
export const trim = (v) => v.split(LF).map(trimEnd).join(LF).trim()
|
|
79
99
|
|
|
80
100
|
const getRmrfCommands = PLATFORM === 'win32'
|
|
81
101
|
? () => tidy(`
|
|
@@ -128,8 +148,8 @@ function toSingle (v) {
|
|
|
128
148
|
}
|
|
129
149
|
|
|
130
150
|
export const ARGS = PLATFORM === 'win32'
|
|
131
|
-
? ARGV.map(toDouble).join(
|
|
132
|
-
: ARGV.map(toSingle).join(
|
|
151
|
+
? ARGV.map(toDouble).join(SP)
|
|
152
|
+
: ARGV.map(toSingle).join(SP)
|
|
133
153
|
|
|
134
154
|
/**
|
|
135
155
|
* @param {string} v
|
|
@@ -159,7 +179,7 @@ export function use (key) {
|
|
|
159
179
|
* @returns {void}
|
|
160
180
|
*/
|
|
161
181
|
return function use (value) {
|
|
162
|
-
value.split(
|
|
182
|
+
value.split(LF)
|
|
163
183
|
.filter(filter)
|
|
164
184
|
.forEach(write)
|
|
165
185
|
}
|
|
@@ -182,10 +202,10 @@ export function handleError (e = {}) {
|
|
|
182
202
|
}
|
|
183
203
|
|
|
184
204
|
/**
|
|
185
|
-
* @param {Error | null}
|
|
205
|
+
* @param {Error | null} e
|
|
186
206
|
* @returns {void}
|
|
187
207
|
*/
|
|
188
|
-
export function handleComplete (e
|
|
208
|
+
export function handleComplete (e) {
|
|
189
209
|
if (!e) return log('👍')
|
|
190
210
|
error('👎')
|
|
191
211
|
}
|
|
@@ -371,13 +391,23 @@ function rmrf (d = DIRECTORY) {
|
|
|
371
391
|
new Promise((resolve, reject) => {
|
|
372
392
|
const commands = getRmrfCommands()
|
|
373
393
|
const options = getOptions(directory)
|
|
394
|
+
/**
|
|
395
|
+
* @type {HandleComplete}
|
|
396
|
+
*/
|
|
397
|
+
function handleComplete (e, v) {
|
|
398
|
+
if (!e) {
|
|
399
|
+
resolve(v)
|
|
400
|
+
} else {
|
|
401
|
+
reject(e)
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
info(commands)
|
|
374
406
|
|
|
375
407
|
const {
|
|
376
408
|
stdout,
|
|
377
409
|
stderr
|
|
378
|
-
} = exec(commands, options,
|
|
379
|
-
return (!e) ? resolve(v) : reject(e)
|
|
380
|
-
})
|
|
410
|
+
} = exec(commands, options, handleComplete)
|
|
381
411
|
|
|
382
412
|
const log = use('rmrf')
|
|
383
413
|
|
|
@@ -402,13 +432,23 @@ function npmi (d = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
402
432
|
new Promise((resolve, reject) => {
|
|
403
433
|
const commands = getNpmiCommands(registry, force)
|
|
404
434
|
const options = getOptions(directory)
|
|
435
|
+
/**
|
|
436
|
+
* @type {HandleComplete}
|
|
437
|
+
*/
|
|
438
|
+
function handleComplete (e, v) {
|
|
439
|
+
if (!e) {
|
|
440
|
+
resolve(v)
|
|
441
|
+
} else {
|
|
442
|
+
reject(e)
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
info(commands)
|
|
405
447
|
|
|
406
448
|
const {
|
|
407
449
|
stdout,
|
|
408
450
|
stderr
|
|
409
|
-
} = exec(commands, options,
|
|
410
|
-
return (!e) ? resolve(v) : reject(e)
|
|
411
|
-
})
|
|
451
|
+
} = exec(commands, options, handleComplete)
|
|
412
452
|
|
|
413
453
|
const log = use('npmi')
|
|
414
454
|
|
|
@@ -433,13 +473,23 @@ function deps (d = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
433
473
|
new Promise((resolve, reject) => {
|
|
434
474
|
const commands = getDepsCommands(registry, force)
|
|
435
475
|
const options = getOptions(directory)
|
|
476
|
+
/**
|
|
477
|
+
* @type {HandleComplete}
|
|
478
|
+
*/
|
|
479
|
+
function handleComplete (e, v) {
|
|
480
|
+
if (!e) {
|
|
481
|
+
resolve(v)
|
|
482
|
+
} else {
|
|
483
|
+
reject(e)
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
info(commands)
|
|
436
488
|
|
|
437
489
|
const {
|
|
438
490
|
stdout,
|
|
439
491
|
stderr
|
|
440
|
-
} = exec(commands, options,
|
|
441
|
-
return (!e) ? resolve(v) : reject(e)
|
|
442
|
-
})
|
|
492
|
+
} = exec(commands, options, handleComplete)
|
|
443
493
|
|
|
444
494
|
const log = use('deps')
|
|
445
495
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.22",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"commander": "^14.0.0",
|
|
58
58
|
"debug": "^4.4.1",
|
|
59
59
|
"glob": "^11.0.3",
|
|
60
|
-
"strip-ansi": "^7.1.
|
|
61
|
-
"supports-color": "^10.2.
|
|
60
|
+
"strip-ansi": "^7.1.2",
|
|
61
|
+
"supports-color": "^10.2.2"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@sequencemedia/eslint-config-standard": "^0.2.79",
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"@types/debug": "^4.1.12",
|
|
69
69
|
"@types/mocha": "^10.0.10",
|
|
70
70
|
"@types/node": "^24.3.1",
|
|
71
|
-
"@typescript-eslint/parser": "^8.
|
|
71
|
+
"@typescript-eslint/parser": "^8.43.0",
|
|
72
72
|
"chai": "^6.0.1",
|
|
73
73
|
"cross-env": "^10.0.0",
|
|
74
|
-
"eslint": "^9.
|
|
75
|
-
"eslint-plugin-jsdoc": "^
|
|
74
|
+
"eslint": "^9.35.0",
|
|
75
|
+
"eslint-plugin-jsdoc": "^55.0.0",
|
|
76
76
|
"globals": "^16.3.0",
|
|
77
77
|
"husky": "^9.1.7",
|
|
78
78
|
"mocha": "^11.7.2"
|
package/src/common/git/index.mjs
CHANGED
package/src/common/index.mjs
CHANGED
|
@@ -30,8 +30,8 @@ const log = debug('@modernpoacher/deps')
|
|
|
30
30
|
|
|
31
31
|
log(`\`common\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
32
32
|
|
|
33
|
-
const LF = String.
|
|
34
|
-
const SP = String.
|
|
33
|
+
const LF = String.fromCodePoint(10)
|
|
34
|
+
const SP = String.fromCodePoint(32)
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @param {string} v
|
package/src/index.mjs
CHANGED
|
@@ -62,6 +62,8 @@ const info = debug('@modernpoacher/deps:info')
|
|
|
62
62
|
|
|
63
63
|
log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
64
64
|
|
|
65
|
+
const LF = String.fromCodePoint(10)
|
|
66
|
+
|
|
65
67
|
/**
|
|
66
68
|
* @param {string} v
|
|
67
69
|
* @returns {boolean}
|
|
@@ -86,7 +88,7 @@ export function use (key) {
|
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
return function use (value) {
|
|
89
|
-
value.split(
|
|
91
|
+
value.split(LF)
|
|
90
92
|
.filter(filter)
|
|
91
93
|
.forEach(write)
|
|
92
94
|
}
|
|
@@ -138,13 +140,9 @@ export function getInstallCommands (deps, r, f) {
|
|
|
138
140
|
export function getInstallSaveBundleSaveExactCommands (deps, r, f) {
|
|
139
141
|
log('getInstallSaveBundleSaveExactCommands')
|
|
140
142
|
|
|
141
|
-
|
|
143
|
+
return normalizeCommands(
|
|
142
144
|
getSaveBundleParameter(getInstallSaveExactCommands(deps, r, f))
|
|
143
145
|
)
|
|
144
|
-
|
|
145
|
-
info(commands)
|
|
146
|
-
|
|
147
|
-
return commands
|
|
148
146
|
}
|
|
149
147
|
|
|
150
148
|
/**
|
|
@@ -159,13 +157,9 @@ export function getInstallSaveBundleSaveExactCommands (deps, r, f) {
|
|
|
159
157
|
export function getInstallSaveBundleCommands (deps, r, f) {
|
|
160
158
|
log('getInstallSaveBundleCommands')
|
|
161
159
|
|
|
162
|
-
|
|
160
|
+
return normalizeCommands(
|
|
163
161
|
getSaveBundleParameter(getInstallCommands(deps, r, f))
|
|
164
162
|
)
|
|
165
|
-
|
|
166
|
-
info(commands)
|
|
167
|
-
|
|
168
|
-
return commands
|
|
169
163
|
}
|
|
170
164
|
|
|
171
165
|
/**
|
|
@@ -180,13 +174,9 @@ export function getInstallSaveBundleCommands (deps, r, f) {
|
|
|
180
174
|
export function getInstallSaveOptionalSaveExactCommands (deps, r, f) {
|
|
181
175
|
log('getInstallSaveOptionalSaveExactCommands')
|
|
182
176
|
|
|
183
|
-
|
|
177
|
+
return normalizeCommands(
|
|
184
178
|
getSaveOptionalParameter(getInstallSaveExactCommands(deps, r, f))
|
|
185
179
|
)
|
|
186
|
-
|
|
187
|
-
info(commands)
|
|
188
|
-
|
|
189
|
-
return commands
|
|
190
180
|
}
|
|
191
181
|
|
|
192
182
|
/**
|
|
@@ -201,13 +191,9 @@ export function getInstallSaveOptionalSaveExactCommands (deps, r, f) {
|
|
|
201
191
|
export function getInstallSaveOptionalCommands (deps, r, f) {
|
|
202
192
|
log('getInstallSaveOptionalCommands')
|
|
203
193
|
|
|
204
|
-
|
|
194
|
+
return normalizeCommands(
|
|
205
195
|
getSaveOptionalParameter(getInstallCommands(deps, r, f))
|
|
206
196
|
)
|
|
207
|
-
|
|
208
|
-
info(commands)
|
|
209
|
-
|
|
210
|
-
return commands
|
|
211
197
|
}
|
|
212
198
|
|
|
213
199
|
/**
|
|
@@ -222,13 +208,9 @@ export function getInstallSaveOptionalCommands (deps, r, f) {
|
|
|
222
208
|
export function getInstallSaveDevSaveExactCommands (deps, r, f) {
|
|
223
209
|
log('getInstallSaveDevSaveExactCommands')
|
|
224
210
|
|
|
225
|
-
|
|
211
|
+
return normalizeCommands(
|
|
226
212
|
getSaveDevParameter(getInstallSaveExactCommands(deps, r, f))
|
|
227
213
|
)
|
|
228
|
-
|
|
229
|
-
info(commands)
|
|
230
|
-
|
|
231
|
-
return commands
|
|
232
214
|
}
|
|
233
215
|
|
|
234
216
|
/**
|
|
@@ -243,13 +225,9 @@ export function getInstallSaveDevSaveExactCommands (deps, r, f) {
|
|
|
243
225
|
export function getInstallSaveDevCommands (deps, r, f) {
|
|
244
226
|
log('getInstallSaveDevCommands')
|
|
245
227
|
|
|
246
|
-
|
|
228
|
+
return normalizeCommands(
|
|
247
229
|
getSaveDevParameter(getInstallCommands(deps, r, f))
|
|
248
230
|
)
|
|
249
|
-
|
|
250
|
-
info(commands)
|
|
251
|
-
|
|
252
|
-
return commands
|
|
253
231
|
}
|
|
254
232
|
|
|
255
233
|
/**
|
|
@@ -264,13 +242,9 @@ export function getInstallSaveDevCommands (deps, r, f) {
|
|
|
264
242
|
export function getInstallSaveProdSaveExactCommands (deps, r, f) {
|
|
265
243
|
log('getInstallSaveProdSaveExactCommands')
|
|
266
244
|
|
|
267
|
-
|
|
245
|
+
return normalizeCommands(
|
|
268
246
|
getSaveProdParameter(getInstallSaveExactCommands(deps, r, f))
|
|
269
247
|
)
|
|
270
|
-
|
|
271
|
-
info(commands)
|
|
272
|
-
|
|
273
|
-
return commands
|
|
274
248
|
}
|
|
275
249
|
|
|
276
250
|
/**
|
|
@@ -285,13 +259,9 @@ export function getInstallSaveProdSaveExactCommands (deps, r, f) {
|
|
|
285
259
|
export function getInstallSaveProdCommands (deps, r, f) {
|
|
286
260
|
log('getInstallSaveProdCommands')
|
|
287
261
|
|
|
288
|
-
|
|
262
|
+
return normalizeCommands(
|
|
289
263
|
getSaveProdParameter(getInstallCommands(deps, r, f))
|
|
290
264
|
)
|
|
291
|
-
|
|
292
|
-
info(commands)
|
|
293
|
-
|
|
294
|
-
return commands
|
|
295
265
|
}
|
|
296
266
|
|
|
297
267
|
/**
|
|
@@ -326,6 +296,8 @@ export function installSaveBundleSaveExact (d, deps, r, f) {
|
|
|
326
296
|
}
|
|
327
297
|
}
|
|
328
298
|
|
|
299
|
+
info(commands)
|
|
300
|
+
|
|
329
301
|
const {
|
|
330
302
|
stdout,
|
|
331
303
|
stderr
|
|
@@ -371,6 +343,8 @@ export function installSaveBundle (d, deps, r, f) {
|
|
|
371
343
|
}
|
|
372
344
|
}
|
|
373
345
|
|
|
346
|
+
info(commands)
|
|
347
|
+
|
|
374
348
|
const {
|
|
375
349
|
stdout,
|
|
376
350
|
stderr
|
|
@@ -416,6 +390,8 @@ export function installSaveOptionalSaveExact (d, deps, r, f) {
|
|
|
416
390
|
}
|
|
417
391
|
}
|
|
418
392
|
|
|
393
|
+
info(commands)
|
|
394
|
+
|
|
419
395
|
const {
|
|
420
396
|
stdout,
|
|
421
397
|
stderr
|
|
@@ -461,6 +437,8 @@ export function installSaveOptional (d, deps, r, f) {
|
|
|
461
437
|
}
|
|
462
438
|
}
|
|
463
439
|
|
|
440
|
+
info(commands)
|
|
441
|
+
|
|
464
442
|
const {
|
|
465
443
|
stdout,
|
|
466
444
|
stderr
|
|
@@ -506,6 +484,8 @@ export function installSaveDevSaveExact (d, deps, r, f) {
|
|
|
506
484
|
}
|
|
507
485
|
}
|
|
508
486
|
|
|
487
|
+
info(commands)
|
|
488
|
+
|
|
509
489
|
const {
|
|
510
490
|
stdout,
|
|
511
491
|
stderr
|
|
@@ -551,6 +531,8 @@ export function installSaveDev (d, deps, r, f) {
|
|
|
551
531
|
}
|
|
552
532
|
}
|
|
553
533
|
|
|
534
|
+
info(commands)
|
|
535
|
+
|
|
554
536
|
const {
|
|
555
537
|
stdout,
|
|
556
538
|
stderr
|
|
@@ -596,6 +578,8 @@ export function installSaveProdSaveExact (d, deps, r, f) {
|
|
|
596
578
|
}
|
|
597
579
|
}
|
|
598
580
|
|
|
581
|
+
info(commands)
|
|
582
|
+
|
|
599
583
|
const {
|
|
600
584
|
stdout,
|
|
601
585
|
stderr
|
|
@@ -641,6 +625,8 @@ export function installSaveProd (d, deps, r, f) {
|
|
|
641
625
|
}
|
|
642
626
|
}
|
|
643
627
|
|
|
628
|
+
info(commands)
|
|
629
|
+
|
|
644
630
|
const {
|
|
645
631
|
stdout,
|
|
646
632
|
stderr
|
package/src/install/index.mjs
CHANGED
|
@@ -63,13 +63,9 @@ log(`\`install\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
|
63
63
|
export function getInstallSaveExactCommands (p, s, r, f) {
|
|
64
64
|
log('getInstallSaveExactCommands')
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
return normalizeCommands(
|
|
67
67
|
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, getSaveExactParameter(`npm i ${transform(p)}`))))
|
|
68
68
|
)
|
|
69
|
-
|
|
70
|
-
info(commands)
|
|
71
|
-
|
|
72
|
-
return commands
|
|
73
69
|
}
|
|
74
70
|
|
|
75
71
|
/**
|
|
@@ -85,13 +81,9 @@ export function getInstallSaveExactCommands (p, s, r, f) {
|
|
|
85
81
|
export function getInstallCommands (p, s, r, f) {
|
|
86
82
|
log('getInstallCommands')
|
|
87
83
|
|
|
88
|
-
|
|
84
|
+
return normalizeCommands(
|
|
89
85
|
getNoSaveParameter(s, getRegistryParameter(r, getForceParameter(f, `npm i ${transform(p)}`)))
|
|
90
86
|
)
|
|
91
|
-
|
|
92
|
-
info(commands)
|
|
93
|
-
|
|
94
|
-
return commands
|
|
95
87
|
}
|
|
96
88
|
|
|
97
89
|
/**
|
|
@@ -127,6 +119,8 @@ export function installSaveExact (d, p, s, r, f) {
|
|
|
127
119
|
}
|
|
128
120
|
}
|
|
129
121
|
|
|
122
|
+
info(commands)
|
|
123
|
+
|
|
130
124
|
const {
|
|
131
125
|
stdout,
|
|
132
126
|
stderr
|
|
@@ -171,6 +165,8 @@ export function install (d, p, s, r, f) {
|
|
|
171
165
|
}
|
|
172
166
|
}
|
|
173
167
|
|
|
168
|
+
info(commands)
|
|
169
|
+
|
|
174
170
|
const {
|
|
175
171
|
stdout,
|
|
176
172
|
stderr
|