[packages] Move @kbn/crypto to Bazel (#99233) (#99374)

Co-authored-by: Jonathan Budzenski <jon@budzenski.me>
This commit is contained in:
Kibana Machine 2021-05-05 14:29:30 -04:00 committed by GitHub
parent 307c0bc46f
commit 4535c5958b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 97 additions and 17 deletions

View file

@ -71,6 +71,7 @@ yarn kbn watch-bazel
- @kbn/babel-preset
- @kbn/config
- @kbn/config-schema
- @kbn/crypto
- @kbn/dev-utils
- @kbn/eslint-import-resolver-kibana
- @kbn/eslint-plugin-eslint

View file

@ -125,7 +125,7 @@
"@kbn/apm-utils": "link:bazel-bin/packages/kbn-apm-utils/npm_module",
"@kbn/config": "link:bazel-bin/packages/kbn-config/npm_module",
"@kbn/config-schema": "link:bazel-bin/packages/kbn-config-schema/npm_module",
"@kbn/crypto": "link:packages/kbn-crypto",
"@kbn/crypto": "link:bazel-bin/packages/kbn-crypto/npm_module",
"@kbn/i18n": "link:packages/kbn-i18n",
"@kbn/interpreter": "link:packages/kbn-interpreter",
"@kbn/io-ts-utils": "link:packages/kbn-io-ts-utils",

View file

@ -13,6 +13,7 @@ filegroup(
"//packages/kbn-babel-preset:build",
"//packages/kbn-config:build",
"//packages/kbn-config-schema:build",
"//packages/kbn-crypto:build",
"//packages/kbn-dev-utils:build",
"//packages/kbn-eslint-import-resolver-kibana:build",
"//packages/kbn-eslint-plugin-eslint:build",

View file

@ -0,0 +1,87 @@
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-cypto"
PKG_REQUIRE_NAME = "@kbn/crypto"
SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*",
],
)
SRCS = SOURCE_FILES
filegroup(
name = "srcs",
srcs = SRCS,
)
NPM_MODULE_EXTRA_FILES = [
"package.json",
"README.md"
]
SRC_DEPS = [
"@npm//jest-styled-components",
"@npm//node-forge",
]
TYPES_DEPS = [
"@npm//@types/flot",
"@npm//@types/jest",
"@npm//@types/node",
"@npm//@types/node-forge",
"@npm//@types/testing-library__jest-dom",
]
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"],
)

View file

@ -4,10 +4,5 @@
"private": true,
"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"
}
}
"types": "./target/index.d.ts"
}

View file

@ -1,14 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"incremental": true,
"outDir": "./target",
"declaration": true,
"declarationMap": true,
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-crypto/src"
},
"include": [
"src/**/*"
]
"include": ["src/**/*"]
}

View file

@ -10,10 +10,7 @@
"kbn:bootstrap": "yarn build",
"kbn:watch": "yarn build --watch"
},
"dependencies": {
"@kbn/crypto": "link:../kbn-crypto"
},
"devDependencies": {
"@kbn/utility-types": "link:../kbn-utility-types"
}
}
}

View file

@ -2619,7 +2619,7 @@
version "0.0.0"
uid ""
"@kbn/crypto@link:packages/kbn-crypto":
"@kbn/crypto@link:bazel-bin/packages/kbn-crypto/npm_module":
version "0.0.0"
uid ""