47 lines
785 B
Python
47 lines
785 B
Python
|
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
|
||
|
load("@npm//peggy:index.bzl", "peggy")
|
||
|
|
||
|
PKG_BASE_NAME = "kbn-timelion-grammar"
|
||
|
PKG_REQUIRE_NAME = "@kbn/timelion-grammar"
|
||
|
|
||
|
NPM_MODULE_EXTRA_FILES = [
|
||
|
"package.json",
|
||
|
]
|
||
|
|
||
|
peggy(
|
||
|
name = "grammar",
|
||
|
data = [
|
||
|
":grammar/chain.peggy"
|
||
|
],
|
||
|
output_dir = True,
|
||
|
args = [
|
||
|
"-o",
|
||
|
"$(@D)/chain.js",
|
||
|
"./%s/grammar/chain.peggy" % package_name()
|
||
|
],
|
||
|
)
|
||
|
|
||
|
js_library(
|
||
|
name = PKG_BASE_NAME,
|
||
|
srcs = NPM_MODULE_EXTRA_FILES + [
|
||
|
":grammar"
|
||
|
],
|
||
|
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"],
|
||
|
)
|