@modernpoacher/deps 2.2.32 → 2.2.34

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.
@@ -16,8 +16,6 @@
16
16
  * @returns {void}
17
17
  */
18
18
 
19
- import stripAnsi from 'strip-ansi'
20
-
21
19
  import {
22
20
  argv
23
21
  } from 'node:process'
@@ -49,6 +47,12 @@ import {
49
47
  BIN
50
48
  } from '#deps/src/common/env'
51
49
 
50
+ import {
51
+ toHomeDir,
52
+ use,
53
+ tidy
54
+ } from '#deps/src/common/format'
55
+
52
56
  import {
53
57
  getOptions
54
58
  } from '#deps/src/common/options'
@@ -76,33 +80,8 @@ const CODE = 0
76
80
 
77
81
  const MESSAGE = 'Either no error message has been defined or no error has been supplied'
78
82
 
79
- const LF = String.fromCodePoint(10)
80
83
  const SP = String.fromCodePoint(32)
81
84
 
82
- /**
83
- * @param {string} v
84
- * @returns {string}
85
- */
86
- export function trim (v) {
87
- return v.split(LF).map(trimEnd).join(LF).trim()
88
- }
89
-
90
- /**
91
- * @param {string} v
92
- * @returns {string}
93
- */
94
- export function trimEnd (v) {
95
- return v.trimEnd()
96
- }
97
-
98
- /**
99
- * @param {string} v
100
- * @returns {string}
101
- */
102
- export function tidy (v) {
103
- return v.replace(/\n{2,}}/gm, LF).trim()
104
- }
105
-
106
85
  const getRmrfCommands = PLATFORM === 'win32'
107
86
  ? () => tidy(`
108
87
  rmdir /s /q node_modules 2> nul & del package-lock.json 2> nul
@@ -155,40 +134,6 @@ export const ARGS = PLATFORM === 'win32'
155
134
  ? ARGV.map(toDouble).join(SP)
156
135
  : ARGV.map(toSingle).join(SP)
157
136
 
158
- /**
159
- * @param {string} v
160
- * @returns {boolean}
161
- */
162
- function filter (v) {
163
- return Boolean(stripAnsi(v).trim())
164
- }
165
-
166
- /**
167
- * @param {string} key
168
- * @returns {(value: string) => void}
169
- */
170
- export function use (key) {
171
- const log = debug(`@modernpoacher/deps:${key}`)
172
-
173
- /**
174
- * @param {string} v
175
- * @returns {void}
176
- */
177
- function write (v) {
178
- log(v.trimEnd())
179
- }
180
-
181
- /**
182
- * @param {string} value
183
- * @returns {void}
184
- */
185
- return function use (value) {
186
- value.split(LF)
187
- .filter(filter)
188
- .forEach(write)
189
- }
190
- }
191
-
192
137
  /**
193
138
  * @param {{ code?: number, message?: string }} [e]
194
139
  */
@@ -218,14 +163,14 @@ export function handleComplete (e) {
218
163
  * @param {{ code?: number, message?: string }} e
219
164
  */
220
165
  function handlePackageError ({ message = MESSAGE }) {
221
- info(`Package error: "${message}"`)
166
+ error(`Package error: "${message}"`)
222
167
  }
223
168
 
224
169
  /**
225
170
  * @param {{ code?: number, message?: string }} e
226
171
  */
227
172
  function handleConfigurationError ({ message = MESSAGE }) {
228
- info(`Configuration error: "${message}"`)
173
+ error(`Configuration error: "${message}"`)
229
174
  }
230
175
 
231
176
  /**
@@ -295,7 +240,7 @@ async function getDepsRcJson (directory = DIRECTORY) {
295
240
  async function hasPackage (directory = DIRECTORY) {
296
241
  log('hasPackage')
297
242
 
298
- info(`Directory is "${directory}"`)
243
+ info(`Directory is "${toHomeDir(directory)}"`)
299
244
 
300
245
  try {
301
246
  await access(getPackageJsonPath(directory), constants.R_OK)
@@ -315,7 +260,7 @@ async function hasPackage (directory = DIRECTORY) {
315
260
  async function getPackage (directory = DIRECTORY) {
316
261
  log('getPackage')
317
262
 
318
- info(`Directory is "${directory}"`)
263
+ info(`Directory is "${toHomeDir(directory)}"`)
319
264
 
320
265
  try {
321
266
  return await getPackageJson(directory)
@@ -332,7 +277,7 @@ async function getPackage (directory = DIRECTORY) {
332
277
  async function hasConfiguration (directory = DIRECTORY) {
333
278
  log('hasConfiguration')
334
279
 
335
- info(`Directory is "${directory}"`)
280
+ info(`Directory is "${toHomeDir(directory)}"`)
336
281
 
337
282
  try {
338
283
  await access(getDepsRcPath(directory), constants.R_OK)
@@ -375,7 +320,7 @@ async function hasConfiguration (directory = DIRECTORY) {
375
320
  async function getConfiguration (directory = DIRECTORY) {
376
321
  log('getConfiguration')
377
322
 
378
- info(`Directory is "${directory}"`)
323
+ info(`Directory is "${toHomeDir(directory)}"`)
379
324
 
380
325
  try {
381
326
  return await getDepsRc(directory)
package/bin/node/deps.mjs CHANGED
@@ -8,6 +8,10 @@ import '#deps/src/common/write'
8
8
 
9
9
  import '#deps/src/common/debug'
10
10
 
11
+ import {
12
+ use
13
+ } from '#deps/src/common/format'
14
+
11
15
  import {
12
16
  getOptions
13
17
  } from '#deps/src/common/options'
@@ -15,7 +19,6 @@ import {
15
19
  import {
16
20
  DEPS,
17
21
  ARGS,
18
- use,
19
22
  handleComplete
20
23
  } from '#deps/bin/common'
21
24
 
@@ -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,
@@ -411,7 +415,7 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
411
415
  log('execute')
412
416
 
413
417
  try {
414
- info(`Directory is "${directory}"`)
418
+ info(`Directory is "${toHomeDir(directory)}"`)
415
419
  info(`Registry is "${registry}"`)
416
420
  info(`Force is "${force}"`)
417
421
  info(`Message is "${message}"`)
package/bin/node/head.mjs CHANGED
@@ -8,6 +8,10 @@ import '#deps/src/common/write'
8
8
 
9
9
  import '#deps/src/common/debug'
10
10
 
11
+ import {
12
+ use
13
+ } from '#deps/src/common/format'
14
+
11
15
  import {
12
16
  getOptions
13
17
  } from '#deps/src/common/options'
@@ -15,7 +19,6 @@ import {
15
19
  import {
16
20
  HEAD,
17
21
  ARGS,
18
- use,
19
22
  handleComplete
20
23
  } from '#deps/bin/common'
21
24
 
package/bin/node/push.mjs CHANGED
@@ -8,6 +8,10 @@ import '#deps/src/common/write'
8
8
 
9
9
  import '#deps/src/common/debug'
10
10
 
11
+ import {
12
+ use
13
+ } from '#deps/src/common/format'
14
+
11
15
  import {
12
16
  getOptions
13
17
  } from '#deps/src/common/options'
@@ -15,7 +19,6 @@ import {
15
19
  import {
16
20
  PUSH,
17
21
  ARGS,
18
- use,
19
22
  handleComplete
20
23
  } from '#deps/bin/common'
21
24
 
package/bin/node/wipe.mjs CHANGED
@@ -8,6 +8,10 @@ import '#deps/src/common/write'
8
8
 
9
9
  import '#deps/src/common/debug'
10
10
 
11
+ import {
12
+ use
13
+ } from '#deps/src/common/format'
14
+
11
15
  import {
12
16
  getOptions
13
17
  } from '#deps/src/common/options'
@@ -15,7 +19,6 @@ import {
15
19
  import {
16
20
  WIPE,
17
21
  ARGS,
18
- use,
19
22
  handleComplete
20
23
  } from '#deps/bin/common'
21
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "2.2.32",
3
+ "version": "2.2.34",
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.9",
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.85",
66
- "@sequencemedia/eslint-config-typescript": "^0.1.146",
67
- "@sequencemedia/eslint-merge": "^0.0.52",
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.5.2",
72
- "@typescript-eslint/parser": "^8.44.1",
73
- "chai": "^6.0.1",
74
- "cross-env": "^10.0.0",
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.1.1",
76
+ "eslint-plugin-jsdoc": "^60.7.1",
77
77
  "globals": "^16.4.0",
78
78
  "husky": "^9.1.7",
79
- "mocha": "^11.7.2"
79
+ "mocha": "^11.7.4"
80
80
  },
81
81
  "imports": {
82
82
  "#deps/bin": "./bin/index.mjs",
@@ -1,15 +1,33 @@
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
 
5
- const LF = String.fromCodePoint(32)
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
+
23
+ const LF = String.fromCodePoint(10)
6
24
 
7
25
  /**
8
26
  * @param {string} v
9
27
  * @returns {string}
10
28
  */
11
- export function tidy (v) {
12
- return v.replace(/\n{2,}}/gm, LF).trim()
29
+ export function trim (v) {
30
+ return v.split(LF).map(trimEnd).join(LF).trim()
13
31
  }
14
32
 
15
33
  /**
@@ -24,8 +42,8 @@ export function trimEnd (v) {
24
42
  * @param {string} v
25
43
  * @returns {string}
26
44
  */
27
- export function trim (v) {
28
- return v.split(LF).map(trimEnd).join(LF).trim()
45
+ export function tidy (v) {
46
+ return v.replace(/\n{2,}}/gm, LF).trim()
29
47
  }
30
48
 
31
49
  /**
@@ -27,6 +27,11 @@ import {
27
27
  PLATFORM
28
28
  } from '#deps/src/common/env'
29
29
 
30
+ import {
31
+ use,
32
+ trim
33
+ } from '#deps/src/common/format'
34
+
30
35
  import {
31
36
  getOptions
32
37
  } from '#deps/src/common/options'
@@ -73,30 +78,6 @@ log(`\`common/git\` (${VERSION} - ${PLATFORM}) is awake`)
73
78
 
74
79
  const LF = String.fromCodePoint(10)
75
80
 
76
- /**
77
- * @param {string} v
78
- * @returns {string}
79
- */
80
- export function trim (v) {
81
- return v.split(LF).map(trimEnd).join(LF).trim()
82
- }
83
-
84
- /**
85
- * @param {string} v
86
- * @returns {string}
87
- */
88
- export function trimEnd (v) {
89
- return v.trimEnd()
90
- }
91
-
92
- /**
93
- * @param {string} v
94
- * @returns {string}
95
- */
96
- export function tidy (v) {
97
- return v.replace(/\n{2,}}/gm, LF).trim()
98
- }
99
-
100
81
  /**
101
82
  * @param {string} v
102
83
  * @returns {boolean}
@@ -123,32 +104,6 @@ function isFatal (v) {
123
104
  return v.toLowerCase().startsWith('fatal: not a git repository')
124
105
  }
125
106
 
126
- /**
127
- * @param {string} key
128
- * @returns {(value: string) => void}
129
- */
130
- export function use (key) {
131
- const log = debug(`@modernpoacher/deps:${key}`)
132
-
133
- /**
134
- * @param {string} v
135
- * @returns {void}
136
- */
137
- function write (v) {
138
- log(v.trimEnd())
139
- }
140
-
141
- /**
142
- * @param {string} value
143
- * @returns {void}
144
- */
145
- return function use (value) {
146
- value.split(LF)
147
- .filter(filter)
148
- .forEach(write)
149
- }
150
- }
151
-
152
107
  /**
153
108
  * @param {string} key
154
109
  * @param {string} directory
@@ -13,6 +13,10 @@ import PATH from '#where-am-i'
13
13
 
14
14
  import debug from '#deps/src/common/debug'
15
15
 
16
+ import {
17
+ tidy
18
+ } from '#deps/src/common/format'
19
+
16
20
  import {
17
21
  VERSION,
18
22
  PLATFORM
@@ -30,33 +34,8 @@ const log = debug('@modernpoacher/deps')
30
34
 
31
35
  log(`\`common\` (${VERSION} - ${PLATFORM}) is awake`)
32
36
 
33
- const LF = String.fromCodePoint(10)
34
37
  const SP = String.fromCodePoint(32)
35
38
 
36
- /**
37
- * @param {string} v
38
- * @returns {string}
39
- */
40
- export function trim (v) {
41
- return v.split(LF).map(trimEnd).join(LF).trim()
42
- }
43
-
44
- /**
45
- * @param {string} v
46
- * @returns {string}
47
- */
48
- export function trimEnd (v) {
49
- return v.trimEnd()
50
- }
51
-
52
- /**
53
- * @param {string} v
54
- * @returns {string}
55
- */
56
- export function tidy (v) {
57
- return v.replace(/\n{2,}}/gm, LF).trim()
58
- }
59
-
60
39
  /**
61
40
  * @function getSaveProdParameter
62
41
  * @description
package/src/index.mjs CHANGED
@@ -19,8 +19,6 @@
19
19
  * @returns {void}
20
20
  */
21
21
 
22
- import stripAnsi from 'strip-ansi'
23
-
24
22
  import {
25
23
  normalize
26
24
  } from 'node:path'
@@ -36,6 +34,11 @@ import {
36
34
  PLATFORM
37
35
  } from '#deps/src/common/env'
38
36
 
37
+ import {
38
+ toHomeDir,
39
+ use
40
+ } from '#deps/src/common/format'
41
+
39
42
  import {
40
43
  getOptions
41
44
  } from '#deps/src/common/options'
@@ -62,42 +65,6 @@ const info = debug('@modernpoacher/deps:info')
62
65
 
63
66
  log(`\`deps\` (${VERSION} - ${PLATFORM}) is awake`)
64
67
 
65
- const LF = String.fromCodePoint(10)
66
-
67
- /**
68
- * @param {string} v
69
- * @returns {boolean}
70
- */
71
- function filter (v) {
72
- return Boolean(stripAnsi(v).trim())
73
- }
74
-
75
- /**
76
- * @param {string} key
77
- * @returns {(value: string) => void}
78
- */
79
- export function use (key) {
80
- const log = debug(`@modernpoacher/deps:${key}`)
81
-
82
- /**
83
- * @param {string} v
84
- * @returns {void}
85
- */
86
- function write (v) {
87
- log(v.trimEnd())
88
- }
89
-
90
- /**
91
- * @param {string} value
92
- * @returns {void}
93
- */
94
- return function use (value) {
95
- value.split(LF)
96
- .filter(filter)
97
- .forEach(write)
98
- }
99
- }
100
-
101
68
  /**
102
69
  * @function getInstallSaveExactCommands
103
70
  * @description
@@ -283,7 +250,7 @@ export function installSaveBundleSaveExact (d, deps, r, f) {
283
250
 
284
251
  const directory = normalize(d.trim())
285
252
 
286
- info(`Directory is "${directory}"`)
253
+ info(`Directory is "${toHomeDir(directory)}"`)
287
254
 
288
255
  return (
289
256
  new Promise((resolve, reject) => {
@@ -330,7 +297,7 @@ export function installSaveBundle (d, deps, r, f) {
330
297
 
331
298
  const directory = normalize(d.trim())
332
299
 
333
- info(`Directory is "${directory}"`)
300
+ info(`Directory is "${toHomeDir(directory)}"`)
334
301
 
335
302
  return (
336
303
  new Promise((resolve, reject) => {
@@ -377,7 +344,7 @@ export function installSaveOptionalSaveExact (d, deps, r, f) {
377
344
 
378
345
  const directory = normalize(d.trim())
379
346
 
380
- info(`Directory is "${directory}"`)
347
+ info(`Directory is "${toHomeDir(directory)}"`)
381
348
 
382
349
  return (
383
350
  new Promise((resolve, reject) => {
@@ -424,7 +391,7 @@ export function installSaveOptional (d, deps, r, f) {
424
391
 
425
392
  const directory = normalize(d.trim())
426
393
 
427
- info(`Directory is "${directory}"`)
394
+ info(`Directory is "${toHomeDir(directory)}"`)
428
395
 
429
396
  return (
430
397
  new Promise((resolve, reject) => {
@@ -471,7 +438,7 @@ export function installSaveDevSaveExact (d, deps, r, f) {
471
438
 
472
439
  const directory = normalize(d.trim())
473
440
 
474
- info(`Directory is "${directory}"`)
441
+ info(`Directory is "${toHomeDir(directory)}"`)
475
442
 
476
443
  return (
477
444
  new Promise((resolve, reject) => {
@@ -518,7 +485,7 @@ export function installSaveDev (d, deps, r, f) {
518
485
 
519
486
  const directory = normalize(d.trim())
520
487
 
521
- info(`Directory is "${directory}"`)
488
+ info(`Directory is "${toHomeDir(directory)}"`)
522
489
 
523
490
  return (
524
491
  new Promise((resolve, reject) => {
@@ -565,7 +532,7 @@ export function installSaveProdSaveExact (d, deps, r, f) {
565
532
 
566
533
  const directory = normalize(d.trim())
567
534
 
568
- info(`Directory is "${directory}"`)
535
+ info(`Directory is "${toHomeDir(directory)}"`)
569
536
 
570
537
  return (
571
538
  new Promise((resolve, reject) => {
@@ -612,7 +579,7 @@ export function installSaveProd (d, deps, r, f) {
612
579
 
613
580
  const directory = normalize(d.trim())
614
581
 
615
- info(`Directory is "${directory}"`)
582
+ info(`Directory is "${toHomeDir(directory)}"`)
616
583
 
617
584
  return (
618
585
  new Promise((resolve, reject) => {
@@ -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) => {