diff --git a/qt/aqt/data/web/js/vendor/BUILD.bazel b/qt/aqt/data/web/js/vendor/BUILD.bazel index 67c626e75..84583082b 100644 --- a/qt/aqt/data/web/js/vendor/BUILD.bazel +++ b/qt/aqt/data/web/js/vendor/BUILD.bazel @@ -1,13 +1,20 @@ load("//ts:jquery.bzl", "copy_jquery") +load("//ts:flot.bzl", "copy_flot") copy_jquery( name = "jquery", visibility = ["//visibility:public"], ) +copy_flot( + name = "flot", + visibility = ["//visibility:public"], +) + files = [ "jquery", + "flot", ] directories = [ diff --git a/ts/flot.bzl b/ts/flot.bzl new file mode 100644 index 000000000..dc250ee71 --- /dev/null +++ b/ts/flot.bzl @@ -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"), + }, +)