From 079ce6bdf0771ec6b55f7852e899bb644bf27e52 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Thu, 31 Dec 2020 16:06:44 +0100 Subject: [PATCH] Add bazel recipe and update protobufjs to 6.10.2 --- ts/package.json | 2 +- ts/protobufjs.bzl | 29 +++++++++++++++++++++++++++++ ts/yarn.lock | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 ts/protobufjs.bzl diff --git a/ts/package.json b/ts/package.json index 7f1ee8a7d..3f7bdd6d8 100644 --- a/ts/package.json +++ b/ts/package.json @@ -67,7 +67,7 @@ "lodash.debounce": "^4.0.8", "lodash.throttle": "^4.1.1", "mathjax": "^3.1.2", - "protobufjs": "^6.10.1" + "protobufjs": "^6.10.2" }, "files": [ "dist/*" diff --git a/ts/protobufjs.bzl b/ts/protobufjs.bzl new file mode 100644 index 000000000..218d2ac65 --- /dev/null +++ b/ts/protobufjs.bzl @@ -0,0 +1,29 @@ +load("//ts:copy.bzl", "copy_files") + +"Rule to copy protobufjs subset from node_modules to vendor folder." + +_include = [ + "dist/protobuf.min.js", +] + +_unwanted_prefix = "external/npm/node_modules/protobufjs/dist/" + +def _copy_protobufjs_impl(ctx): + wanted = [] + for f in ctx.attr.protobufjs.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_protobufjs = rule( + implementation = _copy_protobufjs_impl, + attrs = { + "protobufjs": attr.label(default = "@npm//protobufjs:protobufjs__files"), + }, +) diff --git a/ts/yarn.lock b/ts/yarn.lock index 0bb62a605..db681fd30 100644 --- a/ts/yarn.lock +++ b/ts/yarn.lock @@ -2200,7 +2200,7 @@ protobufjs@6.8.8: "@types/node" "^10.1.0" long "^4.0.0" -protobufjs@^6.10.1: +protobufjs@^6.10.2: version "6.10.2" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.10.2.tgz#b9cb6bd8ec8f87514592ba3fdfd28e93f33a469b" integrity sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ==