@modernpoacher/deps 2.3.0 → 2.3.2
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 +9 -6
- package/package.json +6 -5
- package/src/common/format/index.mjs +3 -3
- package/src/common/git/index.mjs +19 -18
- package/tsconfig.json +4 -4
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 {
|
|
@@ -162,6 +163,7 @@ export function handleComplete (e) {
|
|
|
162
163
|
|
|
163
164
|
/**
|
|
164
165
|
* @param {{ code?: number, message?: string }} e
|
|
166
|
+
* @returns {void}
|
|
165
167
|
*/
|
|
166
168
|
function handlePackageError ({ message = MESSAGE }) {
|
|
167
169
|
error(`Package error: "${message}"`)
|
|
@@ -169,30 +171,31 @@ function handlePackageError ({ message = MESSAGE }) {
|
|
|
169
171
|
|
|
170
172
|
/**
|
|
171
173
|
* @param {{ code?: number, message?: string }} e
|
|
174
|
+
* @returns {void}
|
|
172
175
|
*/
|
|
173
176
|
function handleConfigurationError ({ message = MESSAGE }) {
|
|
174
177
|
error(`Configuration error: "${message}"`)
|
|
175
178
|
}
|
|
176
179
|
|
|
177
180
|
/**
|
|
178
|
-
*
|
|
179
|
-
*
|
|
181
|
+
* @param {string} directory
|
|
182
|
+
* @returns {string}
|
|
180
183
|
*/
|
|
181
184
|
function getPackageJsonPath (directory = DIRECTORY) {
|
|
182
185
|
return resolve(join(directory, 'package.json'))
|
|
183
186
|
}
|
|
184
187
|
|
|
185
188
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
189
|
+
* @param {string} directory
|
|
190
|
+
* @returns {string}
|
|
188
191
|
*/
|
|
189
192
|
function getDepsRcPath (directory = DIRECTORY) {
|
|
190
193
|
return resolve(join(directory, '.depsrc'))
|
|
191
194
|
}
|
|
192
195
|
|
|
193
196
|
/**
|
|
194
|
-
*
|
|
195
|
-
*
|
|
197
|
+
* @param {string} directory
|
|
198
|
+
* @returns {string}
|
|
196
199
|
*/
|
|
197
200
|
function getDepsRcJsonPath (directory = DIRECTORY) {
|
|
198
201
|
return resolve(join(directory, '.depsrc.json'))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modernpoacher/deps",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Update NPM package dependencies from the command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deps",
|
|
@@ -40,6 +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 || true",
|
|
43
44
|
"start": "npm run deps",
|
|
44
45
|
"test": "cross-env NODE_OPTIONS=--disable-warning=ExperimentalWarning DEBUG_COLORS=yes NODE_ENV=test mocha test --recursive --verbose --color"
|
|
45
46
|
},
|
|
@@ -65,13 +66,13 @@
|
|
|
65
66
|
"@types/chai": "^5.2.3",
|
|
66
67
|
"@types/debug": "^4.1.13",
|
|
67
68
|
"@types/mocha": "^10.0.10",
|
|
68
|
-
"@types/node": "^
|
|
69
|
-
"@typescript-eslint/parser": "^8.
|
|
69
|
+
"@types/node": "^26.1.1",
|
|
70
|
+
"@typescript-eslint/parser": "^8.64.0",
|
|
70
71
|
"chai": "^6.2.2",
|
|
71
72
|
"cross-env": "^10.1.0",
|
|
72
73
|
"eslint": "9.38.0",
|
|
73
|
-
"eslint-plugin-jsdoc": "^63.0
|
|
74
|
-
"globals": "^17.
|
|
74
|
+
"eslint-plugin-jsdoc": "^63.2.0",
|
|
75
|
+
"globals": "^17.7.0",
|
|
75
76
|
"husky": "^9.1.7",
|
|
76
77
|
"mocha": "^11.7.6"
|
|
77
78
|
},
|
|
@@ -38,9 +38,9 @@ export function formatAuthor (name, email) {
|
|
|
38
38
|
* @type {(directory: string) => string}
|
|
39
39
|
*/
|
|
40
40
|
export const formatDirectory = PLATFORM === 'win32'
|
|
41
|
-
? (directory) => resolve(normalize(directory
|
|
41
|
+
? (directory) => resolve(normalize(directory.trim()))
|
|
42
42
|
: (directory) => {
|
|
43
|
-
const d = resolve(normalize(directory
|
|
43
|
+
const d = resolve(normalize(directory.trim()))
|
|
44
44
|
if (d.startsWith(HOME)) return d.replace(new RegExp('^' + HOME), '~')
|
|
45
45
|
return d
|
|
46
46
|
}
|
|
@@ -108,7 +108,7 @@ export function use (key) {
|
|
|
108
108
|
* @returns {void}
|
|
109
109
|
*/
|
|
110
110
|
function write (v) {
|
|
111
|
-
if (v.trim()) log(v.trimEnd())
|
|
111
|
+
if (v.trim()) log(formatDirectory(v.trimEnd()))
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
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'
|
|
@@ -130,7 +131,7 @@ export function out (key, directory) {
|
|
|
130
131
|
* @returns {void}
|
|
131
132
|
*/
|
|
132
133
|
function write (v) {
|
|
133
|
-
if (v.trim()) log(v.trimEnd())
|
|
134
|
+
if (v.trim()) log(formatDirectory(v.trimEnd()))
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
return function out (value) {
|
|
@@ -167,7 +168,7 @@ export function err (key, directory) {
|
|
|
167
168
|
* @returns {void}
|
|
168
169
|
*/
|
|
169
170
|
function write (v) {
|
|
170
|
-
if (v.trim()) log(v.trimEnd())
|
|
171
|
+
if (v.trim()) log(formatDirectory(v.trimEnd()))
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
return function err (value) {
|
|
@@ -181,8 +182,8 @@ export function err (key, directory) {
|
|
|
181
182
|
* @function getErrorCode
|
|
182
183
|
* @description
|
|
183
184
|
* Get an error code from an error
|
|
184
|
-
* @param {{code?: number, message?: string}} e
|
|
185
|
-
* @returns {number}
|
|
185
|
+
* @param {{code?: string | number, message?: string}} e
|
|
186
|
+
* @returns {string | number}
|
|
186
187
|
*/
|
|
187
188
|
const getErrorCode = ({ code = 0 }) => code
|
|
188
189
|
|
|
@@ -190,7 +191,7 @@ const getErrorCode = ({ code = 0 }) => code
|
|
|
190
191
|
* @function getErrorMessage
|
|
191
192
|
* @description
|
|
192
193
|
* Get an error message from an error
|
|
193
|
-
* @param {{code?: number, message?: string}} e
|
|
194
|
+
* @param {{code?: string | number, message?: string}} e
|
|
194
195
|
* @returns {string}
|
|
195
196
|
*/
|
|
196
197
|
const getErrorMessage = ({ message = '' }) => message
|
|
@@ -199,7 +200,7 @@ const getErrorMessage = ({ message = '' }) => message
|
|
|
199
200
|
* @function isCommandError
|
|
200
201
|
* @description
|
|
201
202
|
* Determine whether an error is a safe non-zero exit from a Git command
|
|
202
|
-
* @param {{code?: number, message?: string}} e
|
|
203
|
+
* @param {{code?: string | number, message?: string}} e
|
|
203
204
|
* @returns {boolean}
|
|
204
205
|
*/
|
|
205
206
|
function isCommandError (e) {
|
|
@@ -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
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
"allowJs": true,
|
|
6
6
|
"checkJs": true,
|
|
7
7
|
"noEmit": true,
|
|
8
|
-
"strict": true
|
|
8
|
+
"strict": true,
|
|
9
|
+
"types": [
|
|
10
|
+
"node"
|
|
11
|
+
]
|
|
9
12
|
},
|
|
10
13
|
"include": [
|
|
11
14
|
"."
|
|
@@ -15,8 +18,5 @@
|
|
|
15
18
|
".github",
|
|
16
19
|
".husky",
|
|
17
20
|
"test"
|
|
18
|
-
],
|
|
19
|
-
"types": [
|
|
20
|
-
"node"
|
|
21
21
|
]
|
|
22
22
|
}
|