Skip to content

Commit

Permalink
chore(NA): moving @kbn/i18n into bazel (elastic#99390)
Browse files Browse the repository at this point in the history
* chore(NA): moving @kbn/i18n into bazel

* chore(NA): include javascript locales.js files

* chore(NA): remove build scripts

* chore(NA): remove node types on browser

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
2 people authored and yctercero committed May 25, 2021
1 parent cfa14ca commit 1a2df55
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 105 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 @@ -79,6 +79,7 @@ yarn kbn watch-bazel
- @kbn/eslint-import-resolver-kibana
- @kbn/eslint-plugin-eslint
- @kbn/expect
- @kbn/i18n
- @kbn/legacy-logging
- @kbn/logging
- @kbn/securitysolution-constants
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"@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:bazel-bin/packages/kbn-crypto/npm_module",
"@kbn/i18n": "link:packages/kbn-i18n",
"@kbn/i18n": "link:bazel-bin/packages/kbn-i18n/npm_module",
"@kbn/interpreter": "link:packages/kbn-interpreter",
"@kbn/io-ts-utils": "link:packages/kbn-io-ts-utils",
"@kbn/legacy-logging": "link:bazel-bin/packages/kbn-legacy-logging/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 @@ -21,6 +21,7 @@ filegroup(
"//packages/kbn-eslint-import-resolver-kibana:build",
"//packages/kbn-eslint-plugin-eslint:build",
"//packages/kbn-expect:build",
"//packages/kbn-i18n:build",
"//packages/kbn-legacy-logging:build",
"//packages/kbn-logging:build",
"//packages/kbn-plugin-generator:build",
Expand Down
154 changes: 154 additions & 0 deletions packages/kbn-i18n/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
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-i18n"
PKG_REQUIRE_NAME = "@kbn/i18n"

SOURCE_FILES = glob(
[
"src/**/*.ts",
"src/**/*.tsx",
"src/core/locales.js",
"types/**/*.ts",
],
exclude = [
"**/*.test.*",
"**/__fixtures__/**",
"**/__snapshots__/**",
],
)

SRCS = SOURCE_FILES

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

NPM_MODULE_EXTRA_FILES = [
"angular/package.json",
"react/package.json",
"package.json",
"GUIDELINE.md",
"README.md"
]

SRC_DEPS = [
"//packages/kbn-babel-preset",
"//packages/kbn-dev-utils",
"@npm//@babel/core",
"@npm//babel-loader",
"@npm//del",
"@npm//getopts",
"@npm//intl-format-cache",
"@npm//intl-messageformat",
"@npm//intl-relativeformat",
"@npm//prop-types",
"@npm//react",
"@npm//react-intl",
"@npm//supports-color",
]

TYPES_DEPS = [
"@npm//typescript",
"@npm//@types/angular",
"@npm//@types/intl-relativeformat",
"@npm//@types/jest",
"@npm//@types/prop-types",
"@npm//@types/react",
"@npm//@types/react-intl",
]

DEPS = SRC_DEPS + TYPES_DEPS

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

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

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

ts_project(
name = "tsc_browser",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
allow_js = True,
declaration = False,
incremental = True,
out_dir = "web",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig_browser",
)

filegroup(
name = "tsc_types",
srcs = [":tsc"],
output_group = "types",
)

filegroup(
name = "target_files",
srcs = [
":tsc",
":tsc_browser",
":tsc_types",
],
)

pkg_npm(
name = "target",
deps = [
":target_files",
],
)

js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = [":target"] + 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"],
)
7 changes: 1 addition & 6 deletions packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@
"types": "./target/types/index.d.ts",
"version": "1.0.0",
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true,
"scripts": {
"build": "node scripts/build",
"kbn:bootstrap": "node scripts/build --source-maps",
"kbn:watch": "node scripts/build --watch --source-maps"
}
"private": true
}
85 changes: 0 additions & 85 deletions packages/kbn-i18n/scripts/build.js

This file was deleted.

21 changes: 21 additions & 0 deletions packages/kbn-i18n/tsconfig.browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "../../tsconfig.browser.json",
"compilerOptions": {
"allowJs": true,
"incremental": true,
"outDir": "./target/web",
"declaration": false,
"isolatedModules": true,
"sourceMap": true,
"sourceRoot": "../../../../../packages/kbn-i18n/src"
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"types/intl_format_cache.d.ts",
"types/intl_relativeformat.d.ts"
],
"exclude": [
"**/__fixtures__/**/*"
]
}
7 changes: 4 additions & 3 deletions packages/kbn-i18n/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"outDir": "./target/types",
"emitDeclarationOnly": true,
"allowJs": true,
"incremental": true,
"declarationDir": "./target/types",
"outDir": "./target/node",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-interpreter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@
"build": "node scripts/build",
"kbn:bootstrap": "node scripts/build --dev",
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
"@kbn/i18n": "link:../kbn-i18n"
}
}
3 changes: 0 additions & 3 deletions packages/kbn-monaco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
"build": "node ./scripts/build.js",
"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"
},
"dependencies": {
"@kbn/i18n": "link:../kbn-i18n"
}
}
1 change: 0 additions & 1 deletion packages/kbn-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"devOnly": true
},
"dependencies": {
"@kbn/i18n": "link:../kbn-i18n",
"@kbn/optimizer": "link:../kbn-optimizer"
}
}
1 change: 0 additions & 1 deletion packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
"@kbn/i18n": "link:../kbn-i18n",
"@kbn/monaco": "link:../kbn-monaco"
}
}
1 change: 0 additions & 1 deletion x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@kbn/test": "link:../packages/kbn-test"
},
"dependencies": {
"@kbn/i18n": "link:../packages/kbn-i18n",
"@kbn/interpreter": "link:../packages/kbn-interpreter",
"@kbn/ui-framework": "link:../packages/kbn-ui-framework"
}
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2658,7 +2658,7 @@
version "0.0.0"
uid ""

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

Expand Down

0 comments on commit 1a2df55

Please sign in to comment.