@modernpoacher/deps 2.2.18 → 2.2.20
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 +162 -48
- package/bin/deps.mjs +10 -9
- package/bin/node/deps.mjs +5 -21
- package/bin/node/execute.mjs +152 -40
- package/bin/node/head.mjs +5 -21
- package/bin/node/install.mjs +9 -8
- package/bin/node/push.mjs +5 -21
- package/bin/node/wipe.mjs +5 -21
- package/eslint.config.mjs +103 -0
- package/index.d.mts +50 -0
- package/package.json +24 -18
- package/src/common/debug.mjs +2 -0
- package/src/common/env/index.mjs +5 -5
- package/src/common/git/index.mjs +230 -131
- package/src/common/index.mjs +79 -121
- package/src/common/options/index.mjs +14 -20
- package/src/index.mjs +178 -113
- package/src/install/index.mjs +49 -34
- package/tsconfig.json +20 -0
package/bin/node/execute.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import debug from 'debug'
|
|
4
|
-
|
|
5
3
|
import {
|
|
6
4
|
resolve,
|
|
7
5
|
dirname
|
|
@@ -15,7 +13,7 @@ import {
|
|
|
15
13
|
Command
|
|
16
14
|
} from 'commander'
|
|
17
15
|
|
|
18
|
-
import '#deps/src/common/debug'
|
|
16
|
+
import debug from '#deps/src/common/debug'
|
|
19
17
|
|
|
20
18
|
import {
|
|
21
19
|
VERSION,
|
|
@@ -56,10 +54,14 @@ import {
|
|
|
56
54
|
} from '#deps/bin/common'
|
|
57
55
|
|
|
58
56
|
const log = debug('@modernpoacher/deps')
|
|
57
|
+
const info = debug('@modernpoacher/deps:info')
|
|
59
58
|
|
|
60
59
|
log(`\`execute\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
/**
|
|
62
|
+
* @param {{ code?: number, message?: string }} [e]
|
|
63
|
+
*/
|
|
64
|
+
function handleCommandError (e = {}) {
|
|
63
65
|
const {
|
|
64
66
|
code = 0
|
|
65
67
|
} = e
|
|
@@ -67,6 +69,10 @@ function handleCommandError (e) {
|
|
|
67
69
|
if (code !== 128) handleError(e)
|
|
68
70
|
}
|
|
69
71
|
|
|
72
|
+
/**
|
|
73
|
+
* @param {string} directory
|
|
74
|
+
* @returns {Promise<string>}
|
|
75
|
+
*/
|
|
70
76
|
async function getDefaultBranch (directory) {
|
|
71
77
|
const branch = await catGitRefsRemotesOriginHead(directory)
|
|
72
78
|
if (branch) return branch
|
|
@@ -75,12 +81,20 @@ async function getDefaultBranch (directory) {
|
|
|
75
81
|
)
|
|
76
82
|
}
|
|
77
83
|
|
|
84
|
+
/**
|
|
85
|
+
* @param {string} directory
|
|
86
|
+
* @returns {Promise<string>}
|
|
87
|
+
*/
|
|
78
88
|
async function getCurrentBranch (directory) {
|
|
79
89
|
return (
|
|
80
90
|
await gitRevParseAbbrevRefHead(directory)
|
|
81
91
|
)
|
|
82
92
|
}
|
|
83
93
|
|
|
94
|
+
/**
|
|
95
|
+
* @param {string} directory
|
|
96
|
+
* @returns {Promise<boolean>}
|
|
97
|
+
*/
|
|
84
98
|
async function isHeadDefaultBranch (directory) {
|
|
85
99
|
const defaultBranch = await getDefaultBranch(directory)
|
|
86
100
|
const currentBranch = await getCurrentBranch(directory)
|
|
@@ -91,9 +105,8 @@ async function isHeadDefaultBranch (directory) {
|
|
|
91
105
|
|
|
92
106
|
/**
|
|
93
107
|
* @function getIgnoreFromConfiguration
|
|
94
|
-
*
|
|
108
|
+
* @description
|
|
95
109
|
* Interrogates `.depsrc` or `.depsrc.json` for an `ignore` value
|
|
96
|
-
*
|
|
97
110
|
* @param {string} directory
|
|
98
111
|
* @returns {Promise<boolean>}
|
|
99
112
|
*/
|
|
@@ -113,11 +126,10 @@ async function getIgnoreFromConfiguration (directory) {
|
|
|
113
126
|
|
|
114
127
|
/**
|
|
115
128
|
* @function getAuthorFromConfiguration
|
|
116
|
-
*
|
|
129
|
+
* @description
|
|
117
130
|
* Interrogates `.depsrc` or `.depsrc.json` for an `author` value
|
|
118
|
-
*
|
|
119
131
|
* @param {string} directory
|
|
120
|
-
* @returns {Promise<string|null>}
|
|
132
|
+
* @returns {Promise<string | null>}
|
|
121
133
|
*/
|
|
122
134
|
async function getAuthorFromConfiguration (directory) {
|
|
123
135
|
log('getAuthorFromConfiguration')
|
|
@@ -135,11 +147,10 @@ async function getAuthorFromConfiguration (directory) {
|
|
|
135
147
|
|
|
136
148
|
/**
|
|
137
149
|
* @function getAuthorFromPackage
|
|
138
|
-
*
|
|
150
|
+
* @description
|
|
139
151
|
* Interrogates `package.json` for an `author` value
|
|
140
|
-
*
|
|
141
152
|
* @param {string} directory
|
|
142
|
-
* @returns {Promise<string|null>}
|
|
153
|
+
* @returns {Promise<string | null>}
|
|
143
154
|
*/
|
|
144
155
|
async function getAuthorFromPackage (directory) {
|
|
145
156
|
log('getAuthorFromPackage')
|
|
@@ -157,11 +168,10 @@ async function getAuthorFromPackage (directory) {
|
|
|
157
168
|
|
|
158
169
|
/**
|
|
159
170
|
* @function getMessageFromConfiguration
|
|
160
|
-
*
|
|
171
|
+
* @description
|
|
161
172
|
* Interrogates `.depsrc` or `.depsrc.json` for a `message` value
|
|
162
|
-
*
|
|
163
173
|
* @param {string} directory
|
|
164
|
-
* @returns {Promise<string|null>}
|
|
174
|
+
* @returns {Promise<string | null>}
|
|
165
175
|
*/
|
|
166
176
|
async function getMessageFromConfiguration (directory) {
|
|
167
177
|
log('getMessageFromConfiguration')
|
|
@@ -179,15 +189,14 @@ async function getMessageFromConfiguration (directory) {
|
|
|
179
189
|
|
|
180
190
|
/**
|
|
181
191
|
* @function toAuthor
|
|
182
|
-
*
|
|
192
|
+
* @description
|
|
183
193
|
* Ensures that the `author` is set either from the command line,
|
|
184
194
|
* configuration, package, or a default
|
|
185
195
|
*
|
|
186
196
|
* Since it can be null `author` may not default in function arguments
|
|
187
|
-
*
|
|
188
|
-
* @param {string|null} author
|
|
197
|
+
* @param {string | { name: string; email: string }} author
|
|
189
198
|
* @param {string} directory
|
|
190
|
-
* @returns {Promise<string>}
|
|
199
|
+
* @returns {Promise<string | { name: string; email: string }>}
|
|
191
200
|
*/
|
|
192
201
|
async function toAuthor (author, directory) {
|
|
193
202
|
return author || await getAuthorFromConfiguration(directory) || await getAuthorFromPackage(directory) || AUTHOR
|
|
@@ -195,13 +204,12 @@ async function toAuthor (author, directory) {
|
|
|
195
204
|
|
|
196
205
|
/**
|
|
197
206
|
* @function toMessage
|
|
198
|
-
*
|
|
207
|
+
* @description
|
|
199
208
|
* Ensures that the `message` is set either from the command line,
|
|
200
209
|
* configuration, or a default
|
|
201
210
|
*
|
|
202
211
|
* Since it can be null `message` may not default in function arguments
|
|
203
|
-
*
|
|
204
|
-
* @param {string|null} message
|
|
212
|
+
* @param {string | null} message
|
|
205
213
|
* @param {string} directory
|
|
206
214
|
* @returns {Promise<string>}
|
|
207
215
|
*/
|
|
@@ -209,14 +217,31 @@ async function toMessage (message, directory) {
|
|
|
209
217
|
return message || await getMessageFromConfiguration(directory) || MESSAGE
|
|
210
218
|
}
|
|
211
219
|
|
|
212
|
-
|
|
220
|
+
/**
|
|
221
|
+
* @param {string | undefined} v
|
|
222
|
+
* @returns {boolean}
|
|
223
|
+
*/
|
|
224
|
+
const filterDeps = (v) => Boolean(v) // de-falsy
|
|
213
225
|
|
|
214
|
-
|
|
226
|
+
/**
|
|
227
|
+
* @param {string[]} a
|
|
228
|
+
* @param {string} v
|
|
229
|
+
* @returns {string[]}
|
|
230
|
+
*/
|
|
231
|
+
const reduceDeps = (a, v = '') => a.includes(v) ? a : a.concat(v) // de-dupe
|
|
215
232
|
|
|
233
|
+
/**
|
|
234
|
+
* @param {string[]} directories
|
|
235
|
+
* @yields {string | undefined}
|
|
236
|
+
*/
|
|
216
237
|
function * genDirsList (directories = []) {
|
|
217
238
|
while (directories.length) yield directories.shift()
|
|
218
239
|
}
|
|
219
240
|
|
|
241
|
+
/**
|
|
242
|
+
* @param {string} directory
|
|
243
|
+
* @returns {Promise<string[]>}
|
|
244
|
+
*/
|
|
220
245
|
async function getPathList (directory) {
|
|
221
246
|
log('getPathList')
|
|
222
247
|
|
|
@@ -229,9 +254,16 @@ async function getPathList (directory) {
|
|
|
229
254
|
)
|
|
230
255
|
}
|
|
231
256
|
|
|
257
|
+
/**
|
|
258
|
+
* @param {Array<string | undefined>} [directories]
|
|
259
|
+
* @returns {Promise<string[]>}
|
|
260
|
+
*/
|
|
232
261
|
async function getDepsList (directories = []) {
|
|
233
262
|
log('getDepsList')
|
|
234
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Transform `directories` to create `alpha`
|
|
266
|
+
*/
|
|
235
267
|
const alpha = (
|
|
236
268
|
directories
|
|
237
269
|
.filter(filterDeps)
|
|
@@ -240,19 +272,39 @@ async function getDepsList (directories = []) {
|
|
|
240
272
|
)
|
|
241
273
|
|
|
242
274
|
try {
|
|
243
|
-
|
|
275
|
+
/**
|
|
276
|
+
* Recreate `directories` from `alpha`
|
|
277
|
+
* @type {Array<string | undefined>}
|
|
278
|
+
*/
|
|
279
|
+
const directories = (
|
|
280
|
+
await Promise.all(
|
|
281
|
+
alpha
|
|
282
|
+
.map(mapRevParseShowTopLevel)
|
|
283
|
+
)
|
|
284
|
+
)
|
|
244
285
|
|
|
245
|
-
|
|
246
|
-
|
|
286
|
+
/**
|
|
287
|
+
* Transform `directories` to create `omega`
|
|
288
|
+
*/
|
|
289
|
+
const omega = (
|
|
290
|
+
directories
|
|
247
291
|
.filter(filterDeps)
|
|
248
292
|
.reduce(reduceDeps, [])
|
|
249
293
|
.sort()
|
|
250
294
|
)
|
|
295
|
+
|
|
296
|
+
return omega
|
|
251
297
|
} catch (e) {
|
|
252
|
-
handleError(e)
|
|
298
|
+
if (e instanceof Error) handleError(e)
|
|
253
299
|
}
|
|
300
|
+
|
|
301
|
+
return []
|
|
254
302
|
}
|
|
255
303
|
|
|
304
|
+
/**
|
|
305
|
+
* @param {string} directory
|
|
306
|
+
* @returns {Promise<string | undefined>}
|
|
307
|
+
*/
|
|
256
308
|
async function mapRevParseShowTopLevel (directory) {
|
|
257
309
|
log('mapRevParseShowTopLevel')
|
|
258
310
|
|
|
@@ -261,10 +313,18 @@ async function mapRevParseShowTopLevel (directory) {
|
|
|
261
313
|
await gitRevParseShowTopLevel(directory)
|
|
262
314
|
)
|
|
263
315
|
} catch (e) {
|
|
264
|
-
handleCommandError(e)
|
|
316
|
+
if (e instanceof Error) handleCommandError(e)
|
|
265
317
|
}
|
|
266
318
|
}
|
|
267
319
|
|
|
320
|
+
/**
|
|
321
|
+
* @param {string} directory
|
|
322
|
+
* @param {string} registry
|
|
323
|
+
* @param {boolean} force
|
|
324
|
+
* @param {string} message
|
|
325
|
+
* @param {string | { name: string; email: string }} author
|
|
326
|
+
* @returns {Promise<void>}
|
|
327
|
+
*/
|
|
268
328
|
async function iterate (directory, registry, force, message, author) {
|
|
269
329
|
log('iterate')
|
|
270
330
|
|
|
@@ -282,11 +342,18 @@ async function iterate (directory, registry, force, message, author) {
|
|
|
282
342
|
}
|
|
283
343
|
}
|
|
284
344
|
} catch (e) {
|
|
285
|
-
handleCommandError(e)
|
|
345
|
+
if (e instanceof Error) handleCommandError(e)
|
|
286
346
|
}
|
|
287
347
|
}
|
|
288
348
|
}
|
|
289
349
|
|
|
350
|
+
/**
|
|
351
|
+
* @param {string} directory
|
|
352
|
+
* @param {string} registry
|
|
353
|
+
* @param {boolean} force
|
|
354
|
+
* @param {string} message
|
|
355
|
+
* @param {string | { name: string; email: string }} author
|
|
356
|
+
*/
|
|
290
357
|
async function iteratePath (directory, registry, force, message, author) {
|
|
291
358
|
log('iteratePath')
|
|
292
359
|
|
|
@@ -299,17 +366,29 @@ async function iteratePath (directory, registry, force, message, author) {
|
|
|
299
366
|
const depsList = await getDepsList(pathList)
|
|
300
367
|
|
|
301
368
|
if (depsList.length) {
|
|
302
|
-
for (const d of genDirsList(depsList)) await iterate(d, registry, force, message, author)
|
|
369
|
+
for (const d of genDirsList(depsList)) if (d) await iterate(d, registry, force, message, author)
|
|
303
370
|
}
|
|
304
371
|
}
|
|
305
372
|
}
|
|
306
373
|
}
|
|
307
374
|
|
|
375
|
+
/**
|
|
376
|
+
* @param {string} directory
|
|
377
|
+
* @param {string} registry
|
|
378
|
+
* @param {boolean} force
|
|
379
|
+
* @param {string} message
|
|
380
|
+
* @param {string | { name: string; email: string }} author
|
|
381
|
+
* @returns {Promise<void>}
|
|
382
|
+
*/
|
|
308
383
|
async function execute (directory = DIRECTORY, registry = REGISTRY, force = false, message = MESSAGE, author = AUTHOR) {
|
|
309
384
|
log('execute')
|
|
310
385
|
|
|
311
386
|
try {
|
|
312
|
-
|
|
387
|
+
info(`Directory is "${directory}"`)
|
|
388
|
+
info(`Registry is "${registry}"`)
|
|
389
|
+
info(`Force is "${force}"`)
|
|
390
|
+
info(`Message is "${message}"`)
|
|
391
|
+
info(`Author is "${author}"`)
|
|
313
392
|
|
|
314
393
|
await gitPull(directory)
|
|
315
394
|
await rmrf(directory)
|
|
@@ -320,10 +399,18 @@ async function execute (directory = DIRECTORY, registry = REGISTRY, force = fals
|
|
|
320
399
|
await gitPush(directory)
|
|
321
400
|
await gitPushTags(directory)
|
|
322
401
|
} catch (e) {
|
|
323
|
-
handleError(e)
|
|
402
|
+
if (e instanceof Error) handleError(e)
|
|
324
403
|
}
|
|
325
404
|
}
|
|
326
405
|
|
|
406
|
+
/**
|
|
407
|
+
* @param {string} directory
|
|
408
|
+
* @param {string} registry
|
|
409
|
+
* @param {boolean} force
|
|
410
|
+
* @param {string} message
|
|
411
|
+
* @param {string | { name: string; email: string }} author
|
|
412
|
+
* @returns {Promise<void>}
|
|
413
|
+
*/
|
|
327
414
|
async function executeFrom (directory, registry, force, message, author) {
|
|
328
415
|
log('executeFrom')
|
|
329
416
|
|
|
@@ -333,19 +420,29 @@ async function executeFrom (directory, registry, force, message, author) {
|
|
|
333
420
|
try {
|
|
334
421
|
if (D === await gitRevParseShowTopLevel(D)) {
|
|
335
422
|
const B = await isHeadDefaultBranch(D)
|
|
423
|
+
|
|
336
424
|
if (B) {
|
|
337
425
|
const ignore = await getIgnoreFromConfiguration(D)
|
|
426
|
+
|
|
338
427
|
if (!ignore) {
|
|
339
428
|
await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
|
|
340
429
|
}
|
|
341
430
|
}
|
|
342
431
|
}
|
|
343
432
|
} catch (e) {
|
|
344
|
-
handleCommandError(e)
|
|
433
|
+
if (e instanceof Error) handleCommandError(e)
|
|
345
434
|
}
|
|
346
435
|
}
|
|
347
436
|
}
|
|
348
437
|
|
|
438
|
+
/**
|
|
439
|
+
* @param {string} directory
|
|
440
|
+
* @param {string} registry
|
|
441
|
+
* @param {boolean} force
|
|
442
|
+
* @param {string} message
|
|
443
|
+
* @param {string | { name: string; email: string }} author
|
|
444
|
+
* @returns {Promise<void>}
|
|
445
|
+
*/
|
|
349
446
|
async function executeOnly (directory, registry, force, message, author) {
|
|
350
447
|
log('executeOnly')
|
|
351
448
|
|
|
@@ -355,19 +452,29 @@ async function executeOnly (directory, registry, force, message, author) {
|
|
|
355
452
|
try {
|
|
356
453
|
if (D === await gitRevParseShowTopLevel(D)) {
|
|
357
454
|
const B = await isHeadDefaultBranch(D)
|
|
455
|
+
|
|
358
456
|
if (B) {
|
|
359
457
|
const ignore = await getIgnoreFromConfiguration(D)
|
|
458
|
+
|
|
360
459
|
if (!ignore) {
|
|
361
460
|
await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
|
|
362
461
|
}
|
|
363
462
|
}
|
|
364
463
|
}
|
|
365
464
|
} catch (e) {
|
|
366
|
-
handleCommandError(e)
|
|
465
|
+
if (e instanceof Error) handleCommandError(e)
|
|
367
466
|
}
|
|
368
467
|
}
|
|
369
468
|
}
|
|
370
469
|
|
|
470
|
+
/**
|
|
471
|
+
* @param {string} directory
|
|
472
|
+
* @param {string} registry
|
|
473
|
+
* @param {boolean} force
|
|
474
|
+
* @param {string} message
|
|
475
|
+
* @param {string | { name: string; email: string }} author
|
|
476
|
+
* @returns {Promise<void>}
|
|
477
|
+
*/
|
|
371
478
|
async function executePath (directory, registry, force, message, author) {
|
|
372
479
|
log('executePath')
|
|
373
480
|
|
|
@@ -377,15 +484,17 @@ async function executePath (directory, registry, force, message, author) {
|
|
|
377
484
|
try {
|
|
378
485
|
if (D === await gitRevParseShowTopLevel(D)) {
|
|
379
486
|
const B = await isHeadDefaultBranch(D)
|
|
487
|
+
|
|
380
488
|
if (B) {
|
|
381
489
|
const ignore = await getIgnoreFromConfiguration(D)
|
|
490
|
+
|
|
382
491
|
if (!ignore) {
|
|
383
492
|
await execute(D, registry, force, await toMessage(message, D), await toAuthor(author, D))
|
|
384
493
|
}
|
|
385
494
|
}
|
|
386
495
|
}
|
|
387
496
|
} catch (e) {
|
|
388
|
-
const {
|
|
497
|
+
const { // @ts-expect-error
|
|
389
498
|
code
|
|
390
499
|
} = e
|
|
391
500
|
|
|
@@ -395,11 +504,14 @@ async function executePath (directory, registry, force, message, author) {
|
|
|
395
504
|
)
|
|
396
505
|
}
|
|
397
506
|
|
|
398
|
-
handleCommandError(e)
|
|
507
|
+
if (e instanceof Error) handleCommandError(e)
|
|
399
508
|
}
|
|
400
509
|
}
|
|
401
510
|
}
|
|
402
511
|
|
|
512
|
+
/**
|
|
513
|
+
* @function app
|
|
514
|
+
*/
|
|
403
515
|
async function app () {
|
|
404
516
|
log('Deps')
|
|
405
517
|
|
|
@@ -449,7 +561,7 @@ async function app () {
|
|
|
449
561
|
try {
|
|
450
562
|
await executePath(P, registry, force, message, author)
|
|
451
563
|
} catch (e) {
|
|
452
|
-
handleError(e)
|
|
564
|
+
if (e instanceof Error) handleError(e)
|
|
453
565
|
}
|
|
454
566
|
} else {
|
|
455
567
|
if (F) {
|
|
@@ -458,7 +570,7 @@ async function app () {
|
|
|
458
570
|
try {
|
|
459
571
|
await executeFrom(P, registry, force, message, author)
|
|
460
572
|
} catch (e) {
|
|
461
|
-
handleError(e)
|
|
573
|
+
if (e instanceof Error) handleError(e)
|
|
462
574
|
}
|
|
463
575
|
} else {
|
|
464
576
|
if (O) {
|
|
@@ -467,7 +579,7 @@ async function app () {
|
|
|
467
579
|
try {
|
|
468
580
|
await executeOnly(P, registry, force, message, author)
|
|
469
581
|
} catch (e) {
|
|
470
|
-
handleError(e)
|
|
582
|
+
if (e instanceof Error) handleError(e)
|
|
471
583
|
}
|
|
472
584
|
}
|
|
473
585
|
}
|
package/bin/node/head.mjs
CHANGED
|
@@ -4,39 +4,23 @@ import {
|
|
|
4
4
|
exec
|
|
5
5
|
} from 'node:child_process'
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
join
|
|
9
|
-
} from 'node:path'
|
|
10
|
-
|
|
11
7
|
import '#deps/src/common/debug'
|
|
12
8
|
|
|
13
|
-
import {
|
|
14
|
-
PLATFORM,
|
|
15
|
-
BIN
|
|
16
|
-
} from '#deps/src/common/env'
|
|
17
|
-
|
|
18
9
|
import {
|
|
19
10
|
getOptions
|
|
20
11
|
} from '#deps/src/common/options'
|
|
21
12
|
|
|
22
13
|
import {
|
|
23
|
-
|
|
14
|
+
HEAD,
|
|
15
|
+
ARGS,
|
|
24
16
|
use,
|
|
25
17
|
handleComplete
|
|
26
18
|
} from '#deps/bin/common'
|
|
27
19
|
|
|
28
|
-
const command = (
|
|
29
|
-
PLATFORM === 'win32'
|
|
30
|
-
? `bash "${join(BIN, '.\\bash\\head.sh')}"`
|
|
31
|
-
: `bash '${join(BIN, './bash/head.sh')}'`
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
const args = getArgs()
|
|
35
|
-
|
|
36
20
|
const {
|
|
37
21
|
stdout,
|
|
38
22
|
stderr
|
|
39
|
-
} = exec(`${
|
|
23
|
+
} = exec(`${HEAD} ${ARGS}`, getOptions(), handleComplete)
|
|
40
24
|
|
|
41
|
-
stdout.on('data', use('deps-head'))
|
|
42
|
-
stderr.on('data', use('deps-head:error'))
|
|
25
|
+
if (stdout) stdout.on('data', use('deps-head'))
|
|
26
|
+
if (stderr) stderr.on('data', use('deps-head:error'))
|
package/bin/node/install.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import debug from 'debug'
|
|
4
|
-
|
|
5
3
|
import {
|
|
6
4
|
Command
|
|
7
5
|
} from 'commander'
|
|
8
6
|
|
|
9
|
-
import '#deps/src/common/debug'
|
|
7
|
+
import debug from '#deps/src/common/debug'
|
|
10
8
|
|
|
11
9
|
import {
|
|
12
10
|
VERSION,
|
|
@@ -37,6 +35,9 @@ const log = debug('@modernpoacher/deps')
|
|
|
37
35
|
|
|
38
36
|
log(`\`install\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
39
37
|
|
|
38
|
+
/**
|
|
39
|
+
* @function app
|
|
40
|
+
*/
|
|
40
41
|
async function app () {
|
|
41
42
|
log('Deps')
|
|
42
43
|
|
|
@@ -115,7 +116,7 @@ async function app () {
|
|
|
115
116
|
try {
|
|
116
117
|
await execute(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), save, registry, force)
|
|
117
118
|
} catch (e) {
|
|
118
|
-
handleError(e)
|
|
119
|
+
if (e instanceof Error) handleError(e)
|
|
119
120
|
}
|
|
120
121
|
} else {
|
|
121
122
|
if (D) {
|
|
@@ -124,7 +125,7 @@ async function app () {
|
|
|
124
125
|
try {
|
|
125
126
|
await execute(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), save, registry, force)
|
|
126
127
|
} catch (e) {
|
|
127
|
-
handleError(e)
|
|
128
|
+
if (e instanceof Error) handleError(e)
|
|
128
129
|
}
|
|
129
130
|
} else {
|
|
130
131
|
if (O) {
|
|
@@ -133,7 +134,7 @@ async function app () {
|
|
|
133
134
|
try {
|
|
134
135
|
await execute(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), save, registry, force)
|
|
135
136
|
} catch (e) {
|
|
136
|
-
handleError(e)
|
|
137
|
+
if (e instanceof Error) handleError(e)
|
|
137
138
|
}
|
|
138
139
|
} else {
|
|
139
140
|
if (B) {
|
|
@@ -142,7 +143,7 @@ async function app () {
|
|
|
142
143
|
try {
|
|
143
144
|
await execute(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), save, registry, force)
|
|
144
145
|
} catch (e) {
|
|
145
|
-
handleError(e)
|
|
146
|
+
if (e instanceof Error) handleError(e)
|
|
146
147
|
}
|
|
147
148
|
} else {
|
|
148
149
|
if (p) {
|
|
@@ -151,7 +152,7 @@ async function app () {
|
|
|
151
152
|
try {
|
|
152
153
|
await execute(DEPS_PATH, getPeerDependencies(PACKAGE), getPeerDependencies(CONFIGURATION), save, registry, force)
|
|
153
154
|
} catch (e) {
|
|
154
|
-
handleError(e)
|
|
155
|
+
if (e instanceof Error) handleError(e)
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
}
|
package/bin/node/push.mjs
CHANGED
|
@@ -4,39 +4,23 @@ import {
|
|
|
4
4
|
exec
|
|
5
5
|
} from 'node:child_process'
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
join
|
|
9
|
-
} from 'node:path'
|
|
10
|
-
|
|
11
7
|
import '#deps/src/common/debug'
|
|
12
8
|
|
|
13
|
-
import {
|
|
14
|
-
PLATFORM,
|
|
15
|
-
BIN
|
|
16
|
-
} from '#deps/src/common/env'
|
|
17
|
-
|
|
18
9
|
import {
|
|
19
10
|
getOptions
|
|
20
11
|
} from '#deps/src/common/options'
|
|
21
12
|
|
|
22
13
|
import {
|
|
23
|
-
|
|
14
|
+
PUSH,
|
|
15
|
+
ARGS,
|
|
24
16
|
use,
|
|
25
17
|
handleComplete
|
|
26
18
|
} from '#deps/bin/common'
|
|
27
19
|
|
|
28
|
-
const command = (
|
|
29
|
-
PLATFORM === 'win32'
|
|
30
|
-
? `bash "${join(BIN, '.\\bash\\push.sh')}"`
|
|
31
|
-
: `bash '${join(BIN, './bash/push.sh')}'`
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
const args = getArgs()
|
|
35
|
-
|
|
36
20
|
const {
|
|
37
21
|
stdout,
|
|
38
22
|
stderr
|
|
39
|
-
} = exec(`${
|
|
23
|
+
} = exec(`${PUSH} ${ARGS}`, getOptions(), handleComplete)
|
|
40
24
|
|
|
41
|
-
stdout.on('data', use('deps-push'))
|
|
42
|
-
stderr.on('data', use('deps-push:error'))
|
|
25
|
+
if (stdout) stdout.on('data', use('deps-push'))
|
|
26
|
+
if (stderr) stderr.on('data', use('deps-push:error'))
|
package/bin/node/wipe.mjs
CHANGED
|
@@ -4,39 +4,23 @@ import {
|
|
|
4
4
|
exec
|
|
5
5
|
} from 'node:child_process'
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
join
|
|
9
|
-
} from 'node:path'
|
|
10
|
-
|
|
11
7
|
import '#deps/src/common/debug'
|
|
12
8
|
|
|
13
|
-
import {
|
|
14
|
-
PLATFORM,
|
|
15
|
-
BIN
|
|
16
|
-
} from '#deps/src/common/env'
|
|
17
|
-
|
|
18
9
|
import {
|
|
19
10
|
getOptions
|
|
20
11
|
} from '#deps/src/common/options'
|
|
21
12
|
|
|
22
13
|
import {
|
|
23
|
-
|
|
14
|
+
WIPE,
|
|
15
|
+
ARGS,
|
|
24
16
|
use,
|
|
25
17
|
handleComplete
|
|
26
18
|
} from '#deps/bin/common'
|
|
27
19
|
|
|
28
|
-
const command = (
|
|
29
|
-
PLATFORM === 'win32'
|
|
30
|
-
? `bash "${join(BIN, '.\\bash\\wipe.sh')}"`
|
|
31
|
-
: `bash '${join(BIN, './bash/wipe.sh')}'`
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
const args = getArgs()
|
|
35
|
-
|
|
36
20
|
const {
|
|
37
21
|
stdout,
|
|
38
22
|
stderr
|
|
39
|
-
} = exec(`${
|
|
23
|
+
} = exec(`${WIPE} ${ARGS}`, getOptions(), handleComplete)
|
|
40
24
|
|
|
41
|
-
stdout.on('data', use('deps-wipe'))
|
|
42
|
-
stderr.on('data', use('deps-wipe:error'))
|
|
25
|
+
if (stdout) stdout.on('data', use('deps-wipe'))
|
|
26
|
+
if (stderr) stderr.on('data', use('deps-wipe:error'))
|