Skip to content

Commit

Permalink
chore(NA): moving @kbn/docs-utils into bazel (elastic#100051)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic authored and yctercero committed May 25, 2021
1 parent 1a955a2 commit 6208628
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 7 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 @@ -74,6 +74,7 @@ yarn kbn watch-bazel
- @kbn/config-schema
- @kbn/crypto
- @kbn/dev-utils
- @kbn/docs-utils
- @kbn/es
- @kbn/eslint-import-resolver-kibana
- @kbn/eslint-plugin-eslint
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
"@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:bazel-bin/packages/kbn-dev-utils/npm_module",
"@kbn/docs-utils": "link:packages/kbn-docs-utils",
"@kbn/docs-utils": "link:bazel-bin/packages/kbn-docs-utils/npm_module",
"@kbn/es": "link:bazel-bin/packages/kbn-es/npm_module",
"@kbn/es-archiver": "link:packages/kbn-es-archiver",
"@kbn/eslint-import-resolver-kibana": "link:bazel-bin/packages/kbn-eslint-import-resolver-kibana/npm_module",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ filegroup(
"//packages/kbn-config-schema:build",
"//packages/kbn-crypto:build",
"//packages/kbn-dev-utils:build",
"//packages/kbn-docs-utils:build",
"//packages/kbn-es:build",
"//packages/kbn-eslint-import-resolver-kibana:build",
"//packages/kbn-eslint-plugin-eslint:build",
Expand Down
88 changes: 88 additions & 0 deletions packages/kbn-docs-utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
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-docs-utils"
PKG_REQUIRE_NAME = "@kbn/docs-utils"

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

SRCS = SOURCE_FILES

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

NPM_MODULE_EXTRA_FILES = [
"package.json",
]

SRC_DEPS = [
"//packages/kbn-config",
"//packages/kbn-dev-utils",
"//packages/kbn-utils",
"@npm//dedent",
"@npm//ts-morph",
]

TYPES_DEPS = [
"@npm//@types/dedent",
"@npm//@types/jest",
"@npm//@types/node",
]

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"],
)
4 changes: 0 additions & 4 deletions packages/kbn-docs-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
"types": "target/index.d.ts",
"kibana": {
"devOnly": true
},
"scripts": {
"kbn:bootstrap": "../../node_modules/.bin/tsc",
"kbn:watch": "../../node_modules/.bin/tsc --watch"
}
}
3 changes: 2 additions & 1 deletion packages/kbn-docs-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"incremental": true,
"outDir": "./target",
"target": "ES2019",
"declaration": true,
"declarationMap": true,
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-docs-utils/src",
"types": [
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2634,7 +2634,7 @@
version "0.0.0"
uid ""

"@kbn/docs-utils@link:packages/kbn-docs-utils":
"@kbn/docs-utils@link:bazel-bin/packages/kbn-docs-utils/npm_module":
version "0.0.0"
uid ""

Expand Down

0 comments on commit 6208628

Please sign in to comment.