@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.
@@ -143,6 +143,7 @@ export function handleError (e = {}) {
143
143
  } = e
144
144
 
145
145
  if (code > 1) error(code)
146
+
146
147
  const {
147
148
  message = MESSAGE
148
149
  } = e
@@ -7,7 +7,7 @@ import {
7
7
 
8
8
  import {
9
9
  glob
10
- } from 'glob'
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 {Promise<string[]>}
253
+ * @returns {string[]}
280
254
  */
281
- async function getPathList (directory) {
282
- log('getPathList')
283
-
284
- const array = await glob(`${directory}/*/package.json`)
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 {(string | undefined)[]} [directories]
295
- * @returns {Promise<string[]>}
263
+ * @param {string} directory
264
+ * @returns {string[]}
296
265
  */
297
- async function getDepsList (directories = []) {
298
- log('getDepsList')
299
-
300
- /**
301
- * Transform `directories` to create `alpha`
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
- * @returns {Promise<string | undefined>}
275
+ * @yields {string}
343
276
  */
344
- async function mapRevParseShowTopLevel (directory) {
345
- log('mapRevParseShowTopLevel')
277
+ async function * genDirectory (directory) {
278
+ log('genDirectory')
346
279
 
347
- try {
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 pathList = await getPathList(D)
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.2.49",
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.16",
58
- "commander": "^14.0.1",
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.89",
66
- "@sequencemedia/eslint-config-typescript": "^0.1.153",
67
- "@sequencemedia/eslint-merge": "^0.0.55",
68
- "@types/chai": "^5.2.2",
69
- "@types/debug": "^4.1.12",
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": "^24.7.0",
72
- "@typescript-eslint/parser": "^8.46.0",
73
- "chai": "^6.2.0",
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": "^9.37.0",
76
- "eslint-plugin-jsdoc": "^60.8.3",
77
- "globals": "^16.4.0",
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.4"
76
+ "mocha": "^11.7.6"
80
77
  },
81
78
  "imports": {
82
79
  "#deps/bin": "./bin/index.mjs",
@@ -1,4 +1,6 @@
1
- import stripAnsi from 'strip-ansi'
1
+ import {
2
+ stripVTControlCharacters as stripAnsi
3
+ } from 'node:util'
2
4
 
3
5
  import {
4
6
  normalize,
package/tsconfig.json CHANGED
@@ -5,8 +5,7 @@
5
5
  "allowJs": true,
6
6
  "checkJs": true,
7
7
  "noEmit": true,
8
- "strict": true,
9
- "baseUrl": "."
8
+ "strict": true
10
9
  },
11
10
  "include": [
12
11
  "."
@@ -16,5 +15,8 @@
16
15
  ".github",
17
16
  ".husky",
18
17
  "test"
18
+ ],
19
+ "types": [
20
+ "node"
19
21
  ]
20
22
  }