@modernpoacher/deps 2.2.38 → 2.2.39

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.
@@ -126,15 +126,15 @@ async function isHeadDefaultBranch (directory) {
126
126
  async function getIgnoreFromConfiguration (directory) {
127
127
  log('getIgnoreFromConfiguration')
128
128
 
129
- const CONFIGURATION = (
130
- await hasConfiguration(directory)
131
- ? await getConfiguration(directory)
132
- : {}
133
- )
129
+ if (await hasConfiguration(directory)) {
130
+ return (
131
+ getIgnore(
132
+ await getConfiguration(directory)
133
+ )
134
+ )
135
+ }
134
136
 
135
- return (
136
- getIgnore(CONFIGURATION)
137
- )
137
+ return false
138
138
  }
139
139
 
140
140
  /**
@@ -147,15 +147,15 @@ async function getIgnoreFromConfiguration (directory) {
147
147
  async function getAuthorFromConfiguration (directory) {
148
148
  log('getAuthorFromConfiguration')
149
149
 
150
- const CONFIGURATION = (
151
- await hasConfiguration(directory)
152
- ? await getConfiguration(directory)
153
- : {}
154
- )
150
+ if (await hasConfiguration(directory)) {
151
+ return (
152
+ getAuthor(
153
+ await getConfiguration(directory)
154
+ )
155
+ )
156
+ }
155
157
 
156
- return (
157
- getAuthor(CONFIGURATION)
158
- )
158
+ return null
159
159
  }
160
160
 
161
161
  /**
@@ -168,13 +168,11 @@ async function getAuthorFromConfiguration (directory) {
168
168
  async function getAuthorFromGit (directory) {
169
169
  log('getAuthorFromGitConfig')
170
170
 
171
- const GIT = {
172
- name: await gitConfigUserName(directory),
173
- email: await gitConfigUserEmail(directory)
174
- }
175
-
176
171
  return (
177
- getAuthor(GIT)
172
+ getAuthor({
173
+ name: await gitConfigUserName(directory),
174
+ email: await gitConfigUserEmail(directory)
175
+ })
178
176
  )
179
177
  }
180
178
 
@@ -188,15 +186,15 @@ async function getAuthorFromGit (directory) {
188
186
  async function getAuthorFromPackage (directory) {
189
187
  log('getAuthorFromPackage')
190
188
 
191
- const PACKAGE = (
192
- await hasPackage(directory)
193
- ? await getPackage(directory)
194
- : {}
195
- )
189
+ if (await hasPackage(directory)) {
190
+ return (
191
+ getAuthor(
192
+ await getPackage(directory)
193
+ )
194
+ )
195
+ }
196
196
 
197
- return (
198
- getAuthor(PACKAGE)
199
- )
197
+ return null
200
198
  }
201
199
 
202
200
  /**
@@ -209,15 +207,15 @@ async function getAuthorFromPackage (directory) {
209
207
  async function getMessageFromConfiguration (directory) {
210
208
  log('getMessageFromConfiguration')
211
209
 
212
- const CONFIGURATION = (
213
- await hasConfiguration(directory)
214
- ? await getConfiguration(directory)
215
- : {}
216
- )
210
+ if (await hasConfiguration(directory)) {
211
+ return (
212
+ getMessage(
213
+ await getConfiguration(directory)
214
+ )
215
+ )
216
+ }
217
217
 
218
- return (
219
- getMessage(CONFIGURATION)
220
- )
218
+ return null
221
219
  }
222
220
 
223
221
  /**
@@ -226,7 +224,7 @@ async function getMessageFromConfiguration (directory) {
226
224
  * Ensures that the `author` is set either from the command line,
227
225
  * configuration, package, or a default
228
226
  *
229
- * Since it can be null `author` may not default in function arguments
227
+ * Since it can be null `author` will not default in function arguments
230
228
  * @param {string | { name: string; email: string }} author
231
229
  * @param {string} directory
232
230
  * @returns {Promise<string | { name: string; email: string }>}
@@ -241,7 +239,7 @@ async function toAuthor (author, directory) {
241
239
  * Ensures that the `message` is set either from the command line,
242
240
  * configuration, or a default
243
241
  *
244
- * Since it can be null `message` may not default in function arguments
242
+ * Since it can be null `message` will not default in function arguments
245
243
  * @param {string | null} message
246
244
  * @param {string} directory
247
245
  * @returns {Promise<string>}
@@ -251,21 +249,21 @@ async function toMessage (message, directory) {
251
249
  }
252
250
 
253
251
  /**
252
+ * @type {(v: string | undefined) => v is string}
254
253
  * @param {string | undefined} v
255
254
  * @returns {boolean}
256
255
  */
257
- export function filterDeps (v) { // de-falsy
256
+ function filter (v) { // de-falsy
258
257
  return Boolean(v)
259
258
  }
260
259
 
261
260
  /**
262
- * @param {string[]} a
263
- * @param {string} v
264
- * @returns {string[]}
261
+ * @param {string} alpha
262
+ * @param {string} omega
263
+ * @returns {number}
265
264
  */
266
- export function reduceDeps (a, v = '') { // de-dupe
267
- if (!a.includes(v)) a.push(v)
268
- return a
265
+ function sort (alpha, omega) {
266
+ return alpha.localeCompare(omega)
269
267
  }
270
268
 
271
269
  /**
@@ -288,21 +286,12 @@ async function getPathList (directory) {
288
286
  return (
289
287
  array
290
288
  .map(dirname)
291
- .sort()
289
+ .sort(sort)
292
290
  )
293
291
  }
294
292
 
295
293
  /**
296
- * @param {string} alpha
297
- * @param {string} omega
298
- * @returns {number}
299
- */
300
- function sort (alpha, omega) {
301
- return alpha.localeCompare(omega)
302
- }
303
-
304
- /**
305
- * @param {Array<string | undefined>} [directories]
294
+ * @param {(string | undefined)[]} [directories]
306
295
  * @returns {Promise<string[]>}
307
296
  */
308
297
  async function getDepsList (directories = []) {
@@ -313,16 +302,15 @@ async function getDepsList (directories = []) {
313
302
  * @type {string[]}
314
303
  */
315
304
  const alpha = (
316
- directories
317
- .filter(Boolean)
318
- .reduce(reduceDeps, [])
305
+ Array.from(new Set(directories))
306
+ .filter(filter)
319
307
  .sort(sort)
320
308
  )
321
309
 
322
310
  try {
323
311
  /**
324
312
  * Recreate `directories` from `alpha`
325
- * @type {Array<string | undefined>}
313
+ * @type {(string | undefined)[]}
326
314
  */
327
315
  const directories = (
328
316
  await Promise.all(
@@ -336,9 +324,8 @@ async function getDepsList (directories = []) {
336
324
  * @type {string[]}
337
325
  */
338
326
  const omega = (
339
- directories
340
- .filter(Boolean)
341
- .reduce(reduceDeps, [])
327
+ Array.from(new Set(directories))
328
+ .filter(filter)
342
329
  .sort(sort)
343
330
  )
344
331
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modernpoacher/deps",
3
- "version": "2.2.38",
3
+ "version": "2.2.39",
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.14",
57
+ "@sequencemedia/write": "^0.2.15",
58
58
  "commander": "^14.0.1",
59
59
  "debug": "^4.4.3",
60
60
  "glob": "^11.0.3",
@@ -62,8 +62,8 @@
62
62
  "supports-color": "^10.2.2"
63
63
  },
64
64
  "devDependencies": {
65
- "@sequencemedia/eslint-config-standard": "^0.2.88",
66
- "@sequencemedia/eslint-config-typescript": "^0.1.150",
65
+ "@sequencemedia/eslint-config-standard": "^0.2.89",
66
+ "@sequencemedia/eslint-config-typescript": "^0.1.151",
67
67
  "@sequencemedia/eslint-merge": "^0.0.54",
68
68
  "@types/chai": "^5.2.2",
69
69
  "@types/debug": "^4.1.12",
@@ -73,7 +73,7 @@
73
73
  "chai": "^6.2.0",
74
74
  "cross-env": "^10.1.0",
75
75
  "eslint": "^9.37.0",
76
- "eslint-plugin-jsdoc": "^60.7.1",
76
+ "eslint-plugin-jsdoc": "^60.8.0",
77
77
  "globals": "^16.4.0",
78
78
  "husky": "^9.1.7",
79
79
  "mocha": "^11.7.4"