7c429f725e
* chore(NA): moving @kbn/storybook into bazel * chore(NA): add some typing changes * chore(NA): rename typings file * chore(NA): fix typescript configs to build storybooks * chore(NA): fix eslint and typechecking
98 lines
1.7 KiB
Python
98 lines
1.7 KiB
Python
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-storybook"
|
|
PKG_REQUIRE_NAME = "@kbn/storybook"
|
|
|
|
SOURCE_FILES = glob(
|
|
[
|
|
"lib/**/*.ts",
|
|
"lib/**/*.tsx",
|
|
"*.ts",
|
|
],
|
|
exclude = ["**/*.test.*"],
|
|
)
|
|
|
|
SRCS = SOURCE_FILES
|
|
|
|
filegroup(
|
|
name = "srcs",
|
|
srcs = SRCS,
|
|
)
|
|
|
|
NPM_MODULE_EXTRA_FILES = [
|
|
"preset/package.json",
|
|
"templates/index.ejs",
|
|
"package.json",
|
|
"README.md",
|
|
"preset.js",
|
|
]
|
|
|
|
SRC_DEPS = [
|
|
"//packages/kbn-dev-utils",
|
|
"//packages/kbn-ui-shared-deps",
|
|
"@npm//@storybook/addons",
|
|
"@npm//@storybook/api",
|
|
"@npm//@storybook/components",
|
|
"@npm//@storybook/core",
|
|
"@npm//@storybook/node-logger",
|
|
"@npm//@storybook/react",
|
|
"@npm//@storybook/theming",
|
|
"@npm//loader-utils",
|
|
"@npm//react",
|
|
"@npm//webpack",
|
|
"@npm//webpack-merge",
|
|
]
|
|
|
|
TYPES_DEPS = [
|
|
"@npm//@types/loader-utils",
|
|
"@npm//@types/node",
|
|
"@npm//@types/webpack",
|
|
"@npm//@types/webpack-merge",
|
|
]
|
|
|
|
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,
|
|
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"],
|
|
)
|