-
Notifications
You must be signed in to change notification settings - Fork 58
/
run.js
45 lines (39 loc) · 895 Bytes
/
run.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { loadUserConfig } from '../config/user.js'
import runCmd from '../run.js'
/**
* @typedef {import("yargs").Argv} Argv
* @typedef {import("yargs").Arguments} Arguments
* @typedef {import("yargs").CommandModule} CommandModule
*/
const EPILOG = `Example:
$ aegir run clean build
`
/** @type {CommandModule} */
export default {
command: 'run <scripts..>',
describe: 'Run one or more npm scripts in each project of a monorepo',
/**
* @param {Argv} yargs
*/
builder: async (yargs) => {
const userConfig = await loadUserConfig()
return yargs
.epilog(EPILOG)
.options({
bail: {
type: 'boolean',
describe: '',
default: userConfig.run.bail
}
})
.positional('script', {
array: true
})
},
/**
* @param {any} argv
*/
async handler (argv) {
await runCmd.run(argv)
}
}