diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/js/cfworker/build.sh | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/js/cfworker/build.sh')
-rw-r--r-- | third_party/js/cfworker/build.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/third_party/js/cfworker/build.sh b/third_party/js/cfworker/build.sh new file mode 100644 index 0000000000..a11d4356de --- /dev/null +++ b/third_party/js/cfworker/build.sh @@ -0,0 +1,42 @@ +#!/bin/sh +set -euo pipefail + +# Path to mach relative to /third_party/js/cfworker +MACH=$(realpath "../../../mach") + +if [[ $(uname -a) == *MSYS* ]]; then + MACH="python ${MACH}" +fi + +NODE="${MACH} node" +NPM="${MACH} npm" + +# Delete empty vestigial directories. +rm -rf .changeset/ .github/ .vscode/ + +# Patch typescript config to ensure we have LF endings. +patch tsconfig-base.json tsconfig-base.json.patch + +cd packages/json-schema + +# Install dependencies. +${NPM} install --also=dev + +# Compile TypeScript into JavaScript. +${NPM} run build + +# Install rollup and bundle into a single module. +${NPM} install rollup@~2.67.x +${NODE} node_modules/rollup/dist/bin/rollup \ + dist/index.js \ + --file json-schema.js \ + --format cjs + +cd ../.. + +# Patch the CommonJS module into a regular JS file and include a copyright notice. +patch packages/json-schema/json-schema.js json-schema.js.patch +awk -f exports.awk packages/json-schema/json-schema.js >json-schema.js + +# Remove source files we no longer need. +rm -rf packages/ tsconfig-base.json |