Skip to content

Commit

Permalink
cli-ext: Upgrade the node.js version to 16 when packaging.
Browse files Browse the repository at this point in the history
This brings it all in line. It seems to work fine for me.

I am doing this because I can't seem to cross-build with node.js v12 on macOS+arm64.

PR-URL: hasura/graphql-engine-mono#8713
GitOrigin-RevId: 06d7daa4176e99584ab88146a3d17200721ae8bf
  • Loading branch information
SamirTalwar authored and hasura-bot committed Apr 21, 2023
1 parent 5649924 commit 07db08c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
19 changes: 19 additions & 0 deletions cli-ext/build.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions cli-ext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 07db08c

Please sign in to comment.