Skip to content

Commit

Permalink
chore(NA): splits types from code on @kbn/storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic committed Feb 1, 2022
1 parent b942e56 commit b7e97ee
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@
"@types/kbn__server-http-tools": "link:bazel-bin/packages/kbn-server-http-tools/npm_module_types",
"@types/kbn__server-route-repository": "link:bazel-bin/packages/kbn-server-route-repository/npm_module_types",
"@types/kbn__std": "link:bazel-bin/packages/kbn-std/npm_module_types",
"@types/kbn__storybook": "link:bazel-bin/packages/kbn-storybook/npm_module_types",
"@types/kbn__telemetry-tools": "link:bazel-bin/packages/kbn-telemetry-tools/npm_module_types",
"@types/kbn__ui-shared-deps-npm": "link:bazel-bin/packages/kbn-ui-shared-deps-npm/npm_module_types",
"@types/kbn__ui-shared-deps-src": "link:bazel-bin/packages/kbn-ui-shared-deps-src/npm_module_types",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ filegroup(
"//packages/kbn-server-http-tools:build_types",
"//packages/kbn-server-route-repository:build_types",
"//packages/kbn-std:build_types",
"//packages/kbn-storybook:build_types",
"//packages/kbn-telemetry-tools:build_types",
"//packages/kbn-ui-shared-deps-npm:build_types",
"//packages/kbn-ui-shared-deps-src:build_types",
Expand Down
28 changes: 23 additions & 5 deletions packages/kbn-storybook/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")

PKG_BASE_NAME = "kbn-storybook"
PKG_REQUIRE_NAME = "@kbn/storybook"
TYPES_PKG_REQUIRE_NAME = "@types/kbn__storybook"

SOURCE_FILES = glob(
[
Expand Down Expand Up @@ -64,7 +65,6 @@ TYPES_DEPS = [
"@npm//@storybook/node-logger",
"@npm//@storybook/react",
"@npm//@storybook/theming",
"@npm//@types/express", # necessary for storybook which is missing the types
"@npm//@types/loader-utils",
"@npm//@types/node",
"@npm//@types/react",
Expand Down Expand Up @@ -104,7 +104,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand All @@ -123,3 +123,21 @@ filegroup(
],
visibility = ["//visibility:public"],
)

pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = TYPES_PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)

filegroup(
name = "build_types",
srcs = [
":npm_module_types",
],
visibility = ["//visibility:public"],
)

1 change: 0 additions & 1 deletion packages/kbn-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"kibana": {
"devOnly": true
}
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5969,6 +5969,10 @@
version "0.0.0"
uid ""

"@types/kbn__storybook@link:bazel-bin/packages/kbn-storybook/npm_module_types":
version "0.0.0"
uid ""

"@types/kbn__telemetry-tools@link:bazel-bin/packages/kbn-telemetry-tools/npm_module_types":
version "0.0.0"
uid ""
Expand Down

0 comments on commit b7e97ee

Please sign in to comment.