2021-01-01 13:45:25 +01:00
|
|
|
load("//ts:copy.bzl", "copy_select_files")
|
2020-12-20 20:10:45 +01:00
|
|
|
|
|
|
|
"Rule to copy jquery subset from node_modules to vendor folder."
|
|
|
|
|
|
|
|
_include = [
|
|
|
|
"dist/jquery.min.js"
|
|
|
|
]
|
|
|
|
|
2021-01-01 14:39:15 +01:00
|
|
|
_base = "external/npm/node_modules/jquery/"
|
|
|
|
_unwanted_prefix = "dist/"
|
2020-12-20 20:10:45 +01:00
|
|
|
|
|
|
|
def _copy_jquery_impl(ctx):
|
2021-01-01 13:45:25 +01:00
|
|
|
return copy_select_files(
|
|
|
|
ctx,
|
|
|
|
ctx.attr.jquery.files,
|
|
|
|
_include,
|
|
|
|
[],
|
2021-01-01 14:39:15 +01:00
|
|
|
_base,
|
2021-01-01 13:45:25 +01:00
|
|
|
_unwanted_prefix,
|
|
|
|
)
|
2020-12-20 20:10:45 +01:00
|
|
|
|
|
|
|
copy_jquery = rule(
|
|
|
|
implementation = _copy_jquery_impl,
|
|
|
|
attrs = {
|
|
|
|
"jquery": attr.label(default = "@npm//jquery:jquery__files"),
|
|
|
|
},
|
|
|
|
)
|