@modernpoacher/deps 2.1.6 → 2.1.9
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 +10 -5
- package/bin/deps/execute.mjs +7 -19
- package/package.json +1 -1
package/bin/common/index.mjs
CHANGED
|
@@ -95,19 +95,24 @@ export function use (key) {
|
|
|
95
95
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
96
96
|
|
|
97
97
|
return function use (v) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
if (v.includes('\n')) v.split('\n').map((s) => trim(s)).filter(Boolean).forEach((s) => log(s))
|
|
99
|
+
else {
|
|
100
|
+
const s = v.trim()
|
|
101
|
+
if (s !== '') log(trim(s))
|
|
102
|
+
}
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
export function handleError (e = {}) {
|
|
105
107
|
const {
|
|
106
|
-
code = CODE
|
|
107
|
-
message = MESSAGE
|
|
108
|
+
code = CODE
|
|
108
109
|
} = e
|
|
109
110
|
|
|
110
111
|
if (code > 1) error(code)
|
|
112
|
+
const {
|
|
113
|
+
message = MESSAGE
|
|
114
|
+
} = e
|
|
115
|
+
|
|
111
116
|
error(message)
|
|
112
117
|
}
|
|
113
118
|
|
package/bin/deps/execute.mjs
CHANGED
|
@@ -67,15 +67,7 @@ function handleCommandError (e) {
|
|
|
67
67
|
code = 0
|
|
68
68
|
} = e
|
|
69
69
|
|
|
70
|
-
if (code !== 128)
|
|
71
|
-
const {
|
|
72
|
-
message
|
|
73
|
-
} = e
|
|
74
|
-
|
|
75
|
-
const log = debug('@modernpoacher/deps:error')
|
|
76
|
-
if (code > 1) log(code)
|
|
77
|
-
log(message)
|
|
78
|
-
}
|
|
70
|
+
if (code !== 128) handleError(e)
|
|
79
71
|
}
|
|
80
72
|
|
|
81
73
|
async function getDefaultBranch (directory) {
|
|
@@ -230,6 +222,10 @@ const filterDeps = (v) => !!v // de-falsy
|
|
|
230
222
|
|
|
231
223
|
const reduceDeps = (a, v) => a.includes(v) ? a : a.concat(v) // de-dupe
|
|
232
224
|
|
|
225
|
+
function * genDirsList (directories = []) {
|
|
226
|
+
while (directories.length) yield directories.shift()
|
|
227
|
+
}
|
|
228
|
+
|
|
233
229
|
function getPathList (directory) {
|
|
234
230
|
log('getPathList')
|
|
235
231
|
|
|
@@ -280,7 +276,7 @@ async function mapRevParseShowTopLevel (directory) {
|
|
|
280
276
|
}
|
|
281
277
|
}
|
|
282
278
|
|
|
283
|
-
async function iterate (
|
|
279
|
+
async function iterate (directory, registry, force, message, author) {
|
|
284
280
|
log('iterate')
|
|
285
281
|
|
|
286
282
|
if (directory) {
|
|
@@ -300,10 +296,6 @@ async function iterate ([directory, ...directories] = [], registry, force, messa
|
|
|
300
296
|
handleCommandError(e)
|
|
301
297
|
}
|
|
302
298
|
}
|
|
303
|
-
|
|
304
|
-
if (directories.length) {
|
|
305
|
-
await iterate(directories, registry, force, message, author)
|
|
306
|
-
}
|
|
307
299
|
}
|
|
308
300
|
|
|
309
301
|
async function iteratePath (directory, registry, force, message, author) {
|
|
@@ -317,11 +309,7 @@ async function iteratePath (directory, registry, force, message, author) {
|
|
|
317
309
|
if (pathList.length) {
|
|
318
310
|
const depsList = await getDepsList(pathList)
|
|
319
311
|
|
|
320
|
-
|
|
321
|
-
return (
|
|
322
|
-
await iterate(depsList, registry, force, message, author)
|
|
323
|
-
)
|
|
324
|
-
}
|
|
312
|
+
for (const d of genDirsList(depsList)) await iterate(d, registry, force, message, author)
|
|
325
313
|
}
|
|
326
314
|
}
|
|
327
315
|
}
|