@modernpoacher/deps 2.2.21 → 2.2.23

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.
@@ -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 tidy = (v) => v.replace(/\n{2,}}/gm, String.fromCharCode(10)).trim()
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 trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
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(String.fromCodePoint(32))
132
- : ARGV.map(toSingle).join(String.fromCodePoint(32))
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(String.fromCharCode(10))
182
+ value.split(LF)
163
183
  .filter(filter)
164
184
  .forEach(write)
165
185
  }
@@ -182,23 +202,23 @@ export function handleError (e = {}) {
182
202
  }
183
203
 
184
204
  /**
185
- * @param {Error | null} [e]
205
+ * @param {Error | null} e
186
206
  * @returns {void}
187
207
  */
188
- export function handleComplete (e = null) {
208
+ export function handleComplete (e) {
189
209
  if (!e) return log('👍')
190
210
  error('👎')
191
211
  }
192
212
 
193
213
  /**
194
- * @param {{ code?: number, message?: string }} [e]
214
+ * @param {{ code?: number, message?: string }} e
195
215
  */
196
- const handlePackageError = ({ message = MESSAGE } = {}) => { info(`Package error: "${message}"`) }
216
+ const handlePackageError = ({ message = MESSAGE }) => { info(`Package error: "${message}"`) }
197
217
 
198
218
  /**
199
- * @param {{ code?: number, message?: string }} [e]
219
+ * @param {{ code?: number, message?: string }} e
200
220
  */
201
- const handleConfigurationError = ({ message = MESSAGE } = {}) => { info(`Configuration error: "${message}"`) }
221
+ const handleConfigurationError = ({ message = MESSAGE }) => { info(`Configuration error: "${message}"`) }
202
222
 
203
223
  const getPackageJsonPath = (directory = DIRECTORY) => resolve(join(directory, 'package.json'))
204
224
 
@@ -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, options)
374
406
 
375
407
  const {
376
408
  stdout,
377
409
  stderr
378
- } = exec(commands, options, (e = null, v = '') => {
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, options)
405
447
 
406
448
  const {
407
449
  stdout,
408
450
  stderr
409
- } = exec(commands, options, (e = null, v = '') => {
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, options)
436
488
 
437
489
  const {
438
490
  stdout,
439
491
  stderr
440
- } = exec(commands, options, (e = null, v = '') => {
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.21",
3
+ "version": "2.2.23",
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.0",
61
- "supports-color": "^10.2.0"
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.42.0",
71
+ "@typescript-eslint/parser": "^8.43.0",
72
72
  "chai": "^6.0.1",
73
73
  "cross-env": "^10.0.0",
74
- "eslint": "^9.34.0",
75
- "eslint-plugin-jsdoc": "^54.3.1",
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"
@@ -71,7 +71,7 @@ const log = debug('@modernpoacher/deps')
71
71
 
72
72
  log(`\`common/git\` (${VERSION} - ${PLATFORM}) is awake`)
73
73
 
74
- const LF = String.fromCharCode(10)
74
+ const LF = String.fromCodePoint(10)
75
75
 
76
76
  /**
77
77
  * @param {string} v
@@ -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.fromCharCode(10)
34
- const SP = String.fromCharCode(32)
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,7 +62,7 @@ const info = debug('@modernpoacher/deps:info')
62
62
 
63
63
  log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
64
64
 
65
- const LF = String.fromCharCode(10)
65
+ const LF = String.fromCodePoint(10)
66
66
 
67
67
  /**
68
68
  * @param {string} v
@@ -140,13 +140,9 @@ export function getInstallCommands (deps, r, f) {
140
140
  export function getInstallSaveBundleSaveExactCommands (deps, r, f) {
141
141
  log('getInstallSaveBundleSaveExactCommands')
142
142
 
143
- const commands = normalizeCommands(
143
+ return normalizeCommands(
144
144
  getSaveBundleParameter(getInstallSaveExactCommands(deps, r, f))
145
145
  )
146
-
147
- info(commands)
148
-
149
- return commands
150
146
  }
151
147
 
152
148
  /**
@@ -161,13 +157,9 @@ export function getInstallSaveBundleSaveExactCommands (deps, r, f) {
161
157
  export function getInstallSaveBundleCommands (deps, r, f) {
162
158
  log('getInstallSaveBundleCommands')
163
159
 
164
- const commands = normalizeCommands(
160
+ return normalizeCommands(
165
161
  getSaveBundleParameter(getInstallCommands(deps, r, f))
166
162
  )
167
-
168
- info(commands)
169
-
170
- return commands
171
163
  }
172
164
 
173
165
  /**
@@ -182,13 +174,9 @@ export function getInstallSaveBundleCommands (deps, r, f) {
182
174
  export function getInstallSaveOptionalSaveExactCommands (deps, r, f) {
183
175
  log('getInstallSaveOptionalSaveExactCommands')
184
176
 
185
- const commands = normalizeCommands(
177
+ return normalizeCommands(
186
178
  getSaveOptionalParameter(getInstallSaveExactCommands(deps, r, f))
187
179
  )
188
-
189
- info(commands)
190
-
191
- return commands
192
180
  }
193
181
 
194
182
  /**
@@ -203,13 +191,9 @@ export function getInstallSaveOptionalSaveExactCommands (deps, r, f) {
203
191
  export function getInstallSaveOptionalCommands (deps, r, f) {
204
192
  log('getInstallSaveOptionalCommands')
205
193
 
206
- const commands = normalizeCommands(
194
+ return normalizeCommands(
207
195
  getSaveOptionalParameter(getInstallCommands(deps, r, f))
208
196
  )
209
-
210
- info(commands)
211
-
212
- return commands
213
197
  }
214
198
 
215
199
  /**
@@ -224,13 +208,9 @@ export function getInstallSaveOptionalCommands (deps, r, f) {
224
208
  export function getInstallSaveDevSaveExactCommands (deps, r, f) {
225
209
  log('getInstallSaveDevSaveExactCommands')
226
210
 
227
- const commands = normalizeCommands(
211
+ return normalizeCommands(
228
212
  getSaveDevParameter(getInstallSaveExactCommands(deps, r, f))
229
213
  )
230
-
231
- info(commands)
232
-
233
- return commands
234
214
  }
235
215
 
236
216
  /**
@@ -245,13 +225,9 @@ export function getInstallSaveDevSaveExactCommands (deps, r, f) {
245
225
  export function getInstallSaveDevCommands (deps, r, f) {
246
226
  log('getInstallSaveDevCommands')
247
227
 
248
- const commands = normalizeCommands(
228
+ return normalizeCommands(
249
229
  getSaveDevParameter(getInstallCommands(deps, r, f))
250
230
  )
251
-
252
- info(commands)
253
-
254
- return commands
255
231
  }
256
232
 
257
233
  /**
@@ -266,13 +242,9 @@ export function getInstallSaveDevCommands (deps, r, f) {
266
242
  export function getInstallSaveProdSaveExactCommands (deps, r, f) {
267
243
  log('getInstallSaveProdSaveExactCommands')
268
244
 
269
- const commands = normalizeCommands(
245
+ return normalizeCommands(
270
246
  getSaveProdParameter(getInstallSaveExactCommands(deps, r, f))
271
247
  )
272
-
273
- info(commands)
274
-
275
- return commands
276
248
  }
277
249
 
278
250
  /**
@@ -287,13 +259,9 @@ export function getInstallSaveProdSaveExactCommands (deps, r, f) {
287
259
  export function getInstallSaveProdCommands (deps, r, f) {
288
260
  log('getInstallSaveProdCommands')
289
261
 
290
- const commands = normalizeCommands(
262
+ return normalizeCommands(
291
263
  getSaveProdParameter(getInstallCommands(deps, r, f))
292
264
  )
293
-
294
- info(commands)
295
-
296
- return commands
297
265
  }
298
266
 
299
267
  /**
@@ -328,6 +296,8 @@ export function installSaveBundleSaveExact (d, deps, r, f) {
328
296
  }
329
297
  }
330
298
 
299
+ info(commands, options)
300
+
331
301
  const {
332
302
  stdout,
333
303
  stderr
@@ -373,6 +343,8 @@ export function installSaveBundle (d, deps, r, f) {
373
343
  }
374
344
  }
375
345
 
346
+ info(commands, options)
347
+
376
348
  const {
377
349
  stdout,
378
350
  stderr
@@ -418,6 +390,8 @@ export function installSaveOptionalSaveExact (d, deps, r, f) {
418
390
  }
419
391
  }
420
392
 
393
+ info(commands, options)
394
+
421
395
  const {
422
396
  stdout,
423
397
  stderr
@@ -463,6 +437,8 @@ export function installSaveOptional (d, deps, r, f) {
463
437
  }
464
438
  }
465
439
 
440
+ info(commands, options)
441
+
466
442
  const {
467
443
  stdout,
468
444
  stderr
@@ -508,6 +484,8 @@ export function installSaveDevSaveExact (d, deps, r, f) {
508
484
  }
509
485
  }
510
486
 
487
+ info(commands, options)
488
+
511
489
  const {
512
490
  stdout,
513
491
  stderr
@@ -553,6 +531,8 @@ export function installSaveDev (d, deps, r, f) {
553
531
  }
554
532
  }
555
533
 
534
+ info(commands, options)
535
+
556
536
  const {
557
537
  stdout,
558
538
  stderr
@@ -598,6 +578,8 @@ export function installSaveProdSaveExact (d, deps, r, f) {
598
578
  }
599
579
  }
600
580
 
581
+ info(commands, options)
582
+
601
583
  const {
602
584
  stdout,
603
585
  stderr
@@ -643,6 +625,8 @@ export function installSaveProd (d, deps, r, f) {
643
625
  }
644
626
  }
645
627
 
628
+ info(commands, options)
629
+
646
630
  const {
647
631
  stdout,
648
632
  stderr
@@ -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
- const commands = normalizeCommands(
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
- const commands = normalizeCommands(
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, options)
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, options)
169
+
174
170
  const {
175
171
  stdout,
176
172
  stderr