Copy flot file to vendor directory
This commit is contained in:
parent
6aad58260b
commit
ef9b52f861
7
qt/aqt/data/web/js/vendor/BUILD.bazel
vendored
7
qt/aqt/data/web/js/vendor/BUILD.bazel
vendored
@ -1,13 +1,20 @@
|
|||||||
load("//ts:jquery.bzl", "copy_jquery")
|
load("//ts:jquery.bzl", "copy_jquery")
|
||||||
|
load("//ts:flot.bzl", "copy_flot")
|
||||||
|
|
||||||
copy_jquery(
|
copy_jquery(
|
||||||
name = "jquery",
|
name = "jquery",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
copy_flot(
|
||||||
|
name = "flot",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
files = [
|
files = [
|
||||||
"jquery",
|
"jquery",
|
||||||
|
"flot",
|
||||||
]
|
]
|
||||||
|
|
||||||
directories = [
|
directories = [
|
||||||
|
29
ts/flot.bzl
Normal file
29
ts/flot.bzl
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
load("//ts:copy.bzl", "copy_files")
|
||||||
|
|
||||||
|
"Rule to copy flot subset from node_modules to vendor folder."
|
||||||
|
|
||||||
|
_include = [
|
||||||
|
"dist/es5/jquery.flot.js",
|
||||||
|
]
|
||||||
|
|
||||||
|
_unwanted_prefix = "external/npm/node_modules/flot/dist/es5/"
|
||||||
|
|
||||||
|
def _copy_flot_impl(ctx):
|
||||||
|
wanted = []
|
||||||
|
for f in ctx.attr.flot.files.to_list():
|
||||||
|
path = f.path
|
||||||
|
want = True
|
||||||
|
|
||||||
|
for substr in _include:
|
||||||
|
if substr in path:
|
||||||
|
output = path.replace(_unwanted_prefix, "")
|
||||||
|
wanted.append((f, output))
|
||||||
|
|
||||||
|
return copy_files(ctx, wanted)
|
||||||
|
|
||||||
|
copy_flot = rule(
|
||||||
|
implementation = _copy_flot_impl,
|
||||||
|
attrs = {
|
||||||
|
"flot": attr.label(default = "@npm//flot:flot__files"),
|
||||||
|
},
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user