[kbn-pm] rename from kbn-build (#16739)

This commit is contained in:
Spencer 2018-02-14 10:57:13 -07:00 committed by GitHub
parent db83c8cd9b
commit 4d246a10a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 67 additions and 65 deletions

View file

@ -13,8 +13,8 @@
/packages/*/target
/packages/eslint-config-kibana
/packages/eslint-plugin-kibana-custom
/packages/kbn-build/dist
/packages/kbn-build/vendor
/packages/kbn-build/**/fixtures
/packages/kbn-pm/dist
/packages/kbn-pm/vendor
/packages/kbn-pm/**/fixtures
/packages/kbn-plugin-generator/sao_template/template
!/.eslintrc.js

View file

@ -18,7 +18,7 @@ module.exports = {
{
files: [
'.eslintrc.js',
'packages/kbn-build/**/*',
'packages/kbn-pm/**/*',
'packages/kbn-datemath/**/*.js',
'packages/kbn-plugin-generator/**/*',
],

View file

@ -166,7 +166,7 @@ Bootstrap Kibana and install all the dependencies
yarn kbn bootstrap
```
(You can also run `yarn kbn` to see the other available commands. For more info about this tool, see https://github.com/elastic/kibana/tree/master/packages/kbn-build.)
(You can also run `yarn kbn` to see the other available commands. For more info about this tool, see https://github.com/elastic/kibana/tree/master/packages/kbn-pm.)
Start elasticsearch.

View file

@ -81,7 +81,7 @@
"@elastic/numeral": "2.3.1",
"@elastic/ui-ace": "0.2.3",
"@kbn/babel-preset": "link:packages/kbn-babel-preset",
"@kbn/build": "link:packages/kbn-build",
"@kbn/pm": "link:packages/kbn-pm",
"@kbn/datemath": "link:packages/kbn-datemath",
"@kbn/test-subj-selector": "link:packages/kbn-test-subj-selector",
"accept-language-parser": "1.2.0",

View file

@ -30,7 +30,7 @@ the relative location of the Kibana repo, so it would instead be:
```
How all of this works is described in more detail in the
[`@kbn/build` docs](./kbn-build#how-it-works).
[`@kbn/pm` docs](./kbn-pm#how-it-works).
## Creating a new package

View file

@ -1,11 +1,11 @@
# `kbn-build` — The Kibana build tool
# `@kbn/pm` — The Kibana project management tool
`kbn-build` is a build/monorepo tool inspired by Lerna, which enables sharing
`@kbn/pm` is a project management tool inspired by Lerna, which enables sharing
code between Kibana and Kibana plugins.
To run `kbn-build`, go to Kibana root and run `yarn kbn`.
To run `@kbn/pm`, go to Kibana root and run `yarn kbn`.
## Why `kbn-build`?
## Why `@kbn/pm`?
Long-term we want to get rid of Webpack from production (basically, it's causing
a lot of problems, using a lot of memory and adding a lot of complexity).
@ -45,7 +45,7 @@ the Kibana folder.
Basically, we just want to be able to share "static code" (aka being able to
`import`) between Kibana and Kibana plugins. To get there we need tooling.
`kbn-build` is a tool that helps us manage these static dependencies, and it
`@kbn/pm` is a tool that helps us manage these static dependencies, and it
enables us to share these packages between Kibana and Kibana plugins. It also
enables these packages to have their own dependencies and their own build
scripts, while still having a nice developer experience.
@ -58,18 +58,18 @@ relative location to a package instead of a version when adding it to
`package.json`. For example:
```
"eslint-config-kibana": "link:packages/eslint-config-kibana"
"@kbn/datemath": "link:packages/kbn-datemath"
```
Now when you run `yarn` it will set up a symlink to this folder instead of
downloading code from the npm registry. That means you can make changes to
eslint-config-kibana and immediately have them available in Kibana itself. No
`@kbn/datematch` and immediately have them available in Kibana itself. No
`npm publish` needed anymore — Kibana will always rely directly on the code
that's in the local packages. And we can also do the same in x-pack-kibana or
any other Kibana plugin, e.g.
```
"eslint-config-kibana": "link:../../kibana/packages/eslint-config-kibana"
"@kbn/datemath": "link:../../kibana/packages/kbn-date-math"
```
This works because we moved to a strict location of Kibana plugins,
@ -94,7 +94,7 @@ packages from their local Kibana.
### Bootstrapping
Now, instead of installing all the dependencies with just running `yarn` you use
the `kbn-build` tool, which can install dependencies (and set up symlinks) in
the `@kbn/pm` tool, which can install dependencies (and set up symlinks) in
all the packages using one command (aka "bootstrap" the setup).
To bootstrap Kibana:
@ -103,7 +103,7 @@ To bootstrap Kibana:
yarn kbn bootstrap
```
By default, `kbn-build` will bootstrap all packages within Kibana, plus all
By default, `@kbn/pm` will bootstrap all packages within Kibana, plus all
Kibana plugins located in `../kibana-extra`. There are several options for
skipping parts of this, e.g. to skip bootstrapping of Kibana plugins:
@ -140,7 +140,7 @@ yarn kbn run build --skip-kibana
## Building packages for production
The production build process relies on both the Grunt setup at the root of the
Kibana project and code in `kbn-build`. The full process is described in
Kibana project and code in `@kbn/pm`. The full process is described in
`tasks/build/packages.js`.
## Development

View file

@ -1,5 +1,5 @@
{
"name": "@kbn/build",
"name": "@kbn/pm",
"main": "./dist/index.js",
"version": "1.0.0",
"license": "Apache-2.0",

View file

@ -15,11 +15,11 @@ Array [
"name": "kibana",
"version": "1.0.0",
},
"nodeModulesLocation": "<repoRoot>/packages/kbn-build/src/commands/node_modules",
"packageJsonLocation": "<repoRoot>/packages/kbn-build/src/commands/package.json",
"path": "<repoRoot>/packages/kbn-build/src/commands",
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/node_modules",
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/package.json",
"path": "<repoRoot>/packages/kbn-pm/src/commands",
"scripts": Object {},
"targetLocation": "<repoRoot>/packages/kbn-build/src/commands/target",
"targetLocation": "<repoRoot>/packages/kbn-pm/src/commands/target",
},
"bar" => Project {
"allDependencies": Object {},
@ -30,13 +30,13 @@ Array [
},
"version": "1.0.0",
},
"nodeModulesLocation": "<repoRoot>/packages/kbn-build/src/commands/packages/bar/node_modules",
"packageJsonLocation": "<repoRoot>/packages/kbn-build/src/commands/packages/bar/package.json",
"path": "<repoRoot>/packages/kbn-build/src/commands/packages/bar",
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/node_modules",
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/package.json",
"path": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
"scripts": Object {
"kbn:bootstrap": "node ./bar.js",
},
"targetLocation": "<repoRoot>/packages/kbn-build/src/commands/packages/bar/target",
"targetLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/target",
},
},
Map {
@ -50,13 +50,13 @@ Array [
},
"version": "1.0.0",
},
"nodeModulesLocation": "<repoRoot>/packages/kbn-build/src/commands/packages/bar/node_modules",
"packageJsonLocation": "<repoRoot>/packages/kbn-build/src/commands/packages/bar/package.json",
"path": "<repoRoot>/packages/kbn-build/src/commands/packages/bar",
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/node_modules",
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/package.json",
"path": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
"scripts": Object {
"kbn:bootstrap": "node ./bar.js",
},
"targetLocation": "<repoRoot>/packages/kbn-build/src/commands/packages/bar/target",
"targetLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/target",
},
],
"bar" => Array [],
@ -79,13 +79,13 @@ Array [
},
"version": "1.0.0",
},
"nodeModulesLocation": "<repoRoot>/packages/kbn-build/src/commands/packages/bar/node_modules",
"packageJsonLocation": "<repoRoot>/packages/kbn-build/src/commands/packages/bar/package.json",
"path": "<repoRoot>/packages/kbn-build/src/commands/packages/bar",
"nodeModulesLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/node_modules",
"packageJsonLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/package.json",
"path": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
"scripts": Object {
"kbn:bootstrap": "node ./bar.js",
},
"targetLocation": "<repoRoot>/packages/kbn-build/src/commands/packages/bar/target",
"targetLocation": "<repoRoot>/packages/kbn-pm/src/commands/packages/bar/target",
},
],
]
@ -94,7 +94,7 @@ Array [
exports[`does not run installer if no deps in package: install in dir 1`] = `
Array [
Array [
"<repoRoot>/packages/kbn-build/src/commands",
"<repoRoot>/packages/kbn-pm/src/commands",
Array [],
],
]
@ -133,7 +133,7 @@ Bootstrapping completed!
exports[`handles "frozen-lockfile": install in dir 1`] = `
Array [
Array [
"<repoRoot>/packages/kbn-build/src/commands",
"<repoRoot>/packages/kbn-pm/src/commands",
Array [
"--frozen-lockfile",
],
@ -144,15 +144,15 @@ Array [
exports[`handles dependencies of dependencies: install in dir 1`] = `
Array [
Array [
"<repoRoot>/packages/kbn-build/src/commands/packages/bar",
"<repoRoot>/packages/kbn-pm/src/commands/packages/bar",
Array [],
],
Array [
"<repoRoot>/packages/kbn-build/src/commands",
"<repoRoot>/packages/kbn-pm/src/commands",
Array [],
],
Array [
"<repoRoot>/packages/kbn-build/src/commands/packages/foo",
"<repoRoot>/packages/kbn-pm/src/commands/packages/foo",
Array [],
],
]

View file

@ -11,7 +11,7 @@ import { getProjects } from '../../utils/projects';
// and more integration-y, as we're trying to not add very slow tests to our
// Jest unit tests.
describe('kbn-build production', function() {
describe('kbn-pm production', function() {
it('builds and copies projects for production', async function() {
this.timeout(60 * 1000);

View file

@ -7,10 +7,10 @@ Object {
"isDirectory": Array [],
"isFile": Array [
Array [
"<repoRoot>/packages/kbn-build/src/utils/bar/bin/bar.js",
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
],
Array [
"<repoRoot>/packages/kbn-build/src/utils/bar/bin/bar.js",
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
],
],
"mkdirp": Array [],
@ -22,41 +22,41 @@ exports[`bin script points to a file creates a symlink in the project node_modul
Object {
"chmod": Array [
Array [
"<repoRoot>/packages/kbn-build/src/utils/foo/node_modules/.bin/bar",
"<repoRoot>/packages/kbn-pm/src/utils/foo/node_modules/.bin/bar",
"755",
],
Array [
"<repoRoot>/packages/kbn-build/src/utils/baz/node_modules/.bin/bar",
"<repoRoot>/packages/kbn-pm/src/utils/baz/node_modules/.bin/bar",
"755",
],
],
"createSymlink": Array [
Array [
"<repoRoot>/packages/kbn-build/src/utils/bar/bin/bar.js",
"<repoRoot>/packages/kbn-build/src/utils/foo/node_modules/.bin/bar",
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
"<repoRoot>/packages/kbn-pm/src/utils/foo/node_modules/.bin/bar",
"exec",
],
Array [
"<repoRoot>/packages/kbn-build/src/utils/bar/bin/bar.js",
"<repoRoot>/packages/kbn-build/src/utils/baz/node_modules/.bin/bar",
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
"<repoRoot>/packages/kbn-pm/src/utils/baz/node_modules/.bin/bar",
"exec",
],
],
"isDirectory": Array [],
"isFile": Array [
Array [
"<repoRoot>/packages/kbn-build/src/utils/bar/bin/bar.js",
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
],
Array [
"<repoRoot>/packages/kbn-build/src/utils/bar/bin/bar.js",
"<repoRoot>/packages/kbn-pm/src/utils/bar/bin/bar.js",
],
],
"mkdirp": Array [
Array [
"<repoRoot>/packages/kbn-build/src/utils/foo/node_modules/.bin",
"<repoRoot>/packages/kbn-pm/src/utils/foo/node_modules/.bin",
],
Array [
"<repoRoot>/packages/kbn-build/src/utils/baz/node_modules/.bin",
"<repoRoot>/packages/kbn-pm/src/utils/baz/node_modules/.bin",
],
],
"readFile": Array [],

View file

@ -1,2 +1,2 @@
require('../packages/kbn-build/cli');
require('../packages/kbn-pm/cli');

View file

@ -9,7 +9,7 @@ if (!process.env.BABEL_CACHE_PATH) {
// paths that babel-register should ignore
const ignore = [
/[\\\/](node_modules|bower_components)[\\\/]/,
/[\\\/](kbn-build\/dist)[\\\/]/
/[\\\/](kbn-pm\/dist)[\\\/]/
];
if (global.__BUILT_WITH_BABEL__) {

View file

@ -6,7 +6,7 @@ import { extract, getPackData } from './pack';
import { renamePlugin } from './rename';
import { sync as rimrafSync } from 'rimraf';
import { existingInstall, rebuildCache, assertVersion } from './kibana';
import { prepareExternalProjectDependencies } from '@kbn/build';
import { prepareExternalProjectDependencies } from '@kbn/pm';
import mkdirp from 'mkdirp';
const mkdir = Promise.promisify(mkdirp);

View file

@ -15,6 +15,7 @@ export const IGNORE_FILE_GLOBS = [
'Gruntfile.js',
'tasks/config/**/*',
'tasks/build/docker/docs/{Dockerfile,docker-compose.yml}',
'packages/kbn-pm/vendor/yarn-1.3.2.js'
];
@ -53,6 +54,7 @@ export const IGNORE_DIRECTORY_GLOBS = [
'src/ui/public/flot-charts',
'src/ui/public/utils/lodash-mixins',
'test/functional/fixtures/es_archiver/visualize_source-filters',
'packages/kbn-pm/src/utils/__fixtures__/*'
];

View file

@ -4,7 +4,7 @@ module.exports = function (grunt) {
// We rely on a local version of Yarn that contains the bugfix from
// https://github.com/yarnpkg/yarn/pull/5059. Once this fix is merged
// and released we can use Yarn directly in the build.
const yarn = require.resolve('../../packages/kbn-build/vendor/yarn-1.3.2.js');
const yarn = require.resolve('../../packages/kbn-pm/vendor/yarn-1.3.2.js');
// We're using `pure-lockfile` instead of `frozen-lockfile` because we
// rewrite `link:` dependencies to `file:` dependencies earlier in the

View file

@ -1,4 +1,4 @@
import { transformDependencies } from '@kbn/build';
import { transformDependencies } from '@kbn/pm';
module.exports = function (grunt) {
const pkg = grunt.config.get('pkg');

View file

@ -1,4 +1,4 @@
import { buildProductionProjects } from '@kbn/build';
import { buildProductionProjects } from '@kbn/pm';
/**
* High-level overview of how we enable shared packages in production:
@ -6,15 +6,15 @@ import { buildProductionProjects } from '@kbn/build';
* tl;dr We copy the packages directly into Kibana's `node_modules` folder,
* which means they will be available when `require(...)`d.
*
* During development we rely on `@kbn/build` to find all the packages
* During development we rely on `@kbn/pm` to find all the packages
* in the Kibana repo and run Yarn in all the right places to create symlinks
* between these packages. This development setup is described in-depth in the
* readme in `@kbn/build`.
* readme in `@kbn/pm`.
*
* However, for production we can't use `@kbn/build` as part of the
* However, for production we can't use `@kbn/pm` as part of the
* installation as we don't have an install "tool/step" that can kick it off.
* We also can't include symlinks in the archives for the different platform, so
* we can't run `@kbn/build` in the same way we do for development and
* we can't run `@kbn/pm` in the same way we do for development and
* just package the result. That means we have two options: either we prepare
* everything in the built package or we perform the necessary actions when
* Kibana is starting up in production. We decided on the former: all the Kibana

View file

@ -14,7 +14,7 @@ export default {
src: [
'test/**/__tests__/**/*.js',
'src/**/__tests__/**/*.js',
'packages/kbn-build/**/__tests__/**/*.js',
'packages/kbn-pm/**/__tests__/**/*.js',
'packages/kbn-datemath/test/**/*.js',
'tasks/**/__tests__/**/*.js',
'test/fixtures/__tests__/*.js',

View file

@ -118,7 +118,7 @@
version "0.0.0"
uid ""
"@kbn/build@link:packages/kbn-build":
"@kbn/pm@link:packages/kbn-pm":
version "0.0.0"
uid ""