1 | #!/usr/bin/env node
|
2 | require = require('esm')(module)
|
3 | const { run_parallel__workspaces } = require('../lib')
|
4 | const { _h__param } = require('@ctx-core/cli-args')
|
5 | const a1__cmd = process.argv.slice(2)
|
6 | main()
|
7 | async function main() {
|
8 | const opts = _opts()
|
9 | const stdout__name__workspace =
|
10 | await run_parallel__workspaces(a1__cmd, opts)
|
11 | for (let name__workspace in stdout__name__workspace) {
|
12 | console.info(name__workspace)
|
13 | console.info(stdout__name__workspace[name__workspace])
|
14 | }
|
15 | }
|
16 | function _opts() {
|
17 | const { threads, help } = _h__param(process.argv.slice(2), {
|
18 | threads: '-t, --threads',
|
19 | help: '-h, --help',
|
20 | })
|
21 | if (help) {
|
22 | console.info(_help_msg)
|
23 | process.exit(0)
|
24 | }
|
25 | return {
|
26 | threads: threads || 20,
|
27 | }
|
28 | }
|
29 | function _help_msg() {
|
30 | return `
|
31 | Usage: run-parallel--workspaces.js [-t <thread-count>]
|
32 |
|
33 | Options:
|
34 |
|
35 | -h, --help This help message
|
36 | -t, --threads Number of threads to run (defaults to 20)
|
37 | `.trim()
|
38 | }
|