@modernpoacher/deps 2.2.18 → 2.2.19
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 +161 -47
- package/bin/deps.mjs +6 -6
- package/bin/node/deps.mjs +5 -21
- package/bin/node/execute.mjs +137 -25
- package/bin/node/head.mjs +5 -21
- package/bin/node/install.mjs +5 -5
- package/bin/node/push.mjs +5 -21
- package/bin/node/wipe.mjs +5 -21
- package/eslint.config.mjs +86 -0
- package/index.d.mts +50 -0
- package/package.json +11 -9
- package/src/common/env/index.mjs +1 -1
- package/src/common/git/index.mjs +98 -62
- package/src/common/index.mjs +32 -55
- package/src/common/options/index.mjs +11 -18
- package/src/index.mjs +56 -44
- package/src/install/index.mjs +15 -19
- package/tsconfig.json +20 -0
package/bin/common/index.mjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {DepsTypes.Package} Package
|
|
5
|
+
* @typedef {DepsTypes.Configuration} Configuration
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
import debug from 'debug'
|
|
4
9
|
|
|
5
10
|
import stripAnsi from 'strip-ansi'
|
|
@@ -15,7 +20,6 @@ import {
|
|
|
15
20
|
import {
|
|
16
21
|
resolve,
|
|
17
22
|
join,
|
|
18
|
-
// relative,
|
|
19
23
|
normalize
|
|
20
24
|
} from 'node:path'
|
|
21
25
|
|
|
@@ -30,7 +34,8 @@ import {
|
|
|
30
34
|
|
|
31
35
|
import {
|
|
32
36
|
VERSION,
|
|
33
|
-
PLATFORM
|
|
37
|
+
PLATFORM,
|
|
38
|
+
BIN
|
|
34
39
|
} from '#deps/src/common/env'
|
|
35
40
|
|
|
36
41
|
import {
|
|
@@ -49,6 +54,7 @@ import {
|
|
|
49
54
|
} from '#deps/src/common'
|
|
50
55
|
|
|
51
56
|
const log = debug('@modernpoacher/deps')
|
|
57
|
+
const info = debug('@modernpoacher/deps:info')
|
|
52
58
|
const error = debug('@modernpoacher/deps:error')
|
|
53
59
|
|
|
54
60
|
log(`\`common\` (${VERSION} - ${PLATFORM}) is awake`)
|
|
@@ -59,12 +65,18 @@ const CODE = 0
|
|
|
59
65
|
|
|
60
66
|
const MESSAGE = 'Either no error message has been defined or no error has been supplied'
|
|
61
67
|
|
|
68
|
+
/**
|
|
69
|
+
* @param {string} v
|
|
70
|
+
* @returns {string}
|
|
71
|
+
*/
|
|
62
72
|
export const tidy = (v) => v.replace(/\n{2,}}/gm, String.fromCharCode(10)).trim()
|
|
63
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @param {string} v
|
|
76
|
+
* @returns {string}
|
|
77
|
+
*/
|
|
64
78
|
export const trim = (v) => v.split(String.fromCharCode(10)).map((v) => v.trimEnd()).join(String.fromCharCode(10)).trim()
|
|
65
79
|
|
|
66
|
-
// const toRelativePath = (to) => relative(process.cwd(), to) // const toRelativePath = relative.bind(null, process.cwd())
|
|
67
|
-
|
|
68
80
|
const getRmrfCommands = PLATFORM === 'win32'
|
|
69
81
|
? () => tidy(`
|
|
70
82
|
rmdir /s /q node_modules 2> nul & \
|
|
@@ -77,37 +89,75 @@ rm -rf node_modules \
|
|
|
77
89
|
|
|
78
90
|
const getNpmiCommands = PLATFORM === 'win32'
|
|
79
91
|
? (registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'npm i')))
|
|
80
|
-
: (registry = REGISTRY, force = false) => tidy(
|
|
81
|
-
${getExportPath(getNvm(getRegistryParameter(registry, getForceParameter(force, 'npm i'))))}
|
|
82
|
-
`)
|
|
92
|
+
: (registry = REGISTRY, force = false) => tidy(getExportPath(getNvm(getRegistryParameter(registry, getForceParameter(force, 'npm i')))))
|
|
83
93
|
|
|
84
94
|
const getDepsCommands = PLATFORM === 'win32'
|
|
85
95
|
? (registry = REGISTRY, force = false) => tidy(getRegistryParameter(registry, getForceParameter(force, 'deps')))
|
|
86
|
-
: (registry = REGISTRY, force = false) => tidy(
|
|
87
|
-
|
|
88
|
-
|
|
96
|
+
: (registry = REGISTRY, force = false) => tidy(getExportPath(getNvm(getRegistryParameter(registry, getForceParameter(force, 'deps')))))
|
|
97
|
+
|
|
98
|
+
export const DEPS = PLATFORM === 'win32'
|
|
99
|
+
? `bash "${join(BIN, '.\\bash\\deps.sh')}"`
|
|
100
|
+
: `bash '${join(BIN, './bash/deps.sh')}'`
|
|
101
|
+
|
|
102
|
+
export const HEAD = PLATFORM === 'win32'
|
|
103
|
+
? `bash "${join(BIN, '.\\bash\\head.sh')}"`
|
|
104
|
+
: `bash '${join(BIN, './bash/head.sh')}'`
|
|
105
|
+
|
|
106
|
+
export const PUSH = PLATFORM === 'win32'
|
|
107
|
+
? `bash "${join(BIN, '.\\bash\\push.sh')}"`
|
|
108
|
+
: `bash '${join(BIN, './bash/push.sh')}'`
|
|
109
|
+
|
|
110
|
+
export const WIPE = PLATFORM === 'win32'
|
|
111
|
+
? `bash "${join(BIN, '.\\bash\\wipe.sh')}"`
|
|
112
|
+
: `bash '${join(BIN, './bash/wipe.sh')}'`
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @param {string} v
|
|
116
|
+
* @returns {string}
|
|
117
|
+
*/
|
|
118
|
+
function toDouble (v) {
|
|
119
|
+
return v.startsWith('-') ? v : `"${v}"` // double-quote
|
|
120
|
+
}
|
|
89
121
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
String.fromCodePoint(32)
|
|
97
|
-
)
|
|
122
|
+
/**
|
|
123
|
+
* @param {string} v
|
|
124
|
+
* @returns {string}
|
|
125
|
+
*/
|
|
126
|
+
function toSingle (v) {
|
|
127
|
+
return v.startsWith('-') ? v : `'${v}'` // single-quote
|
|
98
128
|
}
|
|
99
129
|
|
|
130
|
+
export const ARGS = PLATFORM === 'win32'
|
|
131
|
+
? ARGV.map(toDouble).join(String.fromCodePoint(32))
|
|
132
|
+
: ARGV.map(toSingle).join(String.fromCodePoint(32))
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @param {string} v
|
|
136
|
+
* @returns {boolean}
|
|
137
|
+
*/
|
|
100
138
|
function filter (v) {
|
|
101
139
|
return Boolean(stripAnsi(v).trim())
|
|
102
140
|
}
|
|
103
141
|
|
|
142
|
+
/**
|
|
143
|
+
* @param {string} key
|
|
144
|
+
* @returns {(value: string) => void}
|
|
145
|
+
*/
|
|
104
146
|
export function use (key) {
|
|
105
147
|
const log = debug(`@modernpoacher/deps:${key}`)
|
|
106
148
|
|
|
149
|
+
/**
|
|
150
|
+
* @param {string} v
|
|
151
|
+
* @returns {void}
|
|
152
|
+
*/
|
|
107
153
|
function write (v) {
|
|
108
154
|
log(v.trimEnd())
|
|
109
155
|
}
|
|
110
156
|
|
|
157
|
+
/**
|
|
158
|
+
* @param {string} value
|
|
159
|
+
* @returns {void}
|
|
160
|
+
*/
|
|
111
161
|
return function use (value) {
|
|
112
162
|
value.split(String.fromCharCode(10))
|
|
113
163
|
.filter(filter)
|
|
@@ -115,6 +165,9 @@ export function use (key) {
|
|
|
115
165
|
}
|
|
116
166
|
}
|
|
117
167
|
|
|
168
|
+
/**
|
|
169
|
+
* @param {{ code?: number, message?: string }} [e]
|
|
170
|
+
*/
|
|
118
171
|
export function handleError (e = {}) {
|
|
119
172
|
const {
|
|
120
173
|
code = CODE
|
|
@@ -128,14 +181,24 @@ export function handleError (e = {}) {
|
|
|
128
181
|
error(message)
|
|
129
182
|
}
|
|
130
183
|
|
|
184
|
+
/**
|
|
185
|
+
* @param {Error | null} [e]
|
|
186
|
+
* @returns {void}
|
|
187
|
+
*/
|
|
131
188
|
export function handleComplete (e = null) {
|
|
132
189
|
if (!e) return log('👍')
|
|
133
190
|
error('👎')
|
|
134
191
|
}
|
|
135
192
|
|
|
136
|
-
|
|
193
|
+
/**
|
|
194
|
+
* @param {{ code?: number, message?: string }} [e]
|
|
195
|
+
*/
|
|
196
|
+
const handlePackageError = ({ message = MESSAGE } = {}) => { info(`Package error: "${message}"`) }
|
|
137
197
|
|
|
138
|
-
|
|
198
|
+
/**
|
|
199
|
+
* @param {{ code?: number, message?: string }} [e]
|
|
200
|
+
*/
|
|
201
|
+
const handleConfigurationError = ({ message = MESSAGE } = {}) => { info(`Configuration error: "${message}"`) }
|
|
139
202
|
|
|
140
203
|
const getPackageJsonPath = (directory = DIRECTORY) => resolve(join(directory, 'package.json'))
|
|
141
204
|
|
|
@@ -143,6 +206,10 @@ const getDepsRcPath = (directory = DIRECTORY) => resolve(join(directory, '.depsr
|
|
|
143
206
|
|
|
144
207
|
const getDepsRcJsonPath = (directory = DIRECTORY) => resolve(join(directory, '.depsrc.json'))
|
|
145
208
|
|
|
209
|
+
/**
|
|
210
|
+
* @param {string} directory
|
|
211
|
+
* @returns {Promise<Package>}
|
|
212
|
+
*/
|
|
146
213
|
async function getPackageJson (directory = DIRECTORY) {
|
|
147
214
|
log('getPackageJson')
|
|
148
215
|
|
|
@@ -151,6 +218,10 @@ async function getPackageJson (directory = DIRECTORY) {
|
|
|
151
218
|
)
|
|
152
219
|
}
|
|
153
220
|
|
|
221
|
+
/**
|
|
222
|
+
* @param {string} directory
|
|
223
|
+
* @returns {Promise<Configuration>}
|
|
224
|
+
*/
|
|
154
225
|
async function getDepsRc (directory = DIRECTORY) {
|
|
155
226
|
log('getDepsRc')
|
|
156
227
|
|
|
@@ -159,6 +230,10 @@ async function getDepsRc (directory = DIRECTORY) {
|
|
|
159
230
|
)
|
|
160
231
|
}
|
|
161
232
|
|
|
233
|
+
/**
|
|
234
|
+
* @param {string} directory
|
|
235
|
+
* @returns {Promise<Configuration>}
|
|
236
|
+
*/
|
|
162
237
|
async function getDepsRcJson (directory = DIRECTORY) {
|
|
163
238
|
log('getDepsRcJson')
|
|
164
239
|
|
|
@@ -167,99 +242,126 @@ async function getDepsRcJson (directory = DIRECTORY) {
|
|
|
167
242
|
)
|
|
168
243
|
}
|
|
169
244
|
|
|
245
|
+
/**
|
|
246
|
+
* @param {string} directory
|
|
247
|
+
* @returns {Promise<boolean>}
|
|
248
|
+
*/
|
|
170
249
|
async function hasPackage (directory = DIRECTORY) {
|
|
171
250
|
log('hasPackage')
|
|
172
251
|
|
|
173
|
-
|
|
252
|
+
info(`Directory is "${directory}"`)
|
|
174
253
|
|
|
175
254
|
try {
|
|
176
255
|
await access(getPackageJsonPath(directory), constants.R_OK)
|
|
177
256
|
|
|
178
|
-
|
|
257
|
+
info('Package at "package.json"')
|
|
179
258
|
return true
|
|
180
259
|
} catch {
|
|
181
|
-
|
|
260
|
+
info('No package at "package.json"')
|
|
182
261
|
return false
|
|
183
262
|
}
|
|
184
263
|
}
|
|
185
264
|
|
|
265
|
+
/**
|
|
266
|
+
* @param {string} directory
|
|
267
|
+
* @returns {Promise<Package>}
|
|
268
|
+
*/
|
|
186
269
|
async function getPackage (directory = DIRECTORY) {
|
|
187
270
|
log('getPackage')
|
|
188
271
|
|
|
272
|
+
info(`Directory is "${directory}"`)
|
|
273
|
+
|
|
189
274
|
try {
|
|
190
275
|
return await getPackageJson(directory)
|
|
191
276
|
} catch (e) {
|
|
192
|
-
handlePackageError(e)
|
|
277
|
+
if (e instanceof Error) handlePackageError(e)
|
|
278
|
+
return {}
|
|
193
279
|
}
|
|
194
280
|
}
|
|
195
281
|
|
|
282
|
+
/**
|
|
283
|
+
* @param {string} directory
|
|
284
|
+
* @returns {Promise<boolean>}
|
|
285
|
+
*/
|
|
196
286
|
async function hasConfiguration (directory = DIRECTORY) {
|
|
197
287
|
log('hasConfiguration')
|
|
198
288
|
|
|
199
|
-
|
|
289
|
+
info(`Directory is "${directory}"`)
|
|
200
290
|
|
|
201
291
|
try {
|
|
202
292
|
await access(getDepsRcPath(directory), constants.R_OK)
|
|
203
293
|
|
|
204
|
-
|
|
294
|
+
info('Configuration at ".depsrc"')
|
|
205
295
|
return true
|
|
206
296
|
} catch (e) {
|
|
207
|
-
const {
|
|
297
|
+
const { // @ts-expect-error
|
|
208
298
|
code
|
|
209
299
|
} = e
|
|
210
300
|
|
|
211
301
|
if (code !== 'ENOENT') {
|
|
212
|
-
handleConfigurationError(e)
|
|
302
|
+
if (e instanceof Error) handleConfigurationError(e)
|
|
213
303
|
} else {
|
|
214
304
|
try {
|
|
215
305
|
await access(getDepsRcJsonPath(directory), constants.R_OK)
|
|
216
306
|
|
|
217
|
-
|
|
307
|
+
info('Configuration at ".depsrc.json"')
|
|
218
308
|
return true
|
|
219
309
|
} catch (e) {
|
|
220
|
-
const {
|
|
310
|
+
const { // @ts-expect-error
|
|
221
311
|
code
|
|
222
312
|
} = e
|
|
223
313
|
|
|
224
314
|
if (code !== 'ENOENT') {
|
|
225
|
-
handleConfigurationError(e)
|
|
315
|
+
if (e instanceof Error) handleConfigurationError(e)
|
|
226
316
|
}
|
|
227
317
|
}
|
|
228
318
|
}
|
|
229
|
-
}
|
|
230
319
|
|
|
231
|
-
|
|
232
|
-
|
|
320
|
+
info('No configuration at ".depsrc" nor ".depsrc.json"') // at "${toRelativePath(getDepsRcPath(directory))}" or "${toRelativePath(getDepsRcJsonPath(directory))}"`)
|
|
321
|
+
return false
|
|
322
|
+
}
|
|
233
323
|
}
|
|
234
324
|
|
|
325
|
+
/**
|
|
326
|
+
* @param {string} directory
|
|
327
|
+
* @returns {Promise<Configuration>}
|
|
328
|
+
*/
|
|
235
329
|
async function getConfiguration (directory = DIRECTORY) {
|
|
236
330
|
log('getConfiguration')
|
|
237
331
|
|
|
332
|
+
info(`Directory is "${directory}"`)
|
|
333
|
+
|
|
238
334
|
try {
|
|
239
335
|
return await getDepsRc(directory)
|
|
240
336
|
} catch (e) {
|
|
241
|
-
const {
|
|
337
|
+
const { // @ts-expect-error
|
|
242
338
|
code
|
|
243
339
|
} = e
|
|
244
340
|
|
|
245
341
|
if (code !== 'ENOENT') {
|
|
246
|
-
handleConfigurationError(e)
|
|
342
|
+
if (e instanceof Error) handleConfigurationError(e)
|
|
247
343
|
} else {
|
|
248
344
|
try {
|
|
249
345
|
return await getDepsRcJson(directory)
|
|
250
346
|
} catch (e) {
|
|
251
|
-
const {
|
|
347
|
+
const { // @ts-expect-error
|
|
252
348
|
code
|
|
253
349
|
} = e
|
|
254
350
|
|
|
255
351
|
if (code !== 'ENOENT') {
|
|
256
|
-
handleConfigurationError(e)
|
|
352
|
+
if (e instanceof Error) handleConfigurationError(e)
|
|
257
353
|
}
|
|
258
354
|
}
|
|
259
355
|
}
|
|
356
|
+
|
|
357
|
+
return {}
|
|
260
358
|
}
|
|
261
359
|
}
|
|
262
360
|
|
|
361
|
+
/**
|
|
362
|
+
* @param {string} [d]
|
|
363
|
+
* @returns {Promise<string>}
|
|
364
|
+
*/
|
|
263
365
|
function rmrf (d = DIRECTORY) {
|
|
264
366
|
log('rmrf')
|
|
265
367
|
|
|
@@ -273,18 +375,24 @@ function rmrf (d = DIRECTORY) {
|
|
|
273
375
|
const {
|
|
274
376
|
stdout,
|
|
275
377
|
stderr
|
|
276
|
-
} = exec(commands, options, (e, v) => {
|
|
378
|
+
} = exec(commands, options, (e = null, v = '') => {
|
|
277
379
|
return (!e) ? resolve(v) : reject(e)
|
|
278
380
|
})
|
|
279
381
|
|
|
280
382
|
const log = use('rmrf')
|
|
281
383
|
|
|
282
|
-
stdout.on('data', log)
|
|
283
|
-
stderr.on('data', log)
|
|
384
|
+
if (stdout) stdout.on('data', log)
|
|
385
|
+
if (stderr) stderr.on('data', log)
|
|
284
386
|
})
|
|
285
387
|
)
|
|
286
388
|
}
|
|
287
389
|
|
|
390
|
+
/**
|
|
391
|
+
* @param {string} [d]
|
|
392
|
+
* @param {string} [registry]
|
|
393
|
+
* @param {boolean} [force]
|
|
394
|
+
* @returns {Promise<string>}
|
|
395
|
+
*/
|
|
288
396
|
function npmi (d = DIRECTORY, registry = REGISTRY, force = false) {
|
|
289
397
|
log('npmi')
|
|
290
398
|
|
|
@@ -298,18 +406,24 @@ function npmi (d = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
298
406
|
const {
|
|
299
407
|
stdout,
|
|
300
408
|
stderr
|
|
301
|
-
} = exec(commands, options, (e, v) => {
|
|
409
|
+
} = exec(commands, options, (e = null, v = '') => {
|
|
302
410
|
return (!e) ? resolve(v) : reject(e)
|
|
303
411
|
})
|
|
304
412
|
|
|
305
413
|
const log = use('npmi')
|
|
306
414
|
|
|
307
|
-
stdout.on('data', log)
|
|
308
|
-
stderr.on('data', log)
|
|
415
|
+
if (stdout) stdout.on('data', log)
|
|
416
|
+
if (stderr) stderr.on('data', log)
|
|
309
417
|
})
|
|
310
418
|
)
|
|
311
419
|
}
|
|
312
420
|
|
|
421
|
+
/**
|
|
422
|
+
* @param {string} [d]
|
|
423
|
+
* @param {string} [registry]
|
|
424
|
+
* @param {boolean} [force]
|
|
425
|
+
* @returns {Promise<string>}
|
|
426
|
+
*/
|
|
313
427
|
function deps (d = DIRECTORY, registry = REGISTRY, force = false) {
|
|
314
428
|
log('deps')
|
|
315
429
|
|
|
@@ -323,14 +437,14 @@ function deps (d = DIRECTORY, registry = REGISTRY, force = false) {
|
|
|
323
437
|
const {
|
|
324
438
|
stdout,
|
|
325
439
|
stderr
|
|
326
|
-
} = exec(commands, options, (e, v) => {
|
|
440
|
+
} = exec(commands, options, (e = null, v = '') => {
|
|
327
441
|
return (!e) ? resolve(v) : reject(e)
|
|
328
442
|
})
|
|
329
443
|
|
|
330
444
|
const log = use('deps')
|
|
331
445
|
|
|
332
|
-
stdout.on('data', log)
|
|
333
|
-
stderr.on('data', log)
|
|
446
|
+
if (stdout) stdout.on('data', log)
|
|
447
|
+
if (stderr) stderr.on('data', log)
|
|
334
448
|
})
|
|
335
449
|
)
|
|
336
450
|
}
|
package/bin/deps.mjs
CHANGED
|
@@ -111,7 +111,7 @@ async function app () {
|
|
|
111
111
|
try {
|
|
112
112
|
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
|
|
113
113
|
} catch (e) {
|
|
114
|
-
handleError(e)
|
|
114
|
+
if (e instanceof Error) handleError(e)
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
log('Dev')
|
|
@@ -119,7 +119,7 @@ async function app () {
|
|
|
119
119
|
try {
|
|
120
120
|
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
|
|
121
121
|
} catch (e) {
|
|
122
|
-
handleError(e)
|
|
122
|
+
if (e instanceof Error) handleError(e)
|
|
123
123
|
}
|
|
124
124
|
} else {
|
|
125
125
|
if (P) {
|
|
@@ -128,7 +128,7 @@ async function app () {
|
|
|
128
128
|
try {
|
|
129
129
|
await executeProd(DEPS_PATH, getProdDependencies(PACKAGE), getProdDependencies(CONFIGURATION), registry, force)
|
|
130
130
|
} catch (e) {
|
|
131
|
-
handleError(e)
|
|
131
|
+
if (e instanceof Error) handleError(e)
|
|
132
132
|
}
|
|
133
133
|
} else {
|
|
134
134
|
if (D) {
|
|
@@ -137,7 +137,7 @@ async function app () {
|
|
|
137
137
|
try {
|
|
138
138
|
await executeDev(DEPS_PATH, getDevDependencies(PACKAGE), getDevDependencies(CONFIGURATION), registry, force)
|
|
139
139
|
} catch (e) {
|
|
140
|
-
handleError(e)
|
|
140
|
+
if (e instanceof Error) handleError(e)
|
|
141
141
|
}
|
|
142
142
|
} else {
|
|
143
143
|
if (O) {
|
|
@@ -146,7 +146,7 @@ async function app () {
|
|
|
146
146
|
try {
|
|
147
147
|
await executeOptional(DEPS_PATH, getOptionalDependencies(PACKAGE), getOptionalDependencies(CONFIGURATION), registry, force)
|
|
148
148
|
} catch (e) {
|
|
149
|
-
handleError(e)
|
|
149
|
+
if (e instanceof Error) handleError(e)
|
|
150
150
|
}
|
|
151
151
|
} else {
|
|
152
152
|
if (B) {
|
|
@@ -155,7 +155,7 @@ async function app () {
|
|
|
155
155
|
try {
|
|
156
156
|
await executeBundle(DEPS_PATH, getBundleDependencies(PACKAGE), getBundleDependencies(CONFIGURATION), registry, force)
|
|
157
157
|
} catch (e) {
|
|
158
|
-
handleError(e)
|
|
158
|
+
if (e instanceof Error) handleError(e)
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}
|
package/bin/node/deps.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
|
+
DEPS,
|
|
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\\deps.sh')}"`
|
|
31
|
-
: `bash '${join(BIN, './bash/deps.sh')}'`
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
const args = getArgs()
|
|
35
|
-
|
|
36
20
|
const {
|
|
37
21
|
stdout,
|
|
38
22
|
stderr
|
|
39
|
-
} = exec(`${
|
|
23
|
+
} = exec(`${DEPS} ${ARGS}`, getOptions(), handleComplete)
|
|
40
24
|
|
|
41
|
-
stdout.on('data', use('deps-deps'))
|
|
42
|
-
stderr.on('data', use('deps-deps:error'))
|
|
25
|
+
if (stdout) stdout.on('data', use('deps-deps'))
|
|
26
|
+
if (stderr) stderr.on('data', use('deps-deps:error'))
|