@modernpoacher/deps 2.2.34 → 2.2.35
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/node/execute.mjs +22 -6
- package/package.json +1 -1
package/bin/node/execute.mjs
CHANGED
|
@@ -249,14 +249,19 @@ async function toMessage (message, directory) {
|
|
|
249
249
|
* @param {string | undefined} v
|
|
250
250
|
* @returns {boolean}
|
|
251
251
|
*/
|
|
252
|
-
|
|
252
|
+
export function filterDeps (v) { // de-falsy
|
|
253
|
+
return Boolean(v)
|
|
254
|
+
}
|
|
253
255
|
|
|
254
256
|
/**
|
|
255
257
|
* @param {string[]} a
|
|
256
258
|
* @param {string} v
|
|
257
259
|
* @returns {string[]}
|
|
258
260
|
*/
|
|
259
|
-
|
|
261
|
+
export function reduceDeps (a, v = '') { // de-dupe
|
|
262
|
+
if (!a.includes(v)) a.push(v)
|
|
263
|
+
return a
|
|
264
|
+
}
|
|
260
265
|
|
|
261
266
|
/**
|
|
262
267
|
* @param {string[]} directories
|
|
@@ -282,6 +287,15 @@ async function getPathList (directory) {
|
|
|
282
287
|
)
|
|
283
288
|
}
|
|
284
289
|
|
|
290
|
+
/**
|
|
291
|
+
* @param {string} alpha
|
|
292
|
+
* @param {string} omega
|
|
293
|
+
* @returns {number}
|
|
294
|
+
*/
|
|
295
|
+
function sort (alpha, omega) {
|
|
296
|
+
return alpha.localeCompare(omega)
|
|
297
|
+
}
|
|
298
|
+
|
|
285
299
|
/**
|
|
286
300
|
* @param {Array<string | undefined>} [directories]
|
|
287
301
|
* @returns {Promise<string[]>}
|
|
@@ -291,12 +305,13 @@ async function getDepsList (directories = []) {
|
|
|
291
305
|
|
|
292
306
|
/**
|
|
293
307
|
* Transform `directories` to create `alpha`
|
|
308
|
+
* @type {string[]}
|
|
294
309
|
*/
|
|
295
310
|
const alpha = (
|
|
296
311
|
directories
|
|
297
|
-
.filter(
|
|
312
|
+
.filter(Boolean)
|
|
298
313
|
.reduce(reduceDeps, [])
|
|
299
|
-
.sort()
|
|
314
|
+
.sort(sort)
|
|
300
315
|
)
|
|
301
316
|
|
|
302
317
|
try {
|
|
@@ -313,12 +328,13 @@ async function getDepsList (directories = []) {
|
|
|
313
328
|
|
|
314
329
|
/**
|
|
315
330
|
* Transform `directories` to create `omega`
|
|
331
|
+
* @type {string[]}
|
|
316
332
|
*/
|
|
317
333
|
const omega = (
|
|
318
334
|
directories
|
|
319
|
-
.filter(
|
|
335
|
+
.filter(Boolean)
|
|
320
336
|
.reduce(reduceDeps, [])
|
|
321
|
-
.sort()
|
|
337
|
+
.sort(sort)
|
|
322
338
|
)
|
|
323
339
|
|
|
324
340
|
return omega
|