Skip to content

Commit

Permalink
[kbn/pm] Get rid of --skip-kibana in favour of --exclude kibana. (e…
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin authored Apr 12, 2018
1 parent 39729fc commit 35e01f2
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 25 deletions.
29 changes: 27 additions & 2 deletions packages/kbn-pm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ skipping parts of this, e.g. to skip bootstrapping of Kibana plugins:
yarn kbn bootstrap --skip-kibana-extra
```

Or just skip few selected packages:

```
yarn kbn bootstrap --exclude @kbn/pm --exclude @kbn/datemath
```

For more details, run:

```
Expand All @@ -131,11 +137,30 @@ yarn kbn run build
```

And if needed, you can skip packages in the same way as for bootstrapping, e.g.
`--skip-kibana` and `--skip-kibana-extra`:
with `--exclude` and `--skip-kibana-extra`:

```
yarn kbn run build --exclude kibana
```

### Watching

During development you can also use `kbn` to watch for changes. For this to work
package should define `kbn:watch` script in the `package.json`:

```
yarn kbn run build --skip-kibana
yarn kbn watch
```

By default `kbn watch` will sort all packages within Kibana into batches based on
their mutual dependencies and run watch script for all packages in the correct order.

As with any other `kbn` command, you can use `--include` and `--exclude` filters to watch
only for a selected packages:

```
yarn kbn watch --include @kbn/pm --include kibana
```

## Building packages for production

Expand Down
7 changes: 1 addition & 6 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36109,11 +36109,7 @@ var _path = __webpack_require__(3);
*/
function getProjectPaths(rootPath, options) {
const skipKibanaExtra = Boolean(options['skip-kibana-extra']);
const skipKibana = Boolean(options['skip-kibana']);
const projectPaths = [(0, _path.resolve)(rootPath, 'packages/*')];
if (!skipKibana) {
projectPaths.push(rootPath);
}
const projectPaths = [rootPath, (0, _path.resolve)(rootPath, 'packages/*')];
if (!skipKibanaExtra) {
projectPaths.push((0, _path.resolve)(rootPath, '../kibana-extra/*'));
projectPaths.push((0, _path.resolve)(rootPath, '../kibana-extra/*/packages/*'));
Expand Down Expand Up @@ -36329,7 +36325,6 @@ function help() {

-e, --exclude Exclude specified project. Can be specified multiple times to exclude multiple projects, e.g. '-e kibana -e @kbn/pm'.
-i, --include Include only specified projects. If left unspecified, it defaults to including all projects.
--skip-kibana Do not include the root Kibana project when running command.
--skip-kibana-extra Filter all plugins in ../kibana-extra when running command.
`);
}
Expand Down
14 changes: 7 additions & 7 deletions packages/kbn-pm/src/__snapshots__/run.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Object {
},
"projects": Array [
"bar",
"kibana",
"with-additional-projects",
"baz",
"kibana",
"quux",
"with-additional-projects",
],
}
`;
Expand All @@ -33,8 +33,8 @@ Object {
},
"projects": Array [
"kibana",
"with-additional-projects",
"quux",
"with-additional-projects",
],
}
`;
Expand All @@ -52,8 +52,8 @@ Object {
},
"projects": Array [
"bar",
"foo",
"baz",
"foo",
],
}
`;
Expand Down Expand Up @@ -90,11 +90,11 @@ Object {
},
"projects": Array [
"bar",
"baz",
"foo",
"kibana",
"with-additional-projects",
"baz",
"quux",
"with-additional-projects",
],
}
`;
Expand All @@ -106,8 +106,8 @@ Object {
"foo": Array [],
},
"projects": Array [
"foo",
"baz",
"foo",
],
}
`;
1 change: 0 additions & 1 deletion packages/kbn-pm/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function help() {
-e, --exclude Exclude specified project. Can be specified multiple times to exclude multiple projects, e.g. '-e kibana -e @kbn/pm'.
-i, --include Include only specified projects. If left unspecified, it defaults to including all projects.
--skip-kibana Do not include the root Kibana project when running command.
--skip-kibana-extra Filter all plugins in ../kibana-extra when running command.
`);
}
Expand Down
8 changes: 1 addition & 7 deletions packages/kbn-pm/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@ import { resolve } from 'path';

export type ProjectPathOptions = {
'skip-kibana-extra'?: boolean;
'skip-kibana'?: boolean;
};

/**
* Returns all the paths where plugins are located
*/
export function getProjectPaths(rootPath: string, options: ProjectPathOptions) {
const skipKibanaExtra = Boolean(options['skip-kibana-extra']);
const skipKibana = Boolean(options['skip-kibana']);

const projectPaths = [resolve(rootPath, 'packages/*')];

if (!skipKibana) {
projectPaths.push(rootPath);
}
const projectPaths = [rootPath, resolve(rootPath, 'packages/*')];

if (!skipKibanaExtra) {
projectPaths.push(resolve(rootPath, '../kibana-extra/*'));
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/src/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function getExpectedProjectsAndGraph(runMock: any) {
any
>).mock.calls[0];

const projects = [...fullProjects.keys()];
const projects = [...fullProjects.keys()].sort();

const graph = [...fullProjectGraph.entries()].reduce(
(expected, [projectName, dependencies]) => {
Expand Down
2 changes: 1 addition & 1 deletion tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module.exports = function (grunt) {
function runProjectsTests() {
const serverCmd = {
cmd: 'yarn',
args: ['kbn', 'run', 'test', '--skip-kibana', '--skip-kibana-extra'],
args: ['kbn', 'run', 'test', '--exclude', 'kibana', '--skip-kibana-extra'],
opts: { stdio: 'inherit' }
};

Expand Down

0 comments on commit 35e01f2

Please sign in to comment.