diff --git a/packages/kbn-pm/.babelrc b/packages/osd-pm/.babelrc similarity index 100% rename from packages/kbn-pm/.babelrc rename to packages/osd-pm/.babelrc diff --git a/packages/kbn-pm/README.md b/packages/osd-pm/README.md similarity index 60% rename from packages/kbn-pm/README.md rename to packages/osd-pm/README.md index 2023f7a4cdc1..aaaaedea5ae8 100644 --- a/packages/kbn-pm/README.md +++ b/packages/osd-pm/README.md @@ -1,52 +1,52 @@ -# `@kbn/pm` — The Kibana project management tool +# `@osd/pm` — The OpenSearch Dashboards project management tool -`@kbn/pm` is a project management tool inspired by Lerna, which enables sharing -code between Kibana and Kibana plugins. +`@osd/pm` is a project management tool inspired by Lerna, which enables sharing +code between OpenSearch Dashboards and OpenSearch Dashboards plugins. -To run `@kbn/pm`, go to Kibana root and run `yarn kbn`. +To run `@osd/pm`, go to OpenSearch Dashboards root and run `yarn osd`. -## Why `@kbn/pm`? +## Why `@osd/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). Ideally we want each plugin to build its own separate production bundles for -both server and UI. To get there all Kibana plugins (including x-pack) need to -be able to build their production bundles separately from Kibana, which means -they need to be able to depend on code from Kibana without `import`-ing random -files directly from the Kibana source code. +both server and UI. To get there all OpenSearch Dashboards plugins (including x-pack) need to +be able to build their production bundles separately from OpenSearch Dashboards , which means +they need to be able to depend on code from OpenSearch Dashboards without `import`-ing random +files directly from the OpenSearch Dashboards source code. -From a plugin perspective there are two different types of Kibana dependencies: +From a plugin perspective there are two different types of OpenSearch Dashboards dependencies: runtime and static dependencies. Runtime dependencies are things that are instantiated at runtime and that are injected into the plugin, for example -config and elasticsearch clients. Static dependencies are those dependencies +config and opensearch clients. Static dependencies are those dependencies that we want to `import`. `elastic-eslint-config-kibana` is one example of this, and it's actually needed because eslint requires it to be a separate package. But we also have dependencies like `datemath`, `flot`, `eui` and others that we control, but where we want to `import` them in plugins instead of injecting them (because injecting them would be painful to work with). (Btw, these examples -aren't necessarily a part of the Kibana repo today, they are just meant as +aren't necessarily a part of the OpenSearch Dashboards repo today, they are just meant as examples of code that we might at some point want to include in the repo while -having them be `import`able in Kibana plugins like any other npm package) +having them be `import`able in OpenSearch Dashboards plugins like any other npm package) Another reason we need static dependencies is that we're starting to introduce -TypeScript into Kibana, and to work nicely with TypeScript across plugins we +TypeScript into OpenSearch Dashboards , and to work nicely with TypeScript across plugins we need to be able to statically import dependencies. We have for example built an -observable library for Kibana in TypeScript and we need to expose both the +observable library for OpenSearch Dashboards in TypeScript and we need to expose both the functionality and the TypeScript types to plugins (so other plugins built with TypeScript can depend on the types for the lib). However, even though we have multiple packages we don't necessarily want to `npm publish` them. The ideal solution for us is being able to work on code -locally in the Kibana repo and have a nice workflow that doesn't require +locally in the OpenSearch Dashboards repo and have a nice workflow that doesn't require publishing, but where we still get the value of having "packages" that are available to plugins, without these plugins having to import files directly from -the Kibana folder. +the OpenSearch Dashboards 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. +`import`) between OpenSearch Dashboards and OpenSearch Dashboards plugins. To get there we need tooling. -`@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 +`@osd/pm` is a tool that helps us manage these static dependencies, and it +enables us to share these packages between OpenSearch Dashboards and OpenSearch Dashboards plugins. It also enables these packages to have their own dependencies and their own build scripts, while still having a nice developer experience. @@ -54,93 +54,93 @@ scripts, while still having a nice developer experience. ### Internal usage -For packages that are referenced within the Kibana repo itself (for example, -using the `@kbn/i18n` package from an `x-pack` plugin), we are leveraging +For packages that are referenced within the OpenSearch Dashboards repo itself (for example, +using the `@osd/i18n` package from an `x-pack` plugin), we are leveraging Yarn's workspaces feature. This allows yarn to optimize node_modules within the entire repo to avoid duplicate modules by hoisting common packages as high in the dependency tree as possible. -To reference a package from within the Kibana repo, simply use the current -version number from that package's package.json file. Then, running `yarn kbn +To reference a package from within the OpenSearch Dashboards repo, simply use the current +version number from that package's package.json file. Then, running `yarn osd bootstrap` will symlink that package into your dependency tree. That means -you can make changes to `@kbn/i18n` and immediately have them available -in Kibana itself. No `npm publish` needed anymore — Kibana will always rely +you can make changes to `@osd/i18n` and immediately have them available +in OpenSearch Dashboards itself. No `npm publish` needed anymore — OpenSearch Dashboards will always rely directly on the code that's in the local packages. ### External Plugins -For external plugins, referencing packages in Kibana relies on +For external plugins, referencing packages in OpenSearch Dashboards relies on `link:` style dependencies in Yarn. With `link:` dependencies you specify the relative location to a package instead of a version when adding it to `package.json`. For example: ``` -"@kbn/i18n": "link:packages/kbn-i18n" +"@osd/i18n": "link:packages/osd-i18n" ``` Now when you run `yarn` it will set up a symlink to this folder instead of downloading code from the npm registry. This allows external plugins to always -use the versions of the package that is bundled with the Kibana version they +use the versions of the package that is bundled with the OpenSearch Dashboards version they are running inside of. ``` -"@kbn/i18n": "link:../../kibana/packages/kbn-date-math" +"@osd/i18n": "link:../../opensearch-dashboards/packages/osd-date-math" ``` -This works because we moved to a strict location of Kibana plugins, -`./plugins/{pluginName}` inside of Kibana, or `../kibana-extra/{pluginName}` -relative to Kibana. This is one of the reasons we wanted to move towards a setup +This works because we moved to a strict location of OpenSearch Dashboards plugins, +`./plugins/{pluginName}` inside of OpenSearch Dashboards , or `../opensearch-dashboards-extra/{pluginName}` +relative to OpenSearch Dashboards . This is one of the reasons we wanted to move towards a setup that looks like this: ``` -elastic -└── kibana +opensearch +└── opensearch-dashboards └── plugins - ├── kibana-canvas - └── x-pack-kibana + ├── opensearch-dashboards-canvas + └── x-pack-opensearch-dashboards ``` Relying on `link:` style dependencies means we no longer need to `npm publish` -our Kibana specific packages. It also means that plugin authors no longer need -to worry about the versions of the Kibana packages, as they will always use the -packages from their local Kibana. +our OpenSearch Dashboards specific packages. It also means that plugin authors no longer need +to worry about the versions of the OpenSearch Dashboards packages, as they will always use the +packages from their local OpenSearch Dashboards . -## The `kbn` use-cases +## The `osd` use-cases ### Bootstrapping Now, instead of installing all the dependencies with just running `yarn` you use -the `@kbn/pm` tool, which can install dependencies (and set up symlinks) in +the `@osd/pm` tool, which can install dependencies (and set up symlinks) in all the packages using one command (aka "bootstrap" the setup). -To bootstrap Kibana: +To bootstrap OpenSearch Dashboards : ``` -yarn kbn bootstrap +yarn osd bootstrap ``` -By default, `@kbn/pm` will bootstrap all packages within Kibana, plus all -Kibana plugins located in `./plugins` or `../kibana-extra`. There are several -options for skipping parts of this, e.g. to skip bootstrapping of Kibana +By default, `@osd/pm` will bootstrap all packages within OpenSearch Dashboards , plus all +OpenSearch Dashboards plugins located in `./plugins` or `../opensearch-dashboards-extra`. There are several +options for skipping parts of this, e.g. to skip bootstrapping of OpenSearch Dashboards plugins: ``` -yarn kbn bootstrap --skip-kibana-plugins +yarn osd bootstrap --skip-opensearch-dashboards-plugins ``` Or just skip few selected packages: ``` -yarn kbn bootstrap --exclude @kbn/pm --exclude @kbn/i18n +yarn osd bootstrap --exclude @osd/pm --exclude @osd/i18n ``` For more details, run: ``` -yarn kbn +yarn osd ``` -Bootstrapping also calls the `kbn:bootstrap` script for every included project. +Bootstrapping also calls the `osd:bootstrap` script for every included project. This is intended for packages that need to be built/transpiled to be usable. ### Running scripts @@ -150,44 +150,44 @@ e.g. `build` or `test`. Instead of jumping into each package and running `yarn build` you can run: ``` -yarn kbn run build +yarn osd run build ``` And if needed, you can skip packages in the same way as for bootstrapping, e.g. -with `--exclude` and `--skip-kibana-plugins`: +with `--exclude` and `--skip-opensearch-dashboards-plugins`: ``` -yarn kbn run build --exclude kibana +yarn osd run build --exclude opensearch-dashboards ``` ### 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`: +During development you can also use `osd` to watch for changes. For this to work +package should define `osd:watch` script in the `package.json`: ``` -yarn kbn watch +yarn osd watch ``` -By default `kbn watch` will sort all packages within Kibana into batches based on +By default `osd watch` will sort all packages within OpenSearch Dashboards 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 +As with any other `osd` command, you can use `--include` and `--exclude` filters to watch only for a selected packages: ``` -yarn kbn watch --include @kbn/pm --include kibana +yarn osd watch --include @osd/pm --include opensearch-dashboards ``` ## 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/pm`. The full process is described in +OpenSearch Dashboards project and code in `@osd/pm`. The full process is described in `tasks/build/packages.js`. ## Development -This package is run from Kibana root, using `yarn kbn`. This will run the +This package is run from OpenSearch Dashboards root, using `yarn osd`. This will run the "pre-built" (aka built and committed to git) version of this tool, which is located in the `dist/` folder. This will also use the included version of Yarn instead of using your local install of Yarn. @@ -195,7 +195,7 @@ instead of using your local install of Yarn. If you need to build a new version of this package, run `yarn build` in this folder. -Even though this file is generated we commit it to Kibana, because it's used +Even though this file is generated we commit it to OpenSearch Dashboards , because it's used _before_ dependencies are fetched (as this is the tool actually responsible for fetching dependencies). @@ -217,7 +217,7 @@ something we want to do). #### `file:` dependencies in npm<5 and in yarn -When you add a dependency like `"foo": "file:../../kibana/packages/foo"`, both +When you add a dependency like `"foo": "file:../../opensearch-dashboards/packages/foo"`, both npm<5 and yarn copies the files into the `node_modules` folder. This means you can't easily make changes to the plugin while developing. Therefore this is a no-go. @@ -247,7 +247,7 @@ dependencies for these workspaces and hoist the dependencies to the root (to > filesystem hierarchy. So Yarn workspaces requires a shared root, which (at least currently) doesn't -fit Kibana, and it's therefore a no-go for now. +fit OpenSearch Dashboards , and it's therefore a no-go for now. #### Lerna diff --git a/packages/kbn-pm/cli.js b/packages/osd-pm/cli.js similarity index 100% rename from packages/kbn-pm/cli.js rename to packages/osd-pm/cli.js diff --git a/packages/kbn-pm/dist/index.js b/packages/osd-pm/dist/index.js similarity index 100% rename from packages/kbn-pm/dist/index.js rename to packages/osd-pm/dist/index.js diff --git a/packages/kbn-pm/index.d.ts b/packages/osd-pm/index.d.ts similarity index 100% rename from packages/kbn-pm/index.d.ts rename to packages/osd-pm/index.d.ts diff --git a/packages/kbn-pm/package.json b/packages/osd-pm/package.json similarity index 92% rename from packages/kbn-pm/package.json rename to packages/osd-pm/package.json index 944fcf599863..58fed816c1a6 100644 --- a/packages/kbn-pm/package.json +++ b/packages/osd-pm/package.json @@ -1,15 +1,15 @@ { - "name": "@kbn/pm", + "name": "@osd/pm", "main": "./dist/index.js", "version": "1.0.0", "license": "Apache-2.0", "private": true, - "kibana": { + "opensearchDashboards": { "devOnly": true }, "scripts": { "build": "webpack", - "kbn:watch": "webpack --watch --progress", + "osd:watch": "webpack --watch --progress", "prettier": "prettier --write './src/**/*.ts'" }, "devDependencies": { @@ -35,7 +35,7 @@ "@types/strong-log-transformer": "^1.0.0", "@types/tempy": "^0.2.0", "@types/write-pkg": "^3.1.0", - "@kbn/dev-utils": "1.0.0", + "@osd/dev-utils": "1.0.0", "@yarnpkg/lockfile": "^1.1.0", "babel-loader": "^8.0.6", "chalk": "^4.1.0", @@ -69,7 +69,7 @@ "write-pkg": "^4.0.0" }, "dependencies": { - "@kbn/utils": "1.0.0", + "@osd/utils": "1.0.0", "tslib": "^2.0.0" } } diff --git a/packages/osd-pm/src/README.md b/packages/osd-pm/src/README.md new file mode 100644 index 000000000000..bcd571918ba3 --- /dev/null +++ b/packages/osd-pm/src/README.md @@ -0,0 +1,270 @@ +# `@osd/pm` — The OpenSearch Dashboards project management tool + +`@osd/pm` is a project management tool inspired by Lerna, which enables sharing +code between OpenSearch Dashboards and OpenSearch Dashboards plugins. + +To run `@osd/pm`, go to OpenSearch Dashboards root and run `yarn osd`. + +## Why `@osd/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). +Ideally we want each plugin to build its own separate production bundles for +both server and UI. To get there all OpenSearch Dashboards plugins (including x-pack) need to +be able to build their production bundles separately from OpenSearch Dashboards , which means +they need to be able to depend on code from OpenSearch Dashboards without `import`-ing random +files directly from the OpenSearch Dashboards source code. + +From a plugin perspective there are two different types of OpenSearch Dashboards dependencies: +runtime and static dependencies. Runtime dependencies are things that are +instantiated at runtime and that are injected into the plugin, for example +config and opensearch clients. Static dependencies are those dependencies +that we want to `import`. `opensearch-eslint-config-opensearch-dashboards` is one example of this, and +it's actually needed because eslint requires it to be a separate package. But we +also have dependencies like `datemath`, `flot`, `eui` and others that we +control, but where we want to `import` them in plugins instead of injecting them +(because injecting them would be painful to work with). (Btw, these examples +aren't necessarily a part of the OpenSearch Dashboards repo today, they are just meant as +examples of code that we might at some point want to include in the repo while +having them be `import`able in OpenSearch Dashboards plugins like any other npm package) + +Another reason we need static dependencies is that we're starting to introduce +TypeScript into OpenSearch Dashboards , and to work nicely with TypeScript across plugins we +need to be able to statically import dependencies. We have for example built an +observable library for OpenSearch Dashboards in TypeScript and we need to expose both the +functionality and the TypeScript types to plugins (so other plugins built with +TypeScript can depend on the types for the lib). + +However, even though we have multiple packages we don't necessarily want to +`npm publish` them. The ideal solution for us is being able to work on code +locally in the OpenSearch Dashboards repo and have a nice workflow that doesn't require +publishing, but where we still get the value of having "packages" that are +available to plugins, without these plugins having to import files directly from +the OpenSearch Dashboards folder. + +Basically, we just want to be able to share "static code" (aka being able to +`import`) between OpenSearch Dashboards and OpenSearch Dashboards plugins. To get there we need tooling. + +`@osd/pm` is a tool that helps us manage these static dependencies, and it +enables us to share these packages between OpenSearch Dashboards and OpenSearch Dashboards plugins. It also +enables these packages to have their own dependencies and their own build +scripts, while still having a nice developer experience. + +## How it works + +### Internal usage + +For packages that are referenced within the OpenSearch Dashboards repo itself (for example, +using the `@osd/i18n` package from an `x-pack` plugin), we are leveraging +Yarn's workspaces feature. This allows yarn to optimize node_modules within +the entire repo to avoid duplicate modules by hoisting common packages as high +in the dependency tree as possible. + +To reference a package from within the OpenSearch Dashboards repo, simply use the current +version number from that package's package.json file. Then, running `yarn osd +bootstrap` will symlink that package into your dependency tree. That means +you can make changes to `@osd/i18n` and immediately have them available +in OpenSearch Dashboards itself. No `npm publish` needed anymore — OpenSearch Dashboards will always rely +directly on the code that's in the local packages. + +### External Plugins + +For external plugins, referencing packages in OpenSearch Dashboards relies on +`link:` style dependencies in Yarn. With `link:` dependencies you specify the +relative location to a package instead of a version when adding it to +`package.json`. For example: + +``` +"@osd/i18n": "link:packages/osd-i18n" +``` + +Now when you run `yarn` it will set up a symlink to this folder instead of +downloading code from the npm registry. This allows external plugins to always +use the versions of the package that is bundled with the OpenSearch Dashboards version they +are running inside of. + +``` +"@osd/i18n": "link:../../opensearch-dashboards/packages/osd-date-math" +``` + +This works because we moved to a strict location of OpenSearch Dashboards plugins, +`./plugins/{pluginName}` inside of OpenSearch Dashboards , or `../opensearch-dashboards-extra/{pluginName}` +relative to OpenSearch Dashboards . This is one of the reasons we wanted to move towards a setup +that looks like this: + +``` +opensearch +└── opensearch-dashboards + └── plugins + ├── opensearch-dashboards-canvas + └── x-pack-opensearch-dashboards +``` + +Relying on `link:` style dependencies means we no longer need to `npm publish` +our OpenSearch Dashboards specific packages. It also means that plugin authors no longer need +to worry about the versions of the OpenSearch Dashboards packages, as they will always use the +packages from their local OpenSearch Dashboards . + +## The `osd` use-cases + +### Bootstrapping + +Now, instead of installing all the dependencies with just running `yarn` you use +the `@osd/pm` tool, which can install dependencies (and set up symlinks) in +all the packages using one command (aka "bootstrap" the setup). + +To bootstrap OpenSearch Dashboards : + +``` +yarn osd bootstrap +``` + +By default, `@osd/pm` will bootstrap all packages within OpenSearch Dashboards , plus all +OpenSearch Dashboards plugins located in `./plugins` or `../opensearch-dashboards-extra`. There are several +options for skipping parts of this, e.g. to skip bootstrapping of OpenSearch Dashboards +plugins: + +``` +yarn osd bootstrap --skip-opensearch-dashboards-plugins +``` + +Or just skip few selected packages: + +``` +yarn osd bootstrap --exclude @osd/pm --exclude @osd/i18n +``` + +For more details, run: + +``` +yarn osd +``` + +Bootstrapping also calls the `osd:bootstrap` script for every included project. +This is intended for packages that need to be built/transpiled to be usable. + +### Running scripts + +Some times you want to run the same script across multiple packages and plugins, +e.g. `build` or `test`. Instead of jumping into each package and running +`yarn build` you can run: + +``` +yarn osd run build +``` + +And if needed, you can skip packages in the same way as for bootstrapping, e.g. +with `--exclude` and `--skip-opensearch-dashboards-plugins`: + +``` +yarn osd run build --exclude opensearch-dashboards +``` + +### Watching + +During development you can also use `osd` to watch for changes. For this to work +package should define `osd:watch` script in the `package.json`: + +``` +yarn osd watch +``` + +By default `osd watch` will sort all packages within OpenSearch Dashboards into batches based on +their mutual dependencies and run watch script for all packages in the correct order. + +As with any other `osd` command, you can use `--include` and `--exclude` filters to watch +only for a selected packages: + +``` +yarn osd watch --include @osd/pm --include opensearch-dashboards +``` + +## Building packages for production + +The production build process relies on both the Grunt setup at the root of the +OpenSearch Dashboards project and code in `@osd/pm`. The full process is described in +`tasks/build/packages.js`. + +## Development + +This package is run from OpenSearch Dashboards root, using `yarn osd`. This will run the +"pre-built" (aka built and committed to git) version of this tool, which is +located in the `dist/` folder. This will also use the included version of Yarn +instead of using your local install of Yarn. + +If you need to build a new version of this package, run `yarn build` in this +folder. + +Even though this file is generated we commit it to OpenSearch Dashboards , because it's used +_before_ dependencies are fetched (as this is the tool actually responsible for +fetching dependencies). + +## Technical decisions + +### Why our own tool? + +While exploring the approach to static dependencies we built PoCs using npm 5 +(which symlinks packages using [`file:` dependencies][npm5-file]), [Yarn +workspaces][yarn-workspaces], Yarn (using `link:` dependencies), and +[Lerna][lerna]. + +In the end we decided to build our own tool, based on Yarn, and `link:` +dependencies, and workspaces. This gave us the control we wanted, and it fits +nicely into our context (e.g. where publishing to npm isn't necessarily +something we want to do). + +### Some notes from this exploration + +#### `file:` dependencies in npm<5 and in yarn + +When you add a dependency like `"foo": "file:../../opensearch-dashboards/packages/foo"`, both +npm<5 and yarn copies the files into the `node_modules` folder. This means you +can't easily make changes to the plugin while developing. Therefore this is a +no-go. + +#### `file:` dependencies in npm5 + +In npm5 `file:` dependencies changed to symlink instead of copy the files. This +means you can have a nicer workflow while developing packages locally. However, +we hit several bugs when using this feature, and we often had to re-run +`npm install` in packages. This is likely because we used an early version of +the new `file:` dependencies in npm5. + +#### `link:` dependencies in Yarn + +This is the same feature as `file:` dependencies in npm5. However, we did not +hit any problems with them during our exploration. + +#### Yarn workspaces + +Enables specifying multiple "workspaces" (aka packages/projects) in +`package.json`. When running `yarn` from the root, Yarn will install all the +dependencies for these workspaces and hoist the dependencies to the root (to +"deduplicate" packages). However: + +> Workspaces must be children of the workspace root in term of folder hierarchy. +> You cannot and must not reference a workspace that is located outside of this +> filesystem hierarchy. + +So Yarn workspaces requires a shared root, which (at least currently) doesn't +fit OpenSearch Dashboards , and it's therefore a no-go for now. + +#### Lerna + +Lerna is based on symlinking packages (similarly to the [`link`][npm-link] +feature which exists in both npm and Yarn, but it's not directly using that +feature). It's a tool built specifically for managing JavaScript projects with +multiple packages. However, it's primarily built (i.e. optimized) for monorepo +_libraries_, so it's focused on publishing packages and other use-cases that are +not necessarily optimized for our use-cases. It's also not ideal for the setup +we currently have, with one app that "owns everything" and the rest being +packages for that app. + +### Why a local version of Yarn? + +See the [vendor readme](./vendor/README.md). + +[npm-link]: https://docs.npmjs.com/cli/link +[npm5-file]: https://github.com/npm/npm/pull/15900 +[yarn-workspaces]: https://yarnpkg.com/lang/en/docs/workspaces/ +[lerna]: https://github.com/lerna/lerna diff --git a/packages/kbn-pm/src/__snapshots__/run.test.ts.snap b/packages/osd-pm/src/__snapshots__/run.test.ts.snap similarity index 100% rename from packages/kbn-pm/src/__snapshots__/run.test.ts.snap rename to packages/osd-pm/src/__snapshots__/run.test.ts.snap diff --git a/packages/kbn-pm/src/cli.ts b/packages/osd-pm/src/cli.ts similarity index 85% rename from packages/kbn-pm/src/cli.ts rename to packages/osd-pm/src/cli.ts index 816e84c13bbe..81ce3a86b5e0 100644 --- a/packages/kbn-pm/src/cli.ts +++ b/packages/osd-pm/src/cli.ts @@ -20,7 +20,7 @@ import dedent from 'dedent'; import getopts from 'getopts'; import { resolve } from 'path'; -import { pickLevelFromFlags } from '@kbn/dev-utils/tooling_log'; +import { pickLevelFromFlags } from '@osd/dev-utils/tooling_log'; import { commands } from './commands'; import { runCommand } from './run'; @@ -29,10 +29,10 @@ import { log } from './utils/log'; function help() { log.info( dedent` - usage: kbn [] + usage: osd [] - By default commands are run for Kibana itself, all packages in the 'packages/' - folder and for all plugins in './plugins' and '../kibana-extra'. + By default commands are run for OpenSearch Dashboards itself, all packages in the 'packages/' + folder and for all plugins in './plugins' and '../opensearch-dashboards-extra'. Available commands: @@ -42,10 +42,10 @@ function help() { Global options: - -e, --exclude Exclude specified project. Can be specified multiple times to exclude multiple projects, e.g. '-e kibana -e @kbn/pm'. + -e, --exclude Exclude specified project. Can be specified multiple times to exclude multiple projects, e.g. '-e opensearch-dashboards -e @osd/pm'. -i, --include Include only specified projects. If left unspecified, it defaults to including all projects. --oss Do not include the x-pack when running command. - --skip-kibana-plugins Filter all plugins in ./plugins and ../kibana-extra when running command. + --skip-opensearch-dashboards-plugins Filter all plugins in ./plugins and ../opensearch-dashboards-extra when running command. --no-cache Disable the bootstrap cache --verbose Set log level to verbose --debug Set log level to debug @@ -68,7 +68,7 @@ export async function run(argv: string[]) { // starts forwarding the `--` directly to this script, see // https://github.com/yarnpkg/yarn/blob/b2d3e1a8fe45ef376b716d597cc79b38702a9320/src/cli/index.js#L174-L182 if (argv.includes('--')) { - log.error(`Using "--" is not allowed, as it doesn't work with 'yarn kbn'.`); + log.error(`Using "--" is not allowed, as it doesn't work with 'yarn osd'.`); process.exit(1); } @@ -102,7 +102,7 @@ export async function run(argv: string[]) { const command = commands[commandName]; if (command === undefined) { - log.error(`[${commandName}] is not a valid command, see 'kbn --help'`); + log.error(`[${commandName}] is not a valid command, see 'osd --help'`); process.exit(1); } diff --git a/packages/kbn-pm/src/commands/bootstrap.ts b/packages/osd-pm/src/commands/bootstrap.ts similarity index 86% rename from packages/kbn-pm/src/commands/bootstrap.ts rename to packages/osd-pm/src/commands/bootstrap.ts index caa16fbc9470..711d731b394a 100644 --- a/packages/kbn-pm/src/commands/bootstrap.ts +++ b/packages/osd-pm/src/commands/bootstrap.ts @@ -32,7 +32,7 @@ export const BootstrapCommand: ICommand = { description: 'Install dependencies and crosslink projects', name: 'bootstrap', - async run(projects, projectGraph, { options, kbn }) { + async run(projects, projectGraph, { options, osd }) { const batchedProjectsByWorkspace = topologicallyBatchProjects(projects, projectGraph, { batchByWorkspace: true, }); @@ -56,26 +56,26 @@ export const BootstrapCommand: ICommand = { } } - const yarnLock = await readYarnLock(kbn); + const yarnLock = await readYarnLock(osd); - await validateDependencies(kbn, yarnLock); + await validateDependencies(osd, yarnLock); await linkProjectExecutables(projects, projectGraph); /** - * At the end of the bootstrapping process we call all `kbn:bootstrap` scripts + * At the end of the bootstrapping process we call all `osd:bootstrap` scripts * in the list of projects. We do this because some projects need to be * transpiled before they can be used. Ideally we shouldn't do this unless we * have to, as it will slow down the bootstrapping process. */ - const checksums = await getAllChecksums(kbn, log, yarnLock); + const checksums = await getAllChecksums(osd, log, yarnLock); const caches = new Map(); let cachedProjectCount = 0; for (const project of projects.values()) { - if (project.hasScript('kbn:bootstrap')) { - const file = new BootstrapCacheFile(kbn, project, checksums); + if (project.hasScript('osd:bootstrap')) { + const file = new BootstrapCacheFile(osd, project, checksums); const valid = options.cache && file.isValid(); if (valid) { @@ -94,9 +94,9 @@ export const BootstrapCommand: ICommand = { await parallelizeBatches(batchedProjects, async (project) => { const cache = caches.get(project); if (cache && !cache.valid) { - log.info(`[${project.name}] running [kbn:bootstrap] script`); + log.info(`[${project.name}] running [osd:bootstrap] script`); cache.file.delete(); - await project.runScriptStreaming('kbn:bootstrap'); + await project.runScriptStreaming('osd:bootstrap'); cache.file.write(); log.success(`[${project.name}] bootstrap complete`); } diff --git a/packages/kbn-pm/src/commands/clean.ts b/packages/osd-pm/src/commands/clean.ts similarity index 100% rename from packages/kbn-pm/src/commands/clean.ts rename to packages/osd-pm/src/commands/clean.ts diff --git a/packages/kbn-pm/src/commands/index.ts b/packages/osd-pm/src/commands/index.ts similarity index 93% rename from packages/kbn-pm/src/commands/index.ts rename to packages/osd-pm/src/commands/index.ts index b73e054b0337..32e395e2bd89 100644 --- a/packages/kbn-pm/src/commands/index.ts +++ b/packages/osd-pm/src/commands/index.ts @@ -23,7 +23,7 @@ export interface ICommandConfig { extraArgs: string[]; options: { [key: string]: any }; rootPath: string; - kbn: Kibana; + osd: OpenSearchDashboards; } export interface ICommand { @@ -37,7 +37,7 @@ import { BootstrapCommand } from './bootstrap'; import { CleanCommand } from './clean'; import { RunCommand } from './run'; import { WatchCommand } from './watch'; -import { Kibana } from '../utils/kibana'; +import { OpenSearchDashboards } from '../utils/opensearch_dashboards'; export const commands: { [key: string]: ICommand } = { bootstrap: BootstrapCommand, diff --git a/packages/kbn-pm/src/commands/run.ts b/packages/osd-pm/src/commands/run.ts similarity index 100% rename from packages/kbn-pm/src/commands/run.ts rename to packages/osd-pm/src/commands/run.ts diff --git a/packages/kbn-pm/src/commands/watch.ts b/packages/osd-pm/src/commands/watch.ts similarity index 75% rename from packages/kbn-pm/src/commands/watch.ts rename to packages/osd-pm/src/commands/watch.ts index 6775f728c149..b67e94811a53 100644 --- a/packages/kbn-pm/src/commands/watch.ts +++ b/packages/osd-pm/src/commands/watch.ts @@ -25,33 +25,33 @@ import { waitUntilWatchIsReady } from '../utils/watch'; import { ICommand } from './'; /** - * Name of the script in the package/project package.json file to run during `kbn watch`. + * Name of the script in the package/project package.json file to run during `osd watch`. */ -const watchScriptName = 'kbn:watch'; +const watchScriptName = 'osd:watch'; /** - * Name of the Kibana project. + * Name of the OpenSearch Dashboards project. */ -const kibanaProjectName = 'kibana'; +const opensearchDashboardsProjectName = 'opensearch-dashboards'; /** - * Command that traverses through list of available projects/packages that have `kbn:watch` script in their + * Command that traverses through list of available projects/packages that have `osd:watch` script in their * package.json files, groups them into topology aware batches and then processes theses batches one by one - * running `kbn:watch` scripts in parallel within the same batch. + * running `osd:watch` scripts in parallel within the same batch. * - * Command internally relies on the fact that most of the build systems that are triggered by `kbn:watch` + * Command internally relies on the fact that most of the build systems that are triggered by `osd:watch` * will emit special "marker" once build/watch process is ready that we can use as completion condition for - * the `kbn:watch` script and eventually for the entire batch. Currently we support completion "markers" for + * the `osd:watch` script and eventually for the entire batch. Currently we support completion "markers" for * `webpack` and `tsc` only, for the rest we rely on predefined timeouts. */ export const WatchCommand: ICommand = { - description: 'Runs `kbn:watch` script for every project.', + description: 'Runs `osd:watch` script for every project.', name: 'watch', async run(projects, projectGraph) { const projectsToWatch: ProjectMap = new Map(); for (const project of projects.values()) { - // We can't watch project that doesn't have `kbn:watch` script. + // We can't watch project that doesn't have `osd:watch` script. if (project.hasScript(watchScriptName)) { projectsToWatch.set(project.name, project); } @@ -59,21 +59,21 @@ export const WatchCommand: ICommand = { if (projectsToWatch.size === 0) { throw new CliError( - `There are no projects to watch found. Make sure that projects define 'kbn:watch' script in 'package.json'.` + `There are no projects to watch found. Make sure that projects define 'osd:watch' script in 'package.json'.` ); } const projectNames = Array.from(projectsToWatch.keys()); log.info(`Running ${watchScriptName} scripts for [${projectNames.join(', ')}].`); - // Kibana should always be run the last, so we don't rely on automatic + // OpenSearch Dashboards should always be run the last, so we don't rely on automatic // topological batching and push it to the last one-entry batch manually. - const shouldWatchKibanaProject = projectsToWatch.delete(kibanaProjectName); + const shouldWatchOpenSearchDashboardsProject = projectsToWatch.delete(opensearchDashboardsProjectName); const batchedProjects = topologicallyBatchProjects(projectsToWatch, projectGraph); - if (shouldWatchKibanaProject) { - batchedProjects.push([projects.get(kibanaProjectName)!]); + if (shouldWatchOpenSearchDashboardsProject) { + batchedProjects.push([projects.get(opensearchDashboardsProjectName)!]); } await parallelizeBatches(batchedProjects, async (pkg) => { diff --git a/packages/kbn-pm/src/config.ts b/packages/osd-pm/src/config.ts similarity index 84% rename from packages/kbn-pm/src/config.ts rename to packages/osd-pm/src/config.ts index 59b43b230e60..55e237e1819f 100644 --- a/packages/kbn-pm/src/config.ts +++ b/packages/osd-pm/src/config.ts @@ -21,14 +21,14 @@ import { resolve } from 'path'; interface Options { rootPath: string; - skipKibanaPlugins?: boolean; + skipOpenSearchDashboardsPlugins?: boolean; ossOnly?: boolean; } /** * Returns all the paths where plugins are located */ -export function getProjectPaths({ rootPath, ossOnly, skipKibanaPlugins }: Options) { +export function getProjectPaths({ rootPath, ossOnly, skipOpenSearchDashboardsPlugins }: Options) { const projectPaths = [rootPath, resolve(rootPath, 'packages/*')]; // This is needed in order to install the dependencies for the declared @@ -51,10 +51,10 @@ export function getProjectPaths({ rootPath, ossOnly, skipKibanaPlugins }: Option projectPaths.push(resolve(rootPath, 'x-pack/test/functional_with_es_ssl/fixtures/plugins/*')); } - if (!skipKibanaPlugins) { - projectPaths.push(resolve(rootPath, '../kibana-extra/*')); - projectPaths.push(resolve(rootPath, '../kibana-extra/*/packages/*')); - projectPaths.push(resolve(rootPath, '../kibana-extra/*/plugins/*')); + if (!skipOpenSearchDashboardsPlugins) { + projectPaths.push(resolve(rootPath, '../opensearch-dashboards-extra/*')); + projectPaths.push(resolve(rootPath, '../opensearch-dashboards-extra/*/packages/*')); + projectPaths.push(resolve(rootPath, '../opensearch-dashboards-extra/*/plugins/*')); projectPaths.push(resolve(rootPath, 'plugins/*')); projectPaths.push(resolve(rootPath, 'plugins/*/packages/*')); projectPaths.push(resolve(rootPath, 'plugins/*/plugins/*')); diff --git a/packages/kbn-pm/src/index.ts b/packages/osd-pm/src/index.ts similarity index 100% rename from packages/kbn-pm/src/index.ts rename to packages/osd-pm/src/index.ts diff --git a/packages/kbn-pm/src/production/__fixtures__/external_packages/with_kibana_link_deps/package.json b/packages/osd-pm/src/production/__fixtures__/external_packages/with_opensearch_dashboards_link_deps/package.json similarity index 61% rename from packages/kbn-pm/src/production/__fixtures__/external_packages/with_kibana_link_deps/package.json rename to packages/osd-pm/src/production/__fixtures__/external_packages/with_opensearch_dashboards_link_deps/package.json index c0ed787bcb0e..a491a6fbefda 100644 --- a/packages/kbn-pm/src/production/__fixtures__/external_packages/with_kibana_link_deps/package.json +++ b/packages/osd-pm/src/production/__fixtures__/external_packages/with_opensearch_dashboards_link_deps/package.json @@ -2,6 +2,6 @@ "name": "quux", "version": "1.0.0", "dependencies": { - "@kbn/foo": "link:../../packages/foo" + "@osd/foo": "link:../../packages/foo" } } diff --git a/packages/kbn-pm/src/production/__fixtures__/external_packages/with_other_link_deps/package.json b/packages/osd-pm/src/production/__fixtures__/external_packages/with_other_link_deps/package.json similarity index 100% rename from packages/kbn-pm/src/production/__fixtures__/external_packages/with_other_link_deps/package.json rename to packages/osd-pm/src/production/__fixtures__/external_packages/with_other_link_deps/package.json diff --git a/packages/kbn-pm/src/production/build_production_projects.ts b/packages/osd-pm/src/production/build_production_projects.ts similarity index 80% rename from packages/kbn-pm/src/production/build_production_projects.ts rename to packages/osd-pm/src/production/build_production_projects.ts index f5c59fd582c5..2c8aa9a3a0bb 100644 --- a/packages/kbn-pm/src/production/build_production_projects.ts +++ b/packages/osd-pm/src/production/build_production_projects.ts @@ -34,15 +34,15 @@ import { } from '../utils/projects'; export async function buildProductionProjects({ - kibanaRoot, + opensearchDashboardsRoot, buildRoot, onlyOSS, }: { - kibanaRoot: string; + opensearchDashboardsRoot: string; buildRoot: string; onlyOSS?: boolean; }) { - const projects = await getProductionProjects(kibanaRoot, onlyOSS); + const projects = await getProductionProjects(opensearchDashboardsRoot, onlyOSS); const projectGraph = buildProjectGraph(projects); const batchedProjects = topologicallyBatchProjects(projects, projectGraph); @@ -53,22 +53,22 @@ export async function buildProductionProjects({ for (const project of batch) { await deleteTarget(project); await buildProject(project); - await copyToBuild(project, kibanaRoot, buildRoot); + await copyToBuild(project, opensearchDashboardsRoot, buildRoot); } } } /** * Returns the subset of projects that should be built into the production - * bundle. As we copy these into Kibana's `node_modules` during the build step, - * and let Kibana's build process be responsible for installing dependencies, - * we only include Kibana's transitive _production_ dependencies. If onlyOSS + * bundle. As we copy these into OpenSearch Dashboards 's `node_modules` during the build step, + * and let OpenSearch Dashboards 's build process be responsible for installing dependencies, + * we only include OpenSearch Dashboards 's transitive _production_ dependencies. If onlyOSS * is supplied, we omit projects with build.oss in their package.json set to false. */ async function getProductionProjects(rootPath: string, onlyOSS?: boolean) { const projectPaths = getProjectPaths({ rootPath }); const projects = await getProjects(rootPath, projectPaths); - const projectsSubset = [projects.get('kibana')!]; + const projectsSubset = [projects.get('opensearch-dashboards')!]; if (projects.has('x-pack')) { projectsSubset.push(projects.get('x-pack')!); @@ -78,8 +78,8 @@ async function getProductionProjects(rootPath: string, onlyOSS?: boolean) { onlyProductionDependencies: true, }); - // We remove Kibana, as we're already building Kibana - productionProjects.delete('kibana'); + // We remove OpenSearch Dashboards , as we're already building OpenSearch Dashboards + productionProjects.delete('opensearch-dashboards'); if (onlyOSS) { productionProjects.forEach((project) => { @@ -112,14 +112,14 @@ async function buildProject(project: Project) { * project or some other location defined in the project's `package.json`. * * When copying all the files into the build, we exclude `node_modules` because - * we want the Kibana build to be responsible for actually installing all - * dependencies. The primary reason for allowing the Kibana build process to + * we want the OpenSearch Dashboards build to be responsible for actually installing all + * dependencies. The primary reason for allowing the OpenSearch Dashboards build process to * manage dependencies is that it will "dedupe" them, so we don't include * unnecessary copies of dependencies. */ -async function copyToBuild(project: Project, kibanaRoot: string, buildRoot: string) { +async function copyToBuild(project: Project, opensearchDashboardsRoot: string, buildRoot: string) { // We want the package to have the same relative location within the build - const relativeProjectPath = relative(kibanaRoot, project.path); + const relativeProjectPath = relative(opensearchDashboardsRoot, project.path); const buildProjectPath = resolve(buildRoot, relativeProjectPath); await copy(['**/*', '!node_modules/**'], buildProjectPath, { diff --git a/packages/kbn-pm/src/production/index.ts b/packages/osd-pm/src/production/index.ts similarity index 100% rename from packages/kbn-pm/src/production/index.ts rename to packages/osd-pm/src/production/index.ts diff --git a/packages/kbn-pm/src/run.test.ts b/packages/osd-pm/src/run.test.ts similarity index 96% rename from packages/kbn-pm/src/run.test.ts rename to packages/osd-pm/src/run.test.ts index b2479af3809c..92d9f753b648 100644 --- a/packages/kbn-pm/src/run.test.ts +++ b/packages/osd-pm/src/run.test.ts @@ -26,7 +26,7 @@ import { log } from './utils/log'; log.setLogLevel('silent'); -const rootPath = resolve(`${__dirname}/utils/__fixtures__/kibana`); +const rootPath = resolve(`${__dirname}/utils/__fixtures__/opensearch-dashboards`); function getExpectedProjectsAndGraph(runMock: any) { const [fullProjects, fullProjectGraph] = (runMock as jest.Mock).mock.calls[0]; @@ -42,7 +42,7 @@ function getExpectedProjectsAndGraph(runMock: any) { } let command: ICommand; -let config: Omit; +let config: Omit; beforeEach(() => { command = { description: 'test description', diff --git a/packages/kbn-pm/src/run.ts b/packages/osd-pm/src/run.ts similarity index 88% rename from packages/kbn-pm/src/run.ts rename to packages/osd-pm/src/run.ts index 04286590bd82..ca0ebbc51800 100644 --- a/packages/kbn-pm/src/run.ts +++ b/packages/osd-pm/src/run.ts @@ -22,15 +22,15 @@ import { CliError } from './utils/errors'; import { log } from './utils/log'; import { buildProjectGraph } from './utils/projects'; import { renderProjectsTree } from './utils/projects_tree'; -import { Kibana } from './utils/kibana'; +import { OpenSearchDashboards } from './utils/opensearch_dashboards'; -export async function runCommand(command: ICommand, config: Omit) { +export async function runCommand(command: ICommand, config: Omit) { try { log.debug(`Running [${command.name}] command from [${config.rootPath}]`); - const kbn = await Kibana.loadFrom(config.rootPath); - const projects = kbn.getFilteredProjects({ - skipKibanaPlugins: Boolean(config.options['skip-kibana-plugins']), + const osd = await OpenSearchDashboards.loadFrom(config.rootPath); + const projects = osd.getFilteredProjects({ + skipOpenSearchDashboardsPlugins: Boolean(config.options['skip-opensearch-dashboards-plugins']), ossOnly: Boolean(config.options.oss), exclude: toArray(config.options.exclude), include: toArray(config.options.include), @@ -50,7 +50,7 @@ export async function runCommand(command: ICommand, config: Omit a.name.localeCompare(b.name)) // get the cacheKey for each project, return undefined if the cache key couldn't be determined diff --git a/packages/kbn-pm/src/utils/child_process.ts b/packages/osd-pm/src/utils/child_process.ts similarity index 100% rename from packages/kbn-pm/src/utils/child_process.ts rename to packages/osd-pm/src/utils/child_process.ts diff --git a/packages/kbn-pm/src/utils/errors.ts b/packages/osd-pm/src/utils/errors.ts similarity index 100% rename from packages/kbn-pm/src/utils/errors.ts rename to packages/osd-pm/src/utils/errors.ts diff --git a/packages/kbn-pm/src/utils/fs.ts b/packages/osd-pm/src/utils/fs.ts similarity index 100% rename from packages/kbn-pm/src/utils/fs.ts rename to packages/osd-pm/src/utils/fs.ts diff --git a/packages/kbn-pm/src/utils/link_project_executables.test.ts b/packages/osd-pm/src/utils/link_project_executables.test.ts similarity index 98% rename from packages/kbn-pm/src/utils/link_project_executables.test.ts rename to packages/osd-pm/src/utils/link_project_executables.test.ts index a98d2caa3034..47467771c627 100644 --- a/packages/kbn-pm/src/utils/link_project_executables.test.ts +++ b/packages/osd-pm/src/utils/link_project_executables.test.ts @@ -23,7 +23,7 @@ jest.mock('./fs'); import { resolve } from 'path'; -import { ToolingLogCollectingWriter } from '@kbn/dev-utils/tooling_log'; +import { ToolingLogCollectingWriter } from '@osd/dev-utils/tooling_log'; import { absolutePathSnapshotSerializer, stripAnsiSnapshotSerializer } from '../test_helpers'; import { linkProjectExecutables } from './link_project_executables'; diff --git a/packages/kbn-pm/src/utils/link_project_executables.ts b/packages/osd-pm/src/utils/link_project_executables.ts similarity index 100% rename from packages/kbn-pm/src/utils/link_project_executables.ts rename to packages/osd-pm/src/utils/link_project_executables.ts diff --git a/packages/kbn-pm/src/utils/log.ts b/packages/osd-pm/src/utils/log.ts similarity index 97% rename from packages/kbn-pm/src/utils/log.ts rename to packages/osd-pm/src/utils/log.ts index ac93f96ce5bf..ae82b97418e4 100644 --- a/packages/kbn-pm/src/utils/log.ts +++ b/packages/osd-pm/src/utils/log.ts @@ -23,7 +23,7 @@ import { LogLevel, parseLogLevel, ParsedLogLevel, -} from '@kbn/dev-utils/tooling_log'; +} from '@osd/dev-utils/tooling_log'; class Log extends ToolingLog { private logLevel!: ParsedLogLevel; diff --git a/packages/kbn-pm/src/utils/kibana.ts b/packages/osd-pm/src/utils/opensearch_dashboards.ts similarity index 70% rename from packages/kbn-pm/src/utils/kibana.ts rename to packages/osd-pm/src/utils/opensearch_dashboards.ts index 42b48c85ebd6..8e4a2c02b246 100644 --- a/packages/kbn-pm/src/utils/kibana.ts +++ b/packages/osd-pm/src/utils/opensearch_dashboards.ts @@ -30,45 +30,45 @@ import { getProjectPaths } from '../config'; /** * Helper class for dealing with a set of projects as children of - * the Kibana project. The kbn/pm is currently implemented to be + * the OpenSearch Dashboards project. The osd/pm is currently implemented to be * more generic, where everything is an operation of generic projects, - * but that leads to exceptions where we need the kibana project and - * do things like `project.get('kibana')!`. + * but that leads to exceptions where we need the OpenSearch Dashboards project and + * do things like `project.get('opensearch-dashboards')!`. * * Using this helper we can restructre the generic list of projects - * as a Kibana object which encapulates all the projects in the - * workspace and knows about the root Kibana project. + * as a OpenSearch Dashboards object which encapulates all the projects in the + * workspace and knows about the root OpenSearch Dashboards project. */ -export class Kibana { +export class OpenSearchDashboards { static async loadFrom(rootPath: string) { - return new Kibana(await getProjects(rootPath, getProjectPaths({ rootPath }))); + return new OpenSearchDashboards(await getProjects(rootPath, getProjectPaths({ rootPath }))); } - private readonly kibanaProject: Project; + private readonly opensearchDashboardsProject: Project; constructor(private readonly allWorkspaceProjects: ProjectMap) { - const kibanaProject = allWorkspaceProjects.get('kibana'); + const opensearchDashboardsProject = allWorkspaceProjects.get('opensearch-dashboards'); - if (!kibanaProject) { + if (!opensearchDashboardsProject) { throw new TypeError( - 'Unable to create Kibana object without all projects, including the Kibana project.' + 'Unable to create OpenSearch Dashboards object without all projects, including the OpenSearch Dashboards project.' ); } - this.kibanaProject = kibanaProject; + this.opensearchDashboardsProject = opensearchDashboardsProject; } - /** make an absolute path by resolving subPath relative to the kibana repo */ + /** make an absolute path by resolving subPath relative to the opensearch-dashboards repo */ getAbsolute(...subPath: string[]) { - return Path.resolve(this.kibanaProject.path, ...subPath); + return Path.resolve(this.opensearchDashboardsProject.path, ...subPath); } - /** convert an absolute path to a relative path, relative to the kibana repo */ + /** convert an absolute path to a relative path, relative to the opensearch-dashboards repo */ getRelative(absolute: string) { - return Path.relative(this.kibanaProject.path, absolute); + return Path.relative(this.opensearchDashboardsProject.path, absolute); } - /** get a copy of the map of all projects in the kibana workspace */ + /** get a copy of the map of all projects in the opensearch-dashboards workspace */ getAllProjects() { return new Map(this.allWorkspaceProjects); } @@ -97,7 +97,7 @@ export class Kibana { /** filter the projects to just those matching certain paths/include/exclude tags */ getFilteredProjects(options: { - skipKibanaPlugins: boolean; + skipOpenSearchDashboardsPlugins: boolean; ossOnly: boolean; exclude: string[]; include: string[]; @@ -108,7 +108,7 @@ export class Kibana { const pkgJsonPaths = Array.from(allProjects.values()).map((p) => p.packageJsonLocation); const filteredPkgJsonGlobs = getProjectPaths({ ...options, - rootPath: this.kibanaProject.path, + rootPath: this.opensearchDashboardsProject.path, }).map((g) => Path.resolve(g, 'package.json')); const matchingPkgJsonPaths = multimatch(pkgJsonPaths, filteredPkgJsonGlobs); @@ -127,8 +127,8 @@ export class Kibana { isPartOfRepo(project: Project) { return ( - project.path === this.kibanaProject.path || - isPathInside(project.path, this.kibanaProject.path) + project.path === this.opensearchDashboardsProject.path || + isPathInside(project.path, this.opensearchDashboardsProject.path) ); } @@ -137,15 +137,15 @@ export class Kibana { } resolveAllProductionDependencies(yarnLock: YarnLock, log: Log) { - const kibanaDeps = resolveDepsForProject({ - project: this.kibanaProject, + const opensearchDashboardsDeps = resolveDepsForProject({ + project: this.opensearchDashboardsProject, yarnLock, - kbn: this, + osd: this, includeDependentProject: true, productionDepsOnly: true, log, })!; - return new Map([...kibanaDeps.entries()]); + return new Map([...opensearchDashboardsDeps.entries()]); } } diff --git a/packages/kbn-pm/src/utils/package_json.ts b/packages/osd-pm/src/utils/package_json.ts similarity index 100% rename from packages/kbn-pm/src/utils/package_json.ts rename to packages/osd-pm/src/utils/package_json.ts diff --git a/packages/kbn-pm/src/utils/parallelize.test.ts b/packages/osd-pm/src/utils/parallelize.test.ts similarity index 100% rename from packages/kbn-pm/src/utils/parallelize.test.ts rename to packages/osd-pm/src/utils/parallelize.test.ts diff --git a/packages/kbn-pm/src/utils/parallelize.ts b/packages/osd-pm/src/utils/parallelize.ts similarity index 100% rename from packages/kbn-pm/src/utils/parallelize.ts rename to packages/osd-pm/src/utils/parallelize.ts diff --git a/packages/kbn-pm/src/utils/project.test.ts b/packages/osd-pm/src/utils/project.test.ts similarity index 88% rename from packages/kbn-pm/src/utils/project.test.ts rename to packages/osd-pm/src/utils/project.test.ts index ce4f0bbe8ccf..ac7ff9be17fd 100644 --- a/packages/kbn-pm/src/utils/project.test.ts +++ b/packages/osd-pm/src/utils/project.test.ts @@ -22,12 +22,12 @@ import { join, resolve } from 'path'; import { IPackageJson } from './package_json'; import { Project } from './project'; -const rootPath = resolve(`${__dirname}/__fixtures__/kibana`); +const rootPath = resolve(`${__dirname}/__fixtures__/opensearch-dashboards`); const createProjectWith = (packageJson: IPackageJson, path = '') => new Project( { - name: 'kibana', + name: 'opensearch-dashboards', version: '1.0.0', ...packageJson, }, @@ -36,14 +36,14 @@ const createProjectWith = (packageJson: IPackageJson, path = '') => describe('fromPath', () => { test('reads project.json at path and constructs Project', async () => { - const kibana = await Project.fromPath(rootPath); + const opensearchDashboards = await Project.fromPath(rootPath); - expect(kibana.name).toBe('kibana'); + expect(opensearchDashboards.name).toBe('opensearch-dashboards'); }); }); test('fields', async () => { - const kibana = createProjectWith({ + const opensearchDashboards = createProjectWith({ dependencies: { foo: '1.2.3', }, @@ -52,13 +52,13 @@ test('fields', async () => { }, }); - expect(kibana.name).toBe('kibana'); + expect(opensearchDashboards.name).toBe('opensearch-dashboards'); - expect(kibana.hasDependencies()).toBe(true); - expect(kibana.allDependencies).toEqual({ foo: '1.2.3' }); + expect(opensearchDashboards.hasDependencies()).toBe(true); + expect(opensearchDashboards.allDependencies).toEqual({ foo: '1.2.3' }); - expect(kibana.hasScript('test')).toBe(true); - expect(kibana.hasScript('build')).toBe(false); + expect(opensearchDashboards.hasScript('test')).toBe(true); + expect(opensearchDashboards.hasScript('build')).toBe(false); }); describe('#ensureValidProjectDependency', () => { @@ -180,7 +180,7 @@ describe('#getExecutables()', () => { }); expect(project.getExecutables()).toEqual({ - kibana: resolve(rootPath, 'bin/script.js'), + opensearchDashboards: resolve(rootPath, 'bin/script.js'), }); }); @@ -221,7 +221,7 @@ describe('#getIntermediateBuildDirectory', () => { test('appends the `intermediateBuildDirectory` to project path when specified', () => { const project = createProjectWith( { - kibana: { + opensearchDashboards: { build: { intermediateBuildDirectory: 'quux', }, diff --git a/packages/kbn-pm/src/utils/project.ts b/packages/osd-pm/src/utils/project.ts similarity index 95% rename from packages/kbn-pm/src/utils/project.ts rename to packages/osd-pm/src/utils/project.ts index 4e4d76544aa3..0ef5ce263afe 100644 --- a/packages/kbn-pm/src/utils/project.ts +++ b/packages/osd-pm/src/utils/project.ts @@ -137,11 +137,11 @@ export class Project { } public getBuildConfig(): BuildConfig { - return (this.json.kibana && this.json.kibana.build) || {}; + return (this.json.opensearchDashboards && this.json.opensearchDashboards.build) || {}; } /** - * Returns the directory that should be copied into the Kibana build artifact. + * Returns the directory that should be copied into the OpenSearch Dashboards build artifact. * This config can be specified to only include the project's build artifacts * instead of everything located in the project directory. */ @@ -150,11 +150,11 @@ export class Project { } public getCleanConfig(): CleanConfig { - return (this.json.kibana && this.json.kibana.clean) || {}; + return (this.json.opensearchDashboards && this.json.opensearchDashboards.clean) || {}; } public isFlaggedAsDevOnly() { - return !!(this.json.kibana && this.json.kibana.devOnly); + return !!(this.json.opensearchDashboards && this.json.opensearchDashboards.devOnly); } public hasScript(name: string) { diff --git a/packages/kbn-pm/src/utils/project_checksums.ts b/packages/osd-pm/src/utils/project_checksums.ts similarity index 88% rename from packages/kbn-pm/src/utils/project_checksums.ts rename to packages/osd-pm/src/utils/project_checksums.ts index c13788c89bfa..367d88e9fb61 100644 --- a/packages/kbn-pm/src/utils/project_checksums.ts +++ b/packages/osd-pm/src/utils/project_checksums.ts @@ -27,7 +27,7 @@ import execa from 'execa'; import { YarnLock, resolveDepsForProject } from './yarn_lock'; import { ProjectMap } from '../utils/projects'; import { Project } from '../utils/project'; -import { Kibana } from '../utils/kibana'; +import { OpenSearchDashboards } from '../utils/opensearch_dashboards'; import { Log } from '../utils/log'; export type ChecksumMap = Map; @@ -38,7 +38,7 @@ const statAsync = promisify(Fs.stat); const projectBySpecificitySorter = (a: Project, b: Project) => b.path.length - a.path.length; /** Get the changed files for a set of projects */ -async function getChangesForProjects(projects: ProjectMap, kbn: Kibana, log: Log) { +async function getChangesForProjects(projects: ProjectMap, osd: OpenSearchDashboards, log: Log) { log.verbose('getting changed files'); const { stdout } = await execa( @@ -49,11 +49,11 @@ async function getChangesForProjects(projects: ProjectMap, kbn: Kibana, log: Log '--exclude-standard', '--', ...Array.from(projects.values()) - .filter((p) => kbn.isPartOfRepo(p)) + .filter((p) => osd.isPartOfRepo(p)) .map((p) => p.path), ], { - cwd: kbn.getAbsolute(), + cwd: osd.getAbsolute(), } ); @@ -98,13 +98,13 @@ async function getChangesForProjects(projects: ProjectMap, kbn: Kibana, log: Log const changesByProject = new Map(); for (const project of sortedRelevantProjects) { - if (kbn.isOutsideRepo(project)) { + if (osd.isOutsideRepo(project)) { changesByProject.set(project, undefined); continue; } const ownChanges: Changes = new Map(); - const prefix = kbn.getRelative(project.path); + const prefix = osd.getRelative(project.path); for (const [path, type] of unassignedChanges) { if (path.startsWith(prefix)) { @@ -129,8 +129,8 @@ async function getChangesForProjects(projects: ProjectMap, kbn: Kibana, log: Log } /** Get the latest commit sha for a project */ -async function getLatestSha(project: Project, kbn: Kibana) { - if (kbn.isOutsideRepo(project)) { +async function getLatestSha(project: Project, osd: OpenSearchDashboards) { + if (osd.isOutsideRepo(project)) { return; } @@ -138,7 +138,7 @@ async function getLatestSha(project: Project, kbn: Kibana) { 'git', ['log', '-n', '1', '--pretty=format:%H', '--', project.path], { - cwd: kbn.getAbsolute(), + cwd: osd.getAbsolute(), } ); @@ -152,10 +152,10 @@ async function getChecksum( project: Project, changes: Changes | undefined, yarnLock: YarnLock, - kbn: Kibana, + osd: OpenSearchDashboards, log: Log ) { - const sha = await getLatestSha(project, kbn); + const sha = await getLatestSha(project, osd); if (sha) { log.verbose(`[${project.name}] local sha:`, sha); } @@ -173,7 +173,7 @@ async function getChecksum( return `${path}:deleted`; } - const stats = await statAsync(kbn.getAbsolute(path)); + const stats = await statAsync(osd.getAbsolute(path)); log.verbose(`[${project.name}] modified time ${stats.mtimeMs} for ${path}`); return `${path}:${stats.mtimeMs}`; }) @@ -182,7 +182,7 @@ async function getChecksum( const depMap = resolveDepsForProject({ project, yarnLock, - kbn, + osd, log, includeDependentProject: false, productionDepsOnly: false, @@ -222,9 +222,9 @@ async function getChecksum( * - un-committed changes * - resolved dependencies from yarn.lock referenced by project package.json */ -export async function getAllChecksums(kbn: Kibana, log: Log, yarnLock: YarnLock) { - const projects = kbn.getAllProjects(); - const changesByProject = await getChangesForProjects(projects, kbn, log); +export async function getAllChecksums(osd: OpenSearchDashboards, log: Log, yarnLock: YarnLock) { + const projects = osd.getAllProjects(); + const changesByProject = await getChangesForProjects(projects, osd, log); /** map of [project.name, cacheKey] */ const cacheKeys: ChecksumMap = new Map(); @@ -233,7 +233,7 @@ export async function getAllChecksums(kbn: Kibana, log: Log, yarnLock: YarnLock) Array.from(projects.values()).map(async (project) => { cacheKeys.set( project.name, - await getChecksum(project, changesByProject.get(project), yarnLock, kbn, log) + await getChecksum(project, changesByProject.get(project), yarnLock, osd, log) ); }) ); diff --git a/packages/kbn-pm/src/utils/projects.test.ts b/packages/osd-pm/src/utils/projects.test.ts similarity index 88% rename from packages/kbn-pm/src/utils/projects.test.ts rename to packages/osd-pm/src/utils/projects.test.ts index 068c72286872..7032e15d47d8 100644 --- a/packages/kbn-pm/src/utils/projects.test.ts +++ b/packages/osd-pm/src/utils/projects.test.ts @@ -33,7 +33,7 @@ import { topologicallyBatchProjects, } from './projects'; -const rootPath = resolve(__dirname, '__fixtures__/kibana'); +const rootPath = resolve(__dirname, '__fixtures__/opensearch-dashboards'); const rootPlugins = join(rootPath, 'plugins'); describe('#getProjects', () => { @@ -61,7 +61,7 @@ describe('#getProjects', () => { const projects = await getProjects(rootPath, ['.']); expect(projects.size).toBe(1); - expect([...projects.keys()]).toEqual(['kibana']); + expect([...projects.keys()]).toEqual(['opensearch-dashboards']); }); test('handles packages outside root', async () => { @@ -84,7 +84,7 @@ describe('#getProjects', () => { const projects = await getProjects(rootPath, projectPaths); const expectedProjects = [ - 'kibana', + 'opensearch-dashboards', 'bar', 'foo', 'with-additional-projects', @@ -110,7 +110,7 @@ describe('#getProjects', () => { expect([...projects.keys()].sort()).toEqual([ 'corge', - 'kibana', + 'opensearch-dashboards', 'quux', 'with-additional-projects', ]); @@ -125,7 +125,7 @@ describe('#getProjects', () => { 'baz', 'corge', 'foo', - 'kibana', + 'opensearch-dashboards', 'quux', 'with-additional-projects', ]); @@ -166,7 +166,7 @@ describe('#getProjects', () => { test('does not return any project if `exclude` filter is specified for all projects', async () => { const projects = await getProjects(rootPath, projectPaths, { - exclude: ['kibana', 'bar', 'corge', 'foo', 'with-additional-projects', 'quux', 'baz'], + exclude: ['opensearch-dashboards', 'bar', 'corge', 'foo', 'with-additional-projects', 'quux', 'baz'], }); expect(projects.size).toBe(0); @@ -230,29 +230,29 @@ describe('#topologicallyBatchProjects', () => { const expectedBatches = batches.map((batch) => batch.map((project) => project.name)); - expect(expectedBatches).toEqual([['kibana'], ['bar', 'foo'], ['baz', 'zorge'], ['quux']]); + expect(expectedBatches).toEqual([['opensearch-dashboards'], ['bar', 'foo'], ['baz', 'zorge'], ['quux']]); }); }); }); describe('#includeTransitiveProjects', () => { - test('includes transitive dependencies for Kibana package', async () => { + test('includes transitive dependencies for OpenSearch Dashboards package', async () => { const projects = await getProjects(rootPath, ['.', 'packages/*']); - const kibana = projects.get('kibana')!; - const withTransitive = includeTransitiveProjects([kibana], projects); + const opensearch-dashboards = projects.get('opensearch-dashboards')!; + const withTransitive = includeTransitiveProjects([opensearch-dashboards], projects); - expect([...withTransitive.keys()]).toEqual(['kibana', 'foo']); + expect([...withTransitive.keys()]).toEqual(['opensearch-dashboards', 'foo']); }); test('handles multiple projects with same transitive dep', async () => { const projects = await getProjects(rootPath, ['.', 'packages/*']); - const kibana = projects.get('kibana')!; + const opensearch-dashboards = projects.get('opensearch-dashboards')!; const bar = projects.get('bar')!; - const withTransitive = includeTransitiveProjects([kibana, bar], projects); + const withTransitive = includeTransitiveProjects([opensearch-dashboards, bar], projects); - expect([...withTransitive.keys()]).toEqual(['kibana', 'bar', 'foo']); + expect([...withTransitive.keys()]).toEqual(['opensearch-dashboards', 'bar', 'foo']); }); test('handles projects with no deps', async () => { diff --git a/packages/kbn-pm/src/utils/projects.ts b/packages/osd-pm/src/utils/projects.ts similarity index 98% rename from packages/kbn-pm/src/utils/projects.ts rename to packages/osd-pm/src/utils/projects.ts index 1c3bf0fa3091..15c921380cd5 100644 --- a/packages/kbn-pm/src/utils/projects.ts +++ b/packages/osd-pm/src/utils/projects.ts @@ -114,7 +114,7 @@ export function buildProjectGraph(projects: ProjectMap) { const dep = projects.get(depName)!; const dependentProjectIsInWorkspace = - project.isWorkspaceProject || project.json.name === 'kibana'; + project.isWorkspaceProject || project.json.name === 'opensearch-dashboards'; project.ensureValidProjectDependency(dep, dependentProjectIsInWorkspace); projectDeps.push(dep); diff --git a/packages/kbn-pm/src/utils/projects_tree.test.ts b/packages/osd-pm/src/utils/projects_tree.test.ts similarity index 96% rename from packages/kbn-pm/src/utils/projects_tree.test.ts rename to packages/osd-pm/src/utils/projects_tree.test.ts index 693400080f4f..d11567018f3b 100644 --- a/packages/kbn-pm/src/utils/projects_tree.test.ts +++ b/packages/osd-pm/src/utils/projects_tree.test.ts @@ -24,7 +24,7 @@ import { stripAnsiSnapshotSerializer } from '../test_helpers'; import { getProjects } from './projects'; import { renderProjectsTree } from './projects_tree'; -const rootPath = resolve(`${__dirname}/__fixtures__/kibana`); +const rootPath = resolve(`${__dirname}/__fixtures__/opensearch-dashboards`); expect.addSnapshotSerializer(stripAnsiSnapshotSerializer); diff --git a/packages/kbn-pm/src/utils/projects_tree.ts b/packages/osd-pm/src/utils/projects_tree.ts similarity index 100% rename from packages/kbn-pm/src/utils/projects_tree.ts rename to packages/osd-pm/src/utils/projects_tree.ts diff --git a/packages/kbn-pm/src/utils/scripts.ts b/packages/osd-pm/src/utils/scripts.ts similarity index 100% rename from packages/kbn-pm/src/utils/scripts.ts rename to packages/osd-pm/src/utils/scripts.ts diff --git a/packages/kbn-pm/src/utils/validate_dependencies.ts b/packages/osd-pm/src/utils/validate_dependencies.ts similarity index 86% rename from packages/kbn-pm/src/utils/validate_dependencies.ts rename to packages/osd-pm/src/utils/validate_dependencies.ts index b279269745da..09eeb16a3d15 100644 --- a/packages/kbn-pm/src/utils/validate_dependencies.ts +++ b/packages/osd-pm/src/utils/validate_dependencies.ts @@ -23,13 +23,13 @@ import dedent from 'dedent'; import chalk from 'chalk'; import { writeFile } from './fs'; -import { Kibana } from './kibana'; +import { OpenSearchDashboards } from '../utils/opensearch_dashboards'; import { YarnLock } from './yarn_lock'; import { log } from './log'; import { Project } from './project'; import { ITree, treeToString } from './projects_tree'; -export async function validateDependencies(kbn: Kibana, yarnLock: YarnLock) { +export async function validateDependencies(osd: OpenSearchDashboards, yarnLock: YarnLock) { // look through all of the packages in the yarn.lock file to see if // we have accidentally installed multiple lodash v4 versions const lodash4Versions = new Set(); @@ -49,12 +49,12 @@ export async function validateDependencies(kbn: Kibana, yarnLock: YarnLock) { delete yarnLock[req]; } - await writeFile(kbn.getAbsolute('yarn.lock'), stringifyLockfile(yarnLock), 'utf8'); + await writeFile(osd.getAbsolute('yarn.lock'), stringifyLockfile(yarnLock), 'utf8'); log.error(dedent` Multiple version of lodash v4 were detected, so they have been removed - from the yarn.lock file. Please rerun yarn kbn bootstrap to coalese the + from the yarn.lock file. Please rerun yarn osd bootstrap to coalese the lodash versions installed. If you still see this error when you re-bootstrap then you might need @@ -71,7 +71,7 @@ export async function validateDependencies(kbn: Kibana, yarnLock: YarnLock) { // look through all the dependencies of production packages and production // dependencies of those packages to determine if we're shipping any versions // of lodash v3 in the distributable - const prodDependencies = kbn.resolveAllProductionDependencies(yarnLock, log); + const prodDependencies = osd.resolveAllProductionDependencies(yarnLock, log); const lodash3Versions = new Set(); for (const dep of prodDependencies.values()) { if (dep.name === 'lodash' && dep.version.startsWith('3.')) { @@ -101,7 +101,7 @@ export async function validateDependencies(kbn: Kibana, yarnLock: YarnLock) { // TODO: remove this once we move into a single package.json // look through all the package.json files to find packages which have mismatched version ranges const depRanges = new Map>(); - for (const project of kbn.getAllProjects().values()) { + for (const project of osd.getAllProjects().values()) { for (const [dep, range] of Object.entries(project.allDependencies)) { const existingDep = depRanges.get(dep); if (!existingDep) { @@ -159,13 +159,13 @@ export async function validateDependencies(kbn: Kibana, yarnLock: YarnLock) { process.exit(1); } - // look for packages that have the the `kibana.devOnly` flag in their package.json - // and make sure they aren't included in the production dependencies of Kibana - const devOnlyProjectsInProduction = getDevOnlyProductionDepsTree(kbn, 'kibana'); + // look for packages that have the the `opensearchDashboards.devOnly` flag in their package.json + // and make sure they aren't included in the production dependencies of OpenSearch Dashboards + const devOnlyProjectsInProduction = getDevOnlyProductionDepsTree(osd, 'opensearch-dashboards'); if (devOnlyProjectsInProduction) { log.error(dedent` - Some of the packages in the production dependency chain for Kibana and X-Pack are - flagged with "kibana.devOnly" in their package.json. Please check changes made to + Some of the packages in the production dependency chain for OpenSearch Dashboards and X-Pack are + flagged with "opensearchDashboards.devOnly" in their package.json. Please check changes made to packages and their dependencies to ensure they don't end up in production. The devOnly dependencies that are being dependend on in production are: @@ -179,14 +179,14 @@ export async function validateDependencies(kbn: Kibana, yarnLock: YarnLock) { log.success('yarn.lock analysis completed without any issues'); } -function getDevOnlyProductionDepsTree(kbn: Kibana, projectName: string) { - const project = kbn.getProject(projectName); +function getDevOnlyProductionDepsTree(osd: OpenSearchDashboards, projectName: string) { + const project = osd.getProject(projectName); const childProjectNames = [ - ...Object.keys(project.productionDependencies).filter((name) => kbn.hasProject(name)), + ...Object.keys(project.productionDependencies).filter((name) => osd.hasProject(name)), ]; const children = childProjectNames - .map((n) => getDevOnlyProductionDepsTree(kbn, n)) + .map((n) => getDevOnlyProductionDepsTree(osd, n)) .filter((t): t is ITree => !!t); if (!children.length && !project.isFlaggedAsDevOnly()) { diff --git a/packages/kbn-pm/src/utils/watch.test.ts b/packages/osd-pm/src/utils/watch.test.ts similarity index 100% rename from packages/kbn-pm/src/utils/watch.test.ts rename to packages/osd-pm/src/utils/watch.test.ts diff --git a/packages/kbn-pm/src/utils/watch.ts b/packages/osd-pm/src/utils/watch.ts similarity index 100% rename from packages/kbn-pm/src/utils/watch.ts rename to packages/osd-pm/src/utils/watch.ts diff --git a/packages/kbn-pm/src/utils/workspaces.ts b/packages/osd-pm/src/utils/workspaces.ts similarity index 100% rename from packages/kbn-pm/src/utils/workspaces.ts rename to packages/osd-pm/src/utils/workspaces.ts diff --git a/packages/kbn-pm/src/utils/yarn_lock.ts b/packages/osd-pm/src/utils/yarn_lock.ts similarity index 88% rename from packages/kbn-pm/src/utils/yarn_lock.ts rename to packages/osd-pm/src/utils/yarn_lock.ts index 953341915e23..51e64fcd8b3d 100644 --- a/packages/kbn-pm/src/utils/yarn_lock.ts +++ b/packages/osd-pm/src/utils/yarn_lock.ts @@ -21,7 +21,7 @@ import { parse as parseLockfile } from '@yarnpkg/lockfile'; import { readFile } from '../utils/fs'; -import { Kibana } from '../utils/kibana'; +import { OpenSearchDashboards } from '../utils/opensearch_dashboards'; import { Project } from '../utils/project'; import { Log } from '../utils/log'; @@ -45,16 +45,16 @@ export interface YarnLock { }; } -export async function readYarnLock(kbn: Kibana): Promise { +export async function readYarnLock(osd: OpenSearchDashboards): Promise { try { - const contents = await readFile(kbn.getAbsolute('yarn.lock'), 'utf8'); + const contents = await readFile(osd.getAbsolute('yarn.lock'), 'utf8'); const yarnLock = parseLockfile(contents); if (yarnLock.type === 'success') { return yarnLock.object; } - throw new Error('unable to read yarn.lock file, please run `yarn kbn bootstrap`'); + throw new Error('unable to read yarn.lock file, please run `yarn osd bootstrap`'); } catch (error) { if (error.code !== 'ENOENT') { throw error; @@ -72,14 +72,14 @@ export async function readYarnLock(kbn: Kibana): Promise { export function resolveDepsForProject({ project: rootProject, yarnLock, - kbn, + osd, log, productionDepsOnly, includeDependentProject, }: { project: Project; yarnLock: YarnLock; - kbn: Kibana; + osd: OpenSearchDashboards; log: Log; productionDepsOnly: boolean; includeDependentProject: boolean; @@ -113,15 +113,15 @@ export function resolveDepsForProject({ continue; } - if (includeDependentProject && kbn.hasProject(name)) { - projectQueue.push(kbn.getProject(name)!); + if (includeDependentProject && osd.hasProject(name)) { + projectQueue.push(osd.getProject(name)!); } - if (!kbn.hasProject(name)) { + if (!osd.hasProject(name)) { const pkg = yarnLock[req]; if (!pkg) { log.warning( - 'yarn.lock file is out of date, please run `yarn kbn bootstrap` to re-enable caching' + 'yarn.lock file is out of date, please run `yarn osd bootstrap` to re-enable caching' ); return; } diff --git a/packages/kbn-pm/tsconfig.json b/packages/osd-pm/tsconfig.json similarity index 77% rename from packages/kbn-pm/tsconfig.json rename to packages/osd-pm/tsconfig.json index 175c4701f2e5..c92b0387260b 100644 --- a/packages/kbn-pm/tsconfig.json +++ b/packages/osd-pm/tsconfig.json @@ -7,7 +7,7 @@ ], "exclude": [], "compilerOptions": { - "tsBuildInfoFile": "../../build/tsbuildinfo/packages/kbn-pm", + "tsBuildInfoFile": "../../build/tsbuildinfo/packages/osd-pm", "types": [ "jest", "node" diff --git a/packages/kbn-pm/webpack.config.js b/packages/osd-pm/webpack.config.js similarity index 100% rename from packages/kbn-pm/webpack.config.js rename to packages/osd-pm/webpack.config.js diff --git a/packages/kbn-pm/yarn.lock b/packages/osd-pm/yarn.lock similarity index 100% rename from packages/kbn-pm/yarn.lock rename to packages/osd-pm/yarn.lock