diff --git a/docs/developer/getting-started/monorepo-packages.asciidoc b/docs/developer/getting-started/monorepo-packages.asciidoc index 06e87fa130029..b656405b173d8 100644 --- a/docs/developer/getting-started/monorepo-packages.asciidoc +++ b/docs/developer/getting-started/monorepo-packages.asciidoc @@ -77,6 +77,7 @@ yarn kbn watch-bazel - @kbn/dev-utils - @kbn/docs-utils - @kbn/es +- @kbn/es-archiver - @kbn/eslint-import-resolver-kibana - @kbn/eslint-plugin-eslint - @kbn/expect diff --git a/package.json b/package.json index 99dad59044bf4..1cdeed4189cd3 100644 --- a/package.json +++ b/package.json @@ -462,7 +462,7 @@ "@kbn/dev-utils": "link:bazel-bin/packages/kbn-dev-utils", "@kbn/docs-utils": "link:bazel-bin/packages/kbn-docs-utils", "@kbn/es": "link:bazel-bin/packages/kbn-es", - "@kbn/es-archiver": "link:packages/kbn-es-archiver", + "@kbn/es-archiver": "link:bazel-bin/packages/kbn-es-archiver", "@kbn/eslint-import-resolver-kibana": "link:bazel-bin/packages/kbn-eslint-import-resolver-kibana", "@kbn/eslint-plugin-eslint": "link:bazel-bin/packages/kbn-eslint-plugin-eslint", "@kbn/expect": "link:bazel-bin/packages/kbn-expect", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 6ffd5ff151ac3..de7a27fd51276 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -20,6 +20,7 @@ filegroup( "//packages/kbn-dev-utils:build", "//packages/kbn-docs-utils:build", "//packages/kbn-es:build", + "//packages/kbn-es-archiver:build", "//packages/kbn-eslint-import-resolver-kibana:build", "//packages/kbn-eslint-plugin-eslint:build", "//packages/kbn-expect:build", diff --git a/packages/kbn-es-archiver/BUILD.bazel b/packages/kbn-es-archiver/BUILD.bazel new file mode 100644 index 0000000000000..9b3db311afa24 --- /dev/null +++ b/packages/kbn-es-archiver/BUILD.bazel @@ -0,0 +1,100 @@ +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-es-archiver" +PKG_REQUIRE_NAME = "@kbn/es-archiver" + +SOURCE_FILES = glob( + [ + "src/**/*.ts", + ], + exclude = [ + "**/*.test.*", + "**/__fixtures__", + "**/__mocks__", + "**/__snapshots__" + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +SRC_DEPS = [ + "//packages/kbn-dev-utils", + "//packages/kbn-test", + "//packages/kbn-utils", + "@npm//@elastic/elasticsearch", + "@npm//aggregate-error", + "@npm//bluebird", + "@npm//chance", + "@npm//globby", + "@npm//json-stable-stringify", + "@npm//lodash", + "@npm//sinon", + "@npm//zlib", +] + +TYPES_DEPS = [ + "@npm//@types/bluebird", + "@npm//@types/chance", + "@npm//@types/jest", + "@npm//@types/json-stable-stringify", + "@npm//@types/lodash", + "@npm//@types/node", + "@npm//@types/sinon", +] + +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 = DEPS + [":tsc"], + 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"], +) diff --git a/packages/kbn-es-archiver/package.json b/packages/kbn-es-archiver/package.json index b55e67b82694f..e8eb7b5f8f1c9 100644 --- a/packages/kbn-es-archiver/package.json +++ b/packages/kbn-es-archiver/package.json @@ -7,9 +7,5 @@ "types": "target/index.d.ts", "kibana": { "devOnly": true - }, - "scripts": { - "kbn:bootstrap": "rm -rf target && ../../node_modules/.bin/tsc", - "kbn:watch": "rm -rf target && ../../node_modules/.bin/tsc --watch" } } diff --git a/packages/kbn-es-archiver/tsconfig.json b/packages/kbn-es-archiver/tsconfig.json index 0950cd39d0bee..1bc93908a993e 100644 --- a/packages/kbn-es-archiver/tsconfig.json +++ b/packages/kbn-es-archiver/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "incremental": false, + "incremental": true, "outDir": "./target", "target": "ES2019", "declaration": true, diff --git a/yarn.lock b/yarn.lock index 589f07e7a35d8..10cbb9789ba98 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2645,7 +2645,7 @@ version "0.0.0" uid "" -"@kbn/es-archiver@link:packages/kbn-es-archiver": +"@kbn/es-archiver@link:bazel-bin/packages/kbn-es-archiver": version "0.0.0" uid ""