2021-04-01 23:51:32 +02:00
|
|
|
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
|
|
|
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
|
|
|
|
|
|
|
PKG_BASE_NAME = "elastic-datemath"
|
|
|
|
PKG_REQUIRE_NAME = "@elastic/datemath"
|
|
|
|
|
2021-04-13 20:14:06 +02:00
|
|
|
SOURCE_FILES = glob([
|
2021-04-01 23:51:32 +02:00
|
|
|
"src/index.ts",
|
2021-04-13 20:14:06 +02:00
|
|
|
])
|
2021-04-01 23:51:32 +02:00
|
|
|
|
|
|
|
SRCS = SOURCE_FILES
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
name = "srcs",
|
2021-04-13 20:14:06 +02:00
|
|
|
srcs = SRCS,
|
2021-04-01 23:51:32 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
NPM_MODULE_EXTRA_FILES = [
|
|
|
|
"package.json",
|
|
|
|
"README.md",
|
|
|
|
]
|
|
|
|
|
|
|
|
SRC_DEPS = [
|
|
|
|
"@npm//moment",
|
|
|
|
]
|
|
|
|
|
|
|
|
TYPES_DEPS = [
|
|
|
|
"@npm//@types/node",
|
|
|
|
]
|
|
|
|
|
|
|
|
DEPS = SRC_DEPS + TYPES_DEPS
|
|
|
|
|
|
|
|
ts_config(
|
|
|
|
name = "tsconfig",
|
|
|
|
src = "tsconfig.json",
|
|
|
|
deps = [
|
|
|
|
"//:tsconfig.base.json",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
ts_project(
|
|
|
|
name = "tsc",
|
2021-04-13 02:24:19 +02:00
|
|
|
args = ['--pretty'],
|
2021-04-01 23:51:32 +02:00
|
|
|
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,
|
2021-04-23 18:48:48 +02:00
|
|
|
srcs = NPM_MODULE_EXTRA_FILES,
|
2021-04-01 23:51:32 +02:00
|
|
|
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"],
|
|
|
|
)
|