From 84f8a2450ad14e25929bceb17749cc58dedc0ca4 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Wed, 30 Dec 2020 11:56:20 +0100 Subject: [PATCH] Add jquery-ui bazel build file --- ts/jquery-ui.bzl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ts/jquery-ui.bzl diff --git a/ts/jquery-ui.bzl b/ts/jquery-ui.bzl new file mode 100644 index 000000000..319d71105 --- /dev/null +++ b/ts/jquery-ui.bzl @@ -0,0 +1,29 @@ +load("//ts:copy.bzl", "copy_files") + +"Rule to copy jquery-ui subset from node_modules to vendor folder." + +_include = [ + "jquery-ui.min.js", +] + +_unwanted_prefix = "external/npm/node_modules/jquery-ui-dist/" + +def _copy_jquery_ui_impl(ctx): + wanted = [] + for f in ctx.attr.jquery-ui.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_jquery_ui = rule( + implementation = _copy_jquery_ui_impl, + attrs = { + "jquery-ui": attr.label(default = "@npm//jquery-ui-dist:jquery-ui-dist__files"), + }, +)