Skip to content

Commit

Permalink
chore(NA): moving @kbn/dev-utils into bazel (#98496) (#98696)
Browse files Browse the repository at this point in the history
* chore(NA): moving @kbn/dev-utils into bazel

* docs(NA): updated generated plugin list

Co-authored-by: Tiago Costa <tiagoffcc@hotmail.com>
  • Loading branch information
kibanamachine and mistic authored Apr 29, 2021
1 parent cbc1f12 commit b3fc91c
Show file tree
Hide file tree
Showing 30 changed files with 139 additions and 73 deletions.
1 change: 1 addition & 0 deletions docs/developer/getting-started/monorepo-packages.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ yarn kbn watch-bazel
- @kbn/babel-code-parser
- @kbn/babel-preset
- @kbn/config-schema
- @kbn/dev-utils
- @kbn/expect
- @kbn/logging
- @kbn/std
Expand Down
2 changes: 1 addition & 1 deletion docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ NOTE:

node scripts/build_plugin_list_docs

You can update the template within packages/kbn-dev-utils/target/plugin_list/generate_plugin_list.js
You can update the template within node_modules/@kbn/dev-utils/target/plugin_list/generate_plugin_list.js

////
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@
"@kbn/babel-code-parser": "link:bazel-bin/packages/kbn-babel-code-parser/npm_module",
"@kbn/babel-preset": "link:bazel-bin/packages/kbn-babel-preset/npm_module",
"@kbn/cli-dev-mode": "link:packages/kbn-cli-dev-mode",
"@kbn/dev-utils": "link:packages/kbn-dev-utils",
"@kbn/dev-utils": "link:bazel-bin/packages/kbn-dev-utils/npm_module",
"@kbn/docs-utils": "link:packages/kbn-docs-utils",
"@kbn/es": "link:packages/kbn-es",
"@kbn/es-archiver": "link:packages/kbn-es-archiver",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ filegroup(
"//packages/kbn-babel-code-parser:build",
"//packages/kbn-babel-preset:build",
"//packages/kbn-config-schema:build",
"//packages/kbn-dev-utils:build",
"//packages/kbn-expect:build",
"//packages/kbn-logging:build",
"//packages/kbn-std:build",
Expand Down
5 changes: 1 addition & 4 deletions packages/elastic-eslint-config-kibana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
"bugs": {
"url": "https://github.com/elastic/kibana/tree/master/packages/elastic-eslint-config-kibana"
},
"homepage": "https://github.com/elastic/kibana/tree/master/packages/elastic-eslint-config-kibana",
"dependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
"homepage": "https://github.com/elastic/kibana/tree/master/packages/elastic-eslint-config-kibana"
}
3 changes: 0 additions & 3 deletions packages/kbn-ace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@
"scripts": {
"build": "node ./scripts/build.js",
"kbn:bootstrap": "yarn build --dev"
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@
"build": "node scripts/build",
"kbn:bootstrap": "node scripts/build --source-maps",
"kbn:watch": "node scripts/build --source-maps --watch"
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
3 changes: 1 addition & 2 deletions packages/kbn-cli-dev-mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"dependencies": {
"@kbn/config": "link:../kbn-config",
"@kbn/server-http-tools": "link:../kbn-server-http-tools",
"@kbn/optimizer": "link:../kbn-optimizer",
"@kbn/dev-utils": "link:../kbn-dev-utils"
"@kbn/optimizer": "link:../kbn-optimizer"
}
}
4 changes: 0 additions & 4 deletions packages/kbn-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,5 @@
"scripts": {
"build": "../../node_modules/.bin/tsc",
"kbn:bootstrap": "yarn build"
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils",
"@kbn/utility-types": "link:../kbn-utility-types"
}
}
4 changes: 0 additions & 4 deletions packages/kbn-crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@
"build": "../../node_modules/.bin/tsc",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"dependencies": {},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
128 changes: 128 additions & 0 deletions packages/kbn-dev-utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")

PKG_BASE_NAME = "kbn-dev-utils"
PKG_REQUIRE_NAME = "@kbn/dev-utils"

SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*"
],
)

SRCS = SOURCE_FILES

filegroup(
name = "srcs",
srcs = SRCS,
)

filegroup(
name = "certs",
srcs = glob(
[
"certs/**/*",
],
exclude = [
"**/README.md"
],
),
)

NPM_MODULE_EXTRA_FILES = [
"package.json",
"README.md",
":certs",
"ci_stats_reporter/package.json",
"stdio/package.json",
"tooling_log/package.json"
]

SRC_DEPS = [
"//packages/kbn-expect",
"//packages/kbn-utils",
"@npm//@babel/core",
"@npm//axios",
"@npm//chalk",
"@npm//chance",
"@npm//cheerio",
"@npm//dedent",
"@npm//execa",
"@npm//exit-hook",
"@npm//getopts",
"@npm//globby",
"@npm//jest-styled-components",
"@npm//load-json-file",
"@npm//markdown-it",
"@npm//moment",
"@npm//normalize-path",
"@npm//rxjs",
"@npm//tree-kill",
"@npm//tslib",
"@npm//typescript",
"@npm//vinyl"
]

TYPES_DEPS = [
"@npm//@types/babel__core",
"@npm//@types/cheerio",
"@npm//@types/dedent",
"@npm//@types/flot",
"@npm//@types/jest",
"@npm//@types/markdown-it",
"@npm//@types/node",
"@npm//@types/normalize-path",
"@npm//@types/react",
"@npm//@types/testing-library__jest-dom",
"@npm//@types/vinyl"
]

DEPS = SRC_DEPS + TYPES_DEPS

ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
],
)

ts_project(
name = "tsc",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
declaration = True,
declaration_map = True,
incremental = True,
out_dir = "target",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig",
)

js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = [":tsc"] + DEPS,
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)

pkg_npm(
name = "npm_module",
deps = [
":%s" % PKG_BASE_NAME,
]
)

filegroup(
name = "build",
srcs = [
":npm_module",
],
visibility = ["//visibility:public"],
)
8 changes: 0 additions & 8 deletions packages/kbn-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"types": "./target/index.d.ts",
"scripts": {
"build": "../../node_modules/.bin/tsc",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"kibana": {
"devOnly": true
},
"devDependencies": {
"@kbn/expect": "link:../kbn-expect"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

import Fs from 'fs';
import Path from 'path';

import normalizePath from 'normalize-path';
Expand Down Expand Up @@ -49,7 +48,7 @@ NOTE:
node scripts/build_plugin_list_docs
You can update the template within ${normalizePath(
Path.relative(REPO_ROOT, Fs.realpathSync(Path.resolve(__dirname, __filename)))
Path.relative(REPO_ROOT, Path.resolve(__dirname, __filename))
)}
////
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-dev-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"incremental": true,
"outDir": "target",
"stripInternal": false,
"target": "ES2019",
"declaration": true,
"declarationMap": true,
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-dev-utils/src",
"types": [
Expand Down
3 changes: 1 addition & 2 deletions packages/kbn-docs-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"kbn:watch": "../../node_modules/.bin/tsc --watch"
},
"dependencies": {
"@kbn/config": "link:../kbn-config",
"@kbn/dev-utils": "link:../kbn-dev-utils"
"@kbn/config": "link:../kbn-config"
}
}
1 change: 0 additions & 1 deletion packages/kbn-es-archiver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"kbn:watch": "rm -rf target && ../../node_modules/.bin/tsc --watch"
},
"dependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils",
"@kbn/test": "link:../kbn-test"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@
"build": "node scripts/build",
"kbn:bootstrap": "node scripts/build",
"kbn:watch": "node scripts/build --watch"
},
"dependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@
"build": "node scripts/build",
"kbn:bootstrap": "node scripts/build --source-maps",
"kbn:watch": "node scripts/build --watch --source-maps"
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-interpreter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@
},
"dependencies": {
"@kbn/i18n": "link:../kbn-i18n"
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-monaco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"kbn:bootstrap": "yarn build --dev",
"build:antlr4ts": "../../node_modules/antlr4ts-cli/antlr4ts ./src/painless/antlr/painless_lexer.g4 ./src/painless/antlr/painless_parser.g4 && node ./scripts/fix_generated_antlr.js"
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
},
"dependencies": {
"@kbn/i18n": "link:../kbn-i18n"
}
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
},
"dependencies": {
"@kbn/config": "link:../kbn-config",
"@kbn/dev-utils": "link:../kbn-dev-utils",
"@kbn/ui-shared-deps": "link:../kbn-ui-shared-deps"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-plugin-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@
"scripts": {
"kbn:bootstrap": "node scripts/build",
"kbn:watch": "node scripts/build --watch"
},
"dependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
1 change: 0 additions & 1 deletion packages/kbn-plugin-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"kbn:watch": "../../node_modules/.bin/tsc --watch"
},
"dependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils",
"@kbn/optimizer": "link:../kbn-optimizer"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-pm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@
"build": "../../node_modules/.bin/webpack",
"kbn:watch": "../../node_modules/.bin/webpack --watch",
"prettier": "../../node_modules/.bin/prettier --write './src/**/*.ts'"
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@
"build": "../../node_modules/.bin/tsc",
"kbn:bootstrap": "yarn build",
"watch": "yarn build --watch"
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils"
}
}
4 changes: 0 additions & 4 deletions packages/kbn-telemetry-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,5 @@
"build": "../../node_modules/.bin/babel src --out-dir target --delete-dir-on-start --extensions .ts --source-maps=inline",
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"devDependencies": {
"@kbn/dev-utils": "link:../kbn-dev-utils",
"@kbn/utility-types": "link:../kbn-utility-types"
}
}
Loading

0 comments on commit b3fc91c

Please sign in to comment.