mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[kbn/pm] throw an error if package doesn't have a script (#89438)
* [kbn/pm] throw an error if package doesn't have a script
* actually add the kbn/es build script 🤦♂️
Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
parent
96e4bdc8ae
commit
3c604438b8
7 changed files with 42 additions and 20 deletions
|
@ -5,4 +5,4 @@ set -euo pipefail
|
|||
source "$(dirname "${0}")/../util.sh"
|
||||
|
||||
checks-reporter-with-killswitch "Test Projects" \
|
||||
yarn kbn run test --exclude kibana --oss --skip-kibana-plugins
|
||||
yarn kbn run test --exclude kibana --oss --skip-kibana-plugins --skip-missing
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
"devOnly": true
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build",
|
||||
"kbn:bootstrap": "node scripts/build",
|
||||
"kbn:watch": "node scripts/build --watch"
|
||||
},
|
||||
|
|
|
@ -150,14 +150,14 @@ e.g. `build` or `test`. Instead of jumping into each package and running
|
|||
`yarn build` you can run:
|
||||
|
||||
```
|
||||
yarn kbn run build
|
||||
yarn kbn run build --skip-missing
|
||||
```
|
||||
|
||||
And if needed, you can skip packages in the same way as for bootstrapping, e.g.
|
||||
with `--exclude` and `--skip-kibana-plugins`:
|
||||
|
||||
```
|
||||
yarn kbn run build --exclude kibana
|
||||
yarn kbn run build --exclude kibana --skip-missing
|
||||
```
|
||||
|
||||
### Watching
|
||||
|
|
26
packages/kbn-pm/dist/index.js
vendored
26
packages/kbn-pm/dist/index.js
vendored
|
@ -179,12 +179,15 @@ function help() {
|
|||
--debug Set log level to debug
|
||||
--quiet Set log level to error
|
||||
--silent Disable log output
|
||||
|
||||
"run" options:
|
||||
--skip-missing Ignore packages which don't have the requested script
|
||||
` + '\n');
|
||||
}
|
||||
|
||||
async function run(argv) {
|
||||
_utils_log__WEBPACK_IMPORTED_MODULE_6__["log"].setLogLevel(Object(_kbn_dev_utils_tooling_log__WEBPACK_IMPORTED_MODULE_3__["pickLevelFromFlags"])(getopts__WEBPACK_IMPORTED_MODULE_1___default()(argv, {
|
||||
boolean: ['verbose', 'debug', 'quiet', 'silent']
|
||||
boolean: ['verbose', 'debug', 'quiet', 'silent', 'skip-missing']
|
||||
}))); // We can simplify this setup (and remove this extra handling) once Yarn
|
||||
// starts forwarding the `--` directly to this script, see
|
||||
// https://github.com/yarnpkg/yarn/blob/b2d3e1a8fe45ef376b716d597cc79b38702a9320/src/cli/index.js#L174-L182
|
||||
|
@ -52620,7 +52623,8 @@ const RunCommand = {
|
|||
name: 'run',
|
||||
|
||||
async run(projects, projectGraph, {
|
||||
extraArgs
|
||||
extraArgs,
|
||||
options
|
||||
}) {
|
||||
const batchedProjects = Object(_utils_projects__WEBPACK_IMPORTED_MODULE_3__["topologicallyBatchProjects"])(projects, projectGraph);
|
||||
|
||||
|
@ -52631,13 +52635,19 @@ const RunCommand = {
|
|||
const scriptName = extraArgs[0];
|
||||
const scriptArgs = extraArgs.slice(1);
|
||||
await Object(_utils_parallelize__WEBPACK_IMPORTED_MODULE_2__["parallelizeBatches"])(batchedProjects, async project => {
|
||||
if (project.hasScript(scriptName)) {
|
||||
_utils_log__WEBPACK_IMPORTED_MODULE_1__["log"].info(`[${project.name}] running "${scriptName}" script`);
|
||||
await project.runScriptStreaming(scriptName, {
|
||||
args: scriptArgs
|
||||
});
|
||||
_utils_log__WEBPACK_IMPORTED_MODULE_1__["log"].success(`[${project.name}] complete`);
|
||||
if (!project.hasScript(scriptName)) {
|
||||
if (!!options['skip-missing']) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new _utils_errors__WEBPACK_IMPORTED_MODULE_0__["CliError"](`[${project.name}] no "${scriptName}" script defined. To skip packages without the "${scriptName}" script pass --skip-missing`);
|
||||
}
|
||||
|
||||
_utils_log__WEBPACK_IMPORTED_MODULE_1__["log"].info(`[${project.name}] running "${scriptName}" script`);
|
||||
await project.runScriptStreaming(scriptName, {
|
||||
args: scriptArgs
|
||||
});
|
||||
_utils_log__WEBPACK_IMPORTED_MODULE_1__["log"].success(`[${project.name}] complete`);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,9 @@ function help() {
|
|||
--debug Set log level to debug
|
||||
--quiet Set log level to error
|
||||
--silent Disable log output
|
||||
|
||||
"run" options:
|
||||
--skip-missing Ignore packages which don't have the requested script
|
||||
` + '\n'
|
||||
);
|
||||
}
|
||||
|
@ -49,7 +52,7 @@ export async function run(argv: string[]) {
|
|||
log.setLogLevel(
|
||||
pickLevelFromFlags(
|
||||
getopts(argv, {
|
||||
boolean: ['verbose', 'debug', 'quiet', 'silent'],
|
||||
boolean: ['verbose', 'debug', 'quiet', 'silent', 'skip-missing'],
|
||||
})
|
||||
)
|
||||
);
|
||||
|
|
|
@ -16,7 +16,7 @@ export const RunCommand: ICommand = {
|
|||
description: 'Run script defined in package.json in each package that contains that script.',
|
||||
name: 'run',
|
||||
|
||||
async run(projects, projectGraph, { extraArgs }) {
|
||||
async run(projects, projectGraph, { extraArgs, options }) {
|
||||
const batchedProjects = topologicallyBatchProjects(projects, projectGraph);
|
||||
|
||||
if (extraArgs.length === 0) {
|
||||
|
@ -27,13 +27,21 @@ export const RunCommand: ICommand = {
|
|||
const scriptArgs = extraArgs.slice(1);
|
||||
|
||||
await parallelizeBatches(batchedProjects, async (project) => {
|
||||
if (project.hasScript(scriptName)) {
|
||||
log.info(`[${project.name}] running "${scriptName}" script`);
|
||||
await project.runScriptStreaming(scriptName, {
|
||||
args: scriptArgs,
|
||||
});
|
||||
log.success(`[${project.name}] complete`);
|
||||
if (!project.hasScript(scriptName)) {
|
||||
if (!!options['skip-missing']) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new CliError(
|
||||
`[${project.name}] no "${scriptName}" script defined. To skip packages without the "${scriptName}" script pass --skip-missing`
|
||||
);
|
||||
}
|
||||
|
||||
log.info(`[${project.name}] running "${scriptName}" script`);
|
||||
await project.runScriptStreaming(scriptName, {
|
||||
args: scriptArgs,
|
||||
});
|
||||
log.success(`[${project.name}] complete`);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
source src/dev/ci_setup/setup_env.sh
|
||||
|
||||
checks-reporter-with-killswitch "Test Projects" \
|
||||
yarn kbn run test --exclude kibana --oss --skip-kibana-plugins
|
||||
yarn kbn run test --exclude kibana --oss --skip-kibana-plugins --skip-missing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue