@modernpoacher/deps 2.2.49 → 2.3.1
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 +10 -6
- package/bin/node/execute.mjs +19 -100
- package/eslint.config.mjs +2 -4
- package/package.json +16 -18
- package/src/common/format/index.mjs +3 -1
- package/src/common/git/index.mjs +13 -12
- package/tsconfig.json +4 -2
package/bin/common/index.mjs
CHANGED
|
@@ -136,6 +136,7 @@ export const ARGS = PLATFORM === 'win32'
|
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* @param {{ code?: number, message?: string }} [e]
|
|
139
|
+
* @returns {void}
|
|
139
140
|
*/
|
|
140
141
|
export function handleError (e = {}) {
|
|
141
142
|
const {
|
|
@@ -143,6 +144,7 @@ export function handleError (e = {}) {
|
|
|
143
144
|
} = e
|
|
144
145
|
|
|
145
146
|
if (code > 1) error(code)
|
|
147
|
+
|
|
146
148
|
const {
|
|
147
149
|
message = MESSAGE
|
|
148
150
|
} = e
|
|
@@ -161,6 +163,7 @@ export function handleComplete (e) {
|
|
|
161
163
|
|
|
162
164
|
/**
|
|
163
165
|
* @param {{ code?: number, message?: string }} e
|
|
166
|
+
* @returns {void}
|
|
164
167
|
*/
|
|
165
168
|
function handlePackageError ({ message = MESSAGE }) {
|
|
166
169
|
error(`Package error: "${message}"`)
|
|
@@ -168,30 +171,31 @@ function handlePackageError ({ message = MESSAGE }) {
|
|
|
168
171
|
|
|
169
172
|
/**
|
|
170
173
|
* @param {{ code?: number, message?: string }} e
|
|
174
|
+
* @returns {void}
|
|
171
175
|
*/
|
|
172
176
|
function handleConfigurationError ({ message = MESSAGE }) {
|
|
173
177
|
error(`Configuration error: "${message}"`)
|
|
174
178
|
}
|
|
175
179
|
|
|
176
180
|
/**
|
|
177
|
-
*
|
|
178
|
-
*
|
|
181
|
+
* @param {string} directory
|
|
182
|
+
* @returns {string}
|
|
179
183
|
*/
|
|
180
184
|
function getPackageJsonPath (directory = DIRECTORY) {
|
|
181
185
|
return resolve(join(directory, 'package.json'))
|
|
182
186
|
}
|
|
183
187
|
|
|
184
188
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
189
|
+
* @param {string} directory
|
|
190
|
+
* @returns {string}
|
|
187
191
|
*/
|
|
188
192
|
function getDepsRcPath (directory = DIRECTORY) {
|
|
189
193
|
return resolve(join(directory, '.depsrc'))
|
|
190
194
|
}
|
|
191
195
|
|
|
192
196
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
197
|
+
* @param {string} directory
|
|
198
|
+
* @returns {string}
|
|
195
199
|
*/
|
|
196
200
|
function getDepsRcJsonPath (directory = DIRECTORY) {
|
|
197
201
|
return resolve(join(directory, '.depsrc.json'))
|
package/bin/node/execute.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
glob
|
|
10
|
-
} from '
|
|
10
|
+
} from 'node:fs/promises'
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
Command
|
|
@@ -248,109 +248,36 @@ async function toMessage (message, directory) {
|
|
|
248
248
|
return message || await getMessageFromConfiguration(directory) || MESSAGE
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
/**
|
|
252
|
-
* @type {(v: string | undefined) => v is string}
|
|
253
|
-
* @param {string | undefined} v
|
|
254
|
-
* @returns {boolean}
|
|
255
|
-
*/
|
|
256
|
-
function filter (v) { // de-falsy
|
|
257
|
-
return Boolean(v)
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* @param {string} alpha
|
|
262
|
-
* @param {string} omega
|
|
263
|
-
* @returns {number}
|
|
264
|
-
*/
|
|
265
|
-
function sort (alpha, omega) {
|
|
266
|
-
return alpha.localeCompare(omega)
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* @param {string[]} directories
|
|
271
|
-
* @yields {string | undefined}
|
|
272
|
-
*/
|
|
273
|
-
function * genDirsList (directories = []) {
|
|
274
|
-
while (directories.length) yield directories.shift()
|
|
275
|
-
}
|
|
276
|
-
|
|
277
251
|
/**
|
|
278
252
|
* @param {string} directory
|
|
279
|
-
* @returns {
|
|
253
|
+
* @returns {string[]}
|
|
280
254
|
*/
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
return (
|
|
287
|
-
array
|
|
288
|
-
.map(dirname)
|
|
289
|
-
.sort(sort)
|
|
290
|
-
)
|
|
255
|
+
function toPackagePatterns (directory) {
|
|
256
|
+
return [
|
|
257
|
+
`${directory}/package.json`,
|
|
258
|
+
`${directory}/**/package.json`
|
|
259
|
+
]
|
|
291
260
|
}
|
|
292
261
|
|
|
293
262
|
/**
|
|
294
|
-
* @param {
|
|
295
|
-
* @returns {
|
|
263
|
+
* @param {string} directory
|
|
264
|
+
* @returns {string[]}
|
|
296
265
|
*/
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
* @type {string[]}
|
|
303
|
-
*/
|
|
304
|
-
const alpha = (
|
|
305
|
-
Array.from(new Set(directories))
|
|
306
|
-
.filter(filter)
|
|
307
|
-
.sort(sort)
|
|
308
|
-
)
|
|
309
|
-
|
|
310
|
-
try {
|
|
311
|
-
/**
|
|
312
|
-
* Recreate `directories` from `alpha`
|
|
313
|
-
* @type {(string | undefined)[]}
|
|
314
|
-
*/
|
|
315
|
-
const directories = (
|
|
316
|
-
await Promise.all(
|
|
317
|
-
alpha
|
|
318
|
-
.map(mapRevParseShowTopLevel)
|
|
319
|
-
)
|
|
320
|
-
)
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Transform `directories` to create `omega`
|
|
324
|
-
* @type {string[]}
|
|
325
|
-
*/
|
|
326
|
-
const omega = (
|
|
327
|
-
Array.from(new Set(directories))
|
|
328
|
-
.filter(filter)
|
|
329
|
-
.sort(sort)
|
|
330
|
-
)
|
|
331
|
-
|
|
332
|
-
return omega
|
|
333
|
-
} catch (e) {
|
|
334
|
-
if (e instanceof Error) handleError(e)
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
return []
|
|
266
|
+
function toExcludePatterns (directory) {
|
|
267
|
+
return [
|
|
268
|
+
`${directory}/node_modules`,
|
|
269
|
+
`${directory}/**/node_modules`
|
|
270
|
+
]
|
|
338
271
|
}
|
|
339
272
|
|
|
340
273
|
/**
|
|
341
274
|
* @param {string} directory
|
|
342
|
-
* @
|
|
275
|
+
* @yields {string}
|
|
343
276
|
*/
|
|
344
|
-
async function
|
|
345
|
-
log('
|
|
277
|
+
async function * genDirectory (directory) {
|
|
278
|
+
log('genDirectory')
|
|
346
279
|
|
|
347
|
-
|
|
348
|
-
return (
|
|
349
|
-
await gitRevParseShowTopLevel(directory)
|
|
350
|
-
)
|
|
351
|
-
} catch (e) {
|
|
352
|
-
if (e instanceof Error) handleCommandError(e)
|
|
353
|
-
}
|
|
280
|
+
for await (const packageJson of await glob(toPackagePatterns(directory), { exclude: toExcludePatterns (directory) })) yield dirname(packageJson)
|
|
354
281
|
}
|
|
355
282
|
|
|
356
283
|
/**
|
|
@@ -399,15 +326,7 @@ async function iteratePath (directory, registry, force, message, author) {
|
|
|
399
326
|
if (directory) {
|
|
400
327
|
const D = resolve(directory)
|
|
401
328
|
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
if (pathList.length) {
|
|
405
|
-
const depsList = await getDepsList(pathList)
|
|
406
|
-
|
|
407
|
-
if (depsList.length) {
|
|
408
|
-
for (const d of genDirsList(depsList)) if (d) await iterate(d, registry, force, message, author)
|
|
409
|
-
}
|
|
410
|
-
}
|
|
329
|
+
for await (const d of genDirectory(D)) await iterate(d, registry, force, message, author)
|
|
411
330
|
}
|
|
412
331
|
}
|
|
413
332
|
|
package/eslint.config.mjs
CHANGED
|
@@ -72,8 +72,7 @@ export default [
|
|
|
72
72
|
languageOptions: {
|
|
73
73
|
parser: typescriptParser,
|
|
74
74
|
parserOptions: {
|
|
75
|
-
projectService: true
|
|
76
|
-
project: 'tsconfig.json'
|
|
75
|
+
projectService: true
|
|
77
76
|
},
|
|
78
77
|
globals: {
|
|
79
78
|
...globals.node,
|
|
@@ -90,8 +89,7 @@ export default [
|
|
|
90
89
|
languageOptions: {
|
|
91
90
|
parser: typescriptParser,
|
|
92
91
|
parserOptions: {
|
|
93
|
-
projectService: true
|
|
94
|
-
project: 'tsconfig.json'
|
|
92
|
+
projectService: true
|
|
95
93
|
},
|
|
96
94
|
globals: {
|
|
97
95
|
...globals.browser,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"deps-wipe": "cross-env NODE_OPTIONS=--disable-warning=ExperimentalWarning DEBUG_COLORS=yes NODE_ENV=production node bin/deps/wipe.mjs",
|
|
41
41
|
"lint": "eslint .",
|
|
42
42
|
"lint:fix": "npm run lint -- --fix",
|
|
43
|
-
"prepare": "husky",
|
|
43
|
+
"prepare": "husky || true",
|
|
44
44
|
"start": "npm run deps",
|
|
45
45
|
"test": "cross-env NODE_OPTIONS=--disable-warning=ExperimentalWarning DEBUG_COLORS=yes NODE_ENV=test mocha test --recursive --verbose --color"
|
|
46
46
|
},
|
|
@@ -54,29 +54,27 @@
|
|
|
54
54
|
"deps-wipe": "bin/deps/wipe.sh"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@sequencemedia/write": "^0.2.
|
|
58
|
-
"commander": "^
|
|
57
|
+
"@sequencemedia/write": "^0.2.46",
|
|
58
|
+
"commander": "^15.0.0",
|
|
59
59
|
"debug": "^4.4.3",
|
|
60
|
-
"glob": "^11.0.3",
|
|
61
|
-
"strip-ansi": "^7.1.2",
|
|
62
60
|
"supports-color": "^10.2.2"
|
|
63
61
|
},
|
|
64
62
|
"devDependencies": {
|
|
65
|
-
"@sequencemedia/eslint-config-standard": "^0.2.
|
|
66
|
-
"@sequencemedia/eslint-config-typescript": "^0.1.
|
|
67
|
-
"@sequencemedia/eslint-merge": "^0.0.
|
|
68
|
-
"@types/chai": "^5.2.
|
|
69
|
-
"@types/debug": "^4.1.
|
|
63
|
+
"@sequencemedia/eslint-config-standard": "^0.2.107",
|
|
64
|
+
"@sequencemedia/eslint-config-typescript": "^0.1.182",
|
|
65
|
+
"@sequencemedia/eslint-merge": "^0.0.67",
|
|
66
|
+
"@types/chai": "^5.2.3",
|
|
67
|
+
"@types/debug": "^4.1.13",
|
|
70
68
|
"@types/mocha": "^10.0.10",
|
|
71
|
-
"@types/node": "^
|
|
72
|
-
"@typescript-eslint/parser": "^8.
|
|
73
|
-
"chai": "^6.2.
|
|
69
|
+
"@types/node": "^26.1.1",
|
|
70
|
+
"@typescript-eslint/parser": "^8.64.0",
|
|
71
|
+
"chai": "^6.2.2",
|
|
74
72
|
"cross-env": "^10.1.0",
|
|
75
|
-
"eslint": "
|
|
76
|
-
"eslint-plugin-jsdoc": "^
|
|
77
|
-
"globals": "^
|
|
73
|
+
"eslint": "9.38.0",
|
|
74
|
+
"eslint-plugin-jsdoc": "^63.0.13",
|
|
75
|
+
"globals": "^17.7.0",
|
|
78
76
|
"husky": "^9.1.7",
|
|
79
|
-
"mocha": "^11.7.
|
|
77
|
+
"mocha": "^11.7.6"
|
|
80
78
|
},
|
|
81
79
|
"imports": {
|
|
82
80
|
"#deps/bin": "./bin/index.mjs",
|
package/src/common/git/index.mjs
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
} from '#deps/src/common/env'
|
|
28
28
|
|
|
29
29
|
import {
|
|
30
|
+
formatDirectory,
|
|
30
31
|
use,
|
|
31
32
|
trim
|
|
32
33
|
} from '#deps/src/common/format'
|
|
@@ -241,8 +242,8 @@ export function gitConfigUserName (d = DIRECTORY) {
|
|
|
241
242
|
stderr
|
|
242
243
|
} = exec(commands, options, handleComplete)
|
|
243
244
|
|
|
244
|
-
if (stdout) stdout.on('data', out('git-config-user-name', directory))
|
|
245
|
-
if (stderr) stderr.on('data', err('git-config-user-name', directory))
|
|
245
|
+
if (stdout) stdout.on('data', out('git-config-user-name', formatDirectory(directory)))
|
|
246
|
+
if (stderr) stderr.on('data', err('git-config-user-name', formatDirectory(directory)))
|
|
246
247
|
})
|
|
247
248
|
)
|
|
248
249
|
}
|
|
@@ -277,8 +278,8 @@ export function gitConfigUserEmail (d = DIRECTORY) {
|
|
|
277
278
|
stderr
|
|
278
279
|
} = exec(commands, options, handleComplete)
|
|
279
280
|
|
|
280
|
-
if (stdout) stdout.on('data', out('git-config-user-email', directory))
|
|
281
|
-
if (stderr) stderr.on('data', err('git-config-user-email', directory))
|
|
281
|
+
if (stdout) stdout.on('data', out('git-config-user-email', formatDirectory(directory)))
|
|
282
|
+
if (stderr) stderr.on('data', err('git-config-user-email', formatDirectory(directory)))
|
|
282
283
|
})
|
|
283
284
|
)
|
|
284
285
|
}
|
|
@@ -315,8 +316,8 @@ export function catGitRefsRemotesOriginHead (d = DIRECTORY) {
|
|
|
315
316
|
stderr
|
|
316
317
|
} = exec(commands, options, handleComplete)
|
|
317
318
|
|
|
318
|
-
if (stdout) stdout.on('data', out('cat-git-refs-remotes-origin-head', directory))
|
|
319
|
-
if (stderr) stderr.on('data', err('cat-git-refs-remotes-origin-head', directory))
|
|
319
|
+
if (stdout) stdout.on('data', out('cat-git-refs-remotes-origin-head', formatDirectory(directory)))
|
|
320
|
+
if (stderr) stderr.on('data', err('cat-git-refs-remotes-origin-head', formatDirectory(directory)))
|
|
320
321
|
})
|
|
321
322
|
)
|
|
322
323
|
}
|
|
@@ -353,8 +354,8 @@ export function awkGitRemoteShowOriginHead (d = DIRECTORY) {
|
|
|
353
354
|
stderr
|
|
354
355
|
} = exec(commands, options, handleComplete)
|
|
355
356
|
|
|
356
|
-
if (stdout) stdout.on('data', out('git-remote-show-origin-head', directory))
|
|
357
|
-
if (stderr) stderr.on('data', err('git-remote-show-origin-head', directory))
|
|
357
|
+
if (stdout) stdout.on('data', out('git-remote-show-origin-head', formatDirectory(directory)))
|
|
358
|
+
if (stderr) stderr.on('data', err('git-remote-show-origin-head', formatDirectory(directory)))
|
|
358
359
|
})
|
|
359
360
|
)
|
|
360
361
|
}
|
|
@@ -391,8 +392,8 @@ export function gitRevParseShowTopLevel (d = DIRECTORY) {
|
|
|
391
392
|
stderr
|
|
392
393
|
} = exec(commands, options, handleComplete)
|
|
393
394
|
|
|
394
|
-
if (stdout) stdout.on('data', out('git-rev-parse-show-toplevel', directory))
|
|
395
|
-
if (stderr) stderr.on('data', err('git-rev-parse-show-toplevel', directory))
|
|
395
|
+
if (stdout) stdout.on('data', out('git-rev-parse-show-toplevel', formatDirectory(directory)))
|
|
396
|
+
if (stderr) stderr.on('data', err('git-rev-parse-show-toplevel', formatDirectory(directory)))
|
|
396
397
|
})
|
|
397
398
|
)
|
|
398
399
|
}
|
|
@@ -429,8 +430,8 @@ export function gitRevParseAbbrevRefHead (d = DIRECTORY) {
|
|
|
429
430
|
stderr
|
|
430
431
|
} = exec(commands, options, handleComplete)
|
|
431
432
|
|
|
432
|
-
if (stdout) stdout.on('data', out('git-rev-parse-abbrev-ref-head', directory))
|
|
433
|
-
if (stderr) stderr.on('data', err('git-rev-parse-abbrev-ref-head', directory))
|
|
433
|
+
if (stdout) stdout.on('data', out('git-rev-parse-abbrev-ref-head', formatDirectory(directory)))
|
|
434
|
+
if (stderr) stderr.on('data', err('git-rev-parse-abbrev-ref-head', formatDirectory(directory)))
|
|
434
435
|
})
|
|
435
436
|
)
|
|
436
437
|
}
|
package/tsconfig.json
CHANGED