UNPKG

918 BJavaScriptView Raw
1#!/usr/bin/env node
2require = require('esm')(module)
3const { run_parallel__workspaces } = require('../lib')
4const { _h__param } = require('@ctx-core/cli-args')
5const a1__cmd = process.argv.slice(2)
6main()
7async 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}
16function _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}
29function _help_msg() {
30 return `
31Usage: run-parallel--workspaces.js [-t <thread-count>]
32
33Options:
34
35-h, --help This help message
36-t, --threads Number of threads to run (defaults to 20)
37 `.trim()
38}