diff --git a/cli-ext/build.sh b/cli-ext/build.sh new file mode 100755 index 0000000000000..f4ffbaeade35f --- /dev/null +++ b/cli-ext/build.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e +set -u + +cd -- "$(dirname -- "${BASH_SOURCE[0]}")" + +rm -rf ./bin/* +pkg ./build/command.js --output ./bin/cli-ext -t node16-linux-x64,node16-macos-x64,node16-win-x64,node16-linux-arm64,node16-macos-arm64 + +for binary in bin/cli-ext-*; do + if ! [[ "$binary" =~ \.sha256$ ]]; then + source="$(basename "$binary")" + target="$(sed "s/x64/amd64/g; s/win/windows/g; s/macos/darwin/g; s/\\.exe//g" <<< "$source")" + if [[ "$source" != "$target" ]]; then + mv "bin/${source}" "bin/${target}" + fi + fi +done diff --git a/cli-ext/package.json b/cli-ext/package.json index 90cbc3a2c324d..ee54d8023d8db 100644 --- a/cli-ext/package.json +++ b/cli-ext/package.json @@ -6,8 +6,7 @@ "scripts": { "transpile": "rm -rf build/* && babel --extensions '.ts,.js' ./src ./tests --out-dir build", "prebuild": "npm run transpile", - "build": "rm -rf ./bin/* && pkg ./build/command.js --output ./bin/cli-ext -t node12-linux-x64,node12-macos-x64,node12-win-x64,node12-linux-arm64,node16-macos-arm64", - "postbuild": "ls bin | grep \"^cli-ext-\" | grep -v sha256 | xargs -L 1 -I{} /bin/bash -c 'mv bin/{} bin/\"$(cut -d- --complement -f3 <(echo {}) | sed \"s/x64/amd64/g; s/win/windows/g; s/macos/darwin/g; s/\\.exe//g\")\"'", + "build": "./build.sh", "pretest": "npm run transpile && babel ./tests --out-dir _tmptests", "posttest": "rm -rf _tmptests", "test": "node ./_tmptests/index.js",