@modernpoacher/deps 2.2.33 → 2.2.35
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 +12 -11
- package/bin/node/execute.mjs +27 -7
- package/package.json +11 -11
- package/src/common/format/index.mjs +18 -0
- package/src/common/git/index.mjs +5 -5
- package/src/index.mjs +13 -12
- package/src/install/index.mjs +6 -2
package/bin/common/index.mjs
CHANGED
|
@@ -41,17 +41,18 @@ import {
|
|
|
41
41
|
|
|
42
42
|
import debug from '#deps/src/common/debug'
|
|
43
43
|
|
|
44
|
-
import {
|
|
45
|
-
use,
|
|
46
|
-
tidy
|
|
47
|
-
} from '#deps/src/common/format'
|
|
48
|
-
|
|
49
44
|
import {
|
|
50
45
|
VERSION,
|
|
51
46
|
PLATFORM,
|
|
52
47
|
BIN
|
|
53
48
|
} from '#deps/src/common/env'
|
|
54
49
|
|
|
50
|
+
import {
|
|
51
|
+
toHomeDir,
|
|
52
|
+
use,
|
|
53
|
+
tidy
|
|
54
|
+
} from '#deps/src/common/format'
|
|
55
|
+
|
|
55
56
|
import {
|
|
56
57
|
getOptions
|
|
57
58
|
} from '#deps/src/common/options'
|
|
@@ -162,14 +163,14 @@ export function handleComplete (e) {
|
|
|
162
163
|
* @param {{ code?: number, message?: string }} e
|
|
163
164
|
*/
|
|
164
165
|
function handlePackageError ({ message = MESSAGE }) {
|
|
165
|
-
|
|
166
|
+
error(`Package error: "${message}"`)
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
/**
|
|
169
170
|
* @param {{ code?: number, message?: string }} e
|
|
170
171
|
*/
|
|
171
172
|
function handleConfigurationError ({ message = MESSAGE }) {
|
|
172
|
-
|
|
173
|
+
error(`Configuration error: "${message}"`)
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
/**
|
|
@@ -239,7 +240,7 @@ async function getDepsRcJson (directory = DIRECTORY) {
|
|
|
239
240
|
async function hasPackage (directory = DIRECTORY) {
|
|
240
241
|
log('hasPackage')
|
|
241
242
|
|
|
242
|
-
info(`Directory is "${directory}"`)
|
|
243
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
243
244
|
|
|
244
245
|
try {
|
|
245
246
|
await access(getPackageJsonPath(directory), constants.R_OK)
|
|
@@ -259,7 +260,7 @@ async function hasPackage (directory = DIRECTORY) {
|
|
|
259
260
|
async function getPackage (directory = DIRECTORY) {
|
|
260
261
|
log('getPackage')
|
|
261
262
|
|
|
262
|
-
info(`Directory is "${directory}"`)
|
|
263
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
263
264
|
|
|
264
265
|
try {
|
|
265
266
|
return await getPackageJson(directory)
|
|
@@ -276,7 +277,7 @@ async function getPackage (directory = DIRECTORY) {
|
|
|
276
277
|
async function hasConfiguration (directory = DIRECTORY) {
|
|
277
278
|
log('hasConfiguration')
|
|
278
279
|
|
|
279
|
-
info(`Directory is "${directory}"`)
|
|
280
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
280
281
|
|
|
281
282
|
try {
|
|
282
283
|
await access(getDepsRcPath(directory), constants.R_OK)
|
|
@@ -319,7 +320,7 @@ async function hasConfiguration (directory = DIRECTORY) {
|
|
|
319
320
|
async function getConfiguration (directory = DIRECTORY) {
|
|
320
321
|
log('getConfiguration')
|
|
321
322
|
|
|
322
|
-
info(`Directory is "${directory}"`)
|
|
323
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
323
324
|
|
|
324
325
|
try {
|
|
325
326
|
return await getDepsRc(directory)
|
package/bin/node/execute.mjs
CHANGED
|
@@ -22,6 +22,10 @@ import {
|
|
|
22
22
|
PLATFORM
|
|
23
23
|
} from '#deps/src/common/env'
|
|
24
24
|
|
|
25
|
+
import {
|
|
26
|
+
toHomeDir
|
|
27
|
+
} from '#deps/src/common/format'
|
|
28
|
+
|
|
25
29
|
import {
|
|
26
30
|
MESSAGE,
|
|
27
31
|
AUTHOR,
|
|
@@ -245,14 +249,19 @@ async function toMessage (message, directory) {
|
|
|
245
249
|
* @param {string | undefined} v
|
|
246
250
|
* @returns {boolean}
|
|
247
251
|
*/
|
|
248
|
-
|
|
252
|
+
export function filterDeps (v) { // de-falsy
|
|
253
|
+
return Boolean(v)
|
|
254
|
+
}
|
|
249
255
|
|
|
250
256
|
/**
|
|
251
257
|
* @param {string[]} a
|
|
252
258
|
* @param {string} v
|
|
253
259
|
* @returns {string[]}
|
|
254
260
|
*/
|
|
255
|
-
|
|
261
|
+
export function reduceDeps (a, v = '') { // de-dupe
|
|
262
|
+
if (!a.includes(v)) a.push(v)
|
|
263
|
+
return a
|
|
264
|
+
}
|
|
256
265
|
|
|
257
266
|
/**
|
|
258
267
|
* @param {string[]} directories
|
|
@@ -278,6 +287,15 @@ async function getPathList (directory) {
|
|
|
278
287
|
)
|
|
279
288
|
}
|
|
280
289
|
|
|
290
|
+
/**
|
|
291
|
+
* @param {string} alpha
|
|
292
|
+
* @param {string} omega
|
|
293
|
+
* @returns {number}
|
|
294
|
+
*/
|
|
295
|
+
function sort (alpha, omega) {
|
|
296
|
+
return alpha.localeCompare(omega)
|
|
297
|
+
}
|
|
298
|
+
|
|
281
299
|
/**
|
|
282
300
|
* @param {Array<string | undefined>} [directories]
|
|
283
301
|
* @returns {Promise<string[]>}
|
|
@@ -287,12 +305,13 @@ async function getDepsList (directories = []) {
|
|
|
287
305
|
|
|
288
306
|
/**
|
|
289
307
|
* Transform `directories` to create `alpha`
|
|
308
|
+
* @type {string[]}
|
|
290
309
|
*/
|
|
291
310
|
const alpha = (
|
|
292
311
|
directories
|
|
293
|
-
.filter(
|
|
312
|
+
.filter(Boolean)
|
|
294
313
|
.reduce(reduceDeps, [])
|
|
295
|
-
.sort()
|
|
314
|
+
.sort(sort)
|
|
296
315
|
)
|
|
297
316
|
|
|
298
317
|
try {
|
|
@@ -309,12 +328,13 @@ async function getDepsList (directories = []) {
|
|
|
309
328
|
|
|
310
329
|
/**
|
|
311
330
|
* Transform `directories` to create `omega`
|
|
331
|
+
* @type {string[]}
|
|
312
332
|
*/
|
|
313
333
|
const omega = (
|
|
314
334
|
directories
|
|
315
|
-
.filter(
|
|
335
|
+
.filter(Boolean)
|
|
316
336
|
.reduce(reduceDeps, [])
|
|
317
|
-
.sort()
|
|
337
|
+
.sort(sort)
|
|
318
338
|
)
|
|
319
339
|
|
|
320
340
|
return omega
|
|
@@ -411,7 +431,7 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
|
|
|
411
431
|
log('execute')
|
|
412
432
|
|
|
413
433
|
try {
|
|
414
|
-
info(`Directory is "${directory}"`)
|
|
434
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
415
435
|
info(`Registry is "${registry}"`)
|
|
416
436
|
info(`Force is "${force}"`)
|
|
417
437
|
info(`Message is "${message}"`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.35",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"deps-wipe": "bin/deps/wipe.sh"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@sequencemedia/write": "^0.2.
|
|
57
|
+
"@sequencemedia/write": "^0.2.13",
|
|
58
58
|
"commander": "^14.0.1",
|
|
59
59
|
"debug": "^4.4.3",
|
|
60
60
|
"glob": "^11.0.3",
|
|
@@ -62,21 +62,21 @@
|
|
|
62
62
|
"supports-color": "^10.2.2"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@sequencemedia/eslint-config-standard": "^0.2.
|
|
66
|
-
"@sequencemedia/eslint-config-typescript": "^0.1.
|
|
67
|
-
"@sequencemedia/eslint-merge": "^0.0.
|
|
65
|
+
"@sequencemedia/eslint-config-standard": "^0.2.88",
|
|
66
|
+
"@sequencemedia/eslint-config-typescript": "^0.1.149",
|
|
67
|
+
"@sequencemedia/eslint-merge": "^0.0.54",
|
|
68
68
|
"@types/chai": "^5.2.2",
|
|
69
69
|
"@types/debug": "^4.1.12",
|
|
70
70
|
"@types/mocha": "^10.0.10",
|
|
71
|
-
"@types/node": "^24.
|
|
72
|
-
"@typescript-eslint/parser": "^8.
|
|
73
|
-
"chai": "^6.0
|
|
74
|
-
"cross-env": "^10.
|
|
71
|
+
"@types/node": "^24.6.2",
|
|
72
|
+
"@typescript-eslint/parser": "^8.45.0",
|
|
73
|
+
"chai": "^6.2.0",
|
|
74
|
+
"cross-env": "^10.1.0",
|
|
75
75
|
"eslint": "^9.36.0",
|
|
76
|
-
"eslint-plugin-jsdoc": "^60.
|
|
76
|
+
"eslint-plugin-jsdoc": "^60.7.1",
|
|
77
77
|
"globals": "^16.4.0",
|
|
78
78
|
"husky": "^9.1.7",
|
|
79
|
-
"mocha": "^11.7.
|
|
79
|
+
"mocha": "^11.7.4"
|
|
80
80
|
},
|
|
81
81
|
"imports": {
|
|
82
82
|
"#deps/bin": "./bin/index.mjs",
|
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import debug from 'debug'
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
homedir
|
|
5
|
+
} from 'node:os'
|
|
6
|
+
|
|
3
7
|
import stripAnsi from 'strip-ansi'
|
|
4
8
|
|
|
9
|
+
import {
|
|
10
|
+
PLATFORM
|
|
11
|
+
} from '#deps/src/common/env'
|
|
12
|
+
|
|
13
|
+
const HOMEDIR = homedir()
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @function toHomeDir
|
|
17
|
+
* @type {(directory: string) => string}
|
|
18
|
+
*/
|
|
19
|
+
export const toHomeDir = PLATFORM === 'win32'
|
|
20
|
+
? (directory) => directory
|
|
21
|
+
: (directory) => directory.includes(HOMEDIR) ? directory.replace(HOMEDIR, '~/') : directory
|
|
22
|
+
|
|
5
23
|
const LF = String.fromCodePoint(10)
|
|
6
24
|
|
|
7
25
|
/**
|
package/src/common/git/index.mjs
CHANGED
|
@@ -21,17 +21,17 @@ import {
|
|
|
21
21
|
|
|
22
22
|
import debug from '#deps/src/common/debug'
|
|
23
23
|
|
|
24
|
-
import {
|
|
25
|
-
use,
|
|
26
|
-
trim
|
|
27
|
-
} from '#deps/src/common/format'
|
|
28
|
-
|
|
29
24
|
import {
|
|
30
25
|
BIN,
|
|
31
26
|
VERSION,
|
|
32
27
|
PLATFORM
|
|
33
28
|
} from '#deps/src/common/env'
|
|
34
29
|
|
|
30
|
+
import {
|
|
31
|
+
use,
|
|
32
|
+
trim
|
|
33
|
+
} from '#deps/src/common/format'
|
|
34
|
+
|
|
35
35
|
import {
|
|
36
36
|
getOptions
|
|
37
37
|
} from '#deps/src/common/options'
|
package/src/index.mjs
CHANGED
|
@@ -29,15 +29,16 @@ import {
|
|
|
29
29
|
|
|
30
30
|
import debug from '#deps/src/common/debug'
|
|
31
31
|
|
|
32
|
-
import {
|
|
33
|
-
use
|
|
34
|
-
} from '#deps/src/common/format'
|
|
35
|
-
|
|
36
32
|
import {
|
|
37
33
|
VERSION,
|
|
38
34
|
PLATFORM
|
|
39
35
|
} from '#deps/src/common/env'
|
|
40
36
|
|
|
37
|
+
import {
|
|
38
|
+
toHomeDir,
|
|
39
|
+
use
|
|
40
|
+
} from '#deps/src/common/format'
|
|
41
|
+
|
|
41
42
|
import {
|
|
42
43
|
getOptions
|
|
43
44
|
} from '#deps/src/common/options'
|
|
@@ -249,7 +250,7 @@ export function installSaveBundleSaveExact (d, deps, r, f) {
|
|
|
249
250
|
|
|
250
251
|
const directory = normalize(d.trim())
|
|
251
252
|
|
|
252
|
-
info(`Directory is "${directory}"`)
|
|
253
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
253
254
|
|
|
254
255
|
return (
|
|
255
256
|
new Promise((resolve, reject) => {
|
|
@@ -296,7 +297,7 @@ export function installSaveBundle (d, deps, r, f) {
|
|
|
296
297
|
|
|
297
298
|
const directory = normalize(d.trim())
|
|
298
299
|
|
|
299
|
-
info(`Directory is "${directory}"`)
|
|
300
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
300
301
|
|
|
301
302
|
return (
|
|
302
303
|
new Promise((resolve, reject) => {
|
|
@@ -343,7 +344,7 @@ export function installSaveOptionalSaveExact (d, deps, r, f) {
|
|
|
343
344
|
|
|
344
345
|
const directory = normalize(d.trim())
|
|
345
346
|
|
|
346
|
-
info(`Directory is "${directory}"`)
|
|
347
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
347
348
|
|
|
348
349
|
return (
|
|
349
350
|
new Promise((resolve, reject) => {
|
|
@@ -390,7 +391,7 @@ export function installSaveOptional (d, deps, r, f) {
|
|
|
390
391
|
|
|
391
392
|
const directory = normalize(d.trim())
|
|
392
393
|
|
|
393
|
-
info(`Directory is "${directory}"`)
|
|
394
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
394
395
|
|
|
395
396
|
return (
|
|
396
397
|
new Promise((resolve, reject) => {
|
|
@@ -437,7 +438,7 @@ export function installSaveDevSaveExact (d, deps, r, f) {
|
|
|
437
438
|
|
|
438
439
|
const directory = normalize(d.trim())
|
|
439
440
|
|
|
440
|
-
info(`Directory is "${directory}"`)
|
|
441
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
441
442
|
|
|
442
443
|
return (
|
|
443
444
|
new Promise((resolve, reject) => {
|
|
@@ -484,7 +485,7 @@ export function installSaveDev (d, deps, r, f) {
|
|
|
484
485
|
|
|
485
486
|
const directory = normalize(d.trim())
|
|
486
487
|
|
|
487
|
-
info(`Directory is "${directory}"`)
|
|
488
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
488
489
|
|
|
489
490
|
return (
|
|
490
491
|
new Promise((resolve, reject) => {
|
|
@@ -531,7 +532,7 @@ export function installSaveProdSaveExact (d, deps, r, f) {
|
|
|
531
532
|
|
|
532
533
|
const directory = normalize(d.trim())
|
|
533
534
|
|
|
534
|
-
info(`Directory is "${directory}"`)
|
|
535
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
535
536
|
|
|
536
537
|
return (
|
|
537
538
|
new Promise((resolve, reject) => {
|
|
@@ -578,7 +579,7 @@ export function installSaveProd (d, deps, r, f) {
|
|
|
578
579
|
|
|
579
580
|
const directory = normalize(d.trim())
|
|
580
581
|
|
|
581
|
-
info(`Directory is "${directory}"`)
|
|
582
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
582
583
|
|
|
583
584
|
return (
|
|
584
585
|
new Promise((resolve, reject) => {
|
package/src/install/index.mjs
CHANGED
|
@@ -27,6 +27,10 @@ import {
|
|
|
27
27
|
PLATFORM
|
|
28
28
|
} from '#deps/src/common/env'
|
|
29
29
|
|
|
30
|
+
import {
|
|
31
|
+
toHomeDir
|
|
32
|
+
} from '#deps/src/common/format'
|
|
33
|
+
|
|
30
34
|
import {
|
|
31
35
|
getOptions
|
|
32
36
|
} from '#deps/src/common/options'
|
|
@@ -102,7 +106,7 @@ export function installSaveExact (d, p, s, r, f) {
|
|
|
102
106
|
|
|
103
107
|
const directory = normalize(d.trim())
|
|
104
108
|
|
|
105
|
-
info(`Directory is "${directory}"`)
|
|
109
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
106
110
|
|
|
107
111
|
return (
|
|
108
112
|
new Promise((resolve, reject) => {
|
|
@@ -148,7 +152,7 @@ export function install (d, p, s, r, f) {
|
|
|
148
152
|
|
|
149
153
|
const directory = normalize(d.trim())
|
|
150
154
|
|
|
151
|
-
info(`Directory is "${directory}"`)
|
|
155
|
+
info(`Directory is "${toHomeDir(directory)}"`)
|
|
152
156
|
|
|
153
157
|
return (
|
|
154
158
|
new Promise((resolve, reject) => {
|