@modernpoacher/deps 2.2.49 → 2.3.0
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 +1 -0
- package/bin/node/execute.mjs +19 -100
- package/eslint.config.mjs +2 -4
- package/package.json +15 -18
- package/src/common/format/index.mjs +3 -1
- package/tsconfig.json +4 -2
package/bin/common/index.mjs
CHANGED
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.0",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -40,7 +40,6 @@
|
|
|
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",
|
|
44
43
|
"start": "npm run deps",
|
|
45
44
|
"test": "cross-env NODE_OPTIONS=--disable-warning=ExperimentalWarning DEBUG_COLORS=yes NODE_ENV=test mocha test --recursive --verbose --color"
|
|
46
45
|
},
|
|
@@ -54,29 +53,27 @@
|
|
|
54
53
|
"deps-wipe": "bin/deps/wipe.sh"
|
|
55
54
|
},
|
|
56
55
|
"dependencies": {
|
|
57
|
-
"@sequencemedia/write": "^0.2.
|
|
58
|
-
"commander": "^
|
|
56
|
+
"@sequencemedia/write": "^0.2.46",
|
|
57
|
+
"commander": "^15.0.0",
|
|
59
58
|
"debug": "^4.4.3",
|
|
60
|
-
"glob": "^11.0.3",
|
|
61
|
-
"strip-ansi": "^7.1.2",
|
|
62
59
|
"supports-color": "^10.2.2"
|
|
63
60
|
},
|
|
64
61
|
"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.
|
|
62
|
+
"@sequencemedia/eslint-config-standard": "^0.2.107",
|
|
63
|
+
"@sequencemedia/eslint-config-typescript": "^0.1.182",
|
|
64
|
+
"@sequencemedia/eslint-merge": "^0.0.67",
|
|
65
|
+
"@types/chai": "^5.2.3",
|
|
66
|
+
"@types/debug": "^4.1.13",
|
|
70
67
|
"@types/mocha": "^10.0.10",
|
|
71
|
-
"@types/node": "^
|
|
72
|
-
"@typescript-eslint/parser": "^8.
|
|
73
|
-
"chai": "^6.2.
|
|
68
|
+
"@types/node": "^25.9.3",
|
|
69
|
+
"@typescript-eslint/parser": "^8.61.0",
|
|
70
|
+
"chai": "^6.2.2",
|
|
74
71
|
"cross-env": "^10.1.0",
|
|
75
|
-
"eslint": "
|
|
76
|
-
"eslint-plugin-jsdoc": "^
|
|
77
|
-
"globals": "^
|
|
72
|
+
"eslint": "9.38.0",
|
|
73
|
+
"eslint-plugin-jsdoc": "^63.0.2",
|
|
74
|
+
"globals": "^17.6.0",
|
|
78
75
|
"husky": "^9.1.7",
|
|
79
|
-
"mocha": "^11.7.
|
|
76
|
+
"mocha": "^11.7.6"
|
|
80
77
|
},
|
|
81
78
|
"imports": {
|
|
82
79
|
"#deps/bin": "./bin/index.mjs",
|
package/tsconfig.json
CHANGED