2020-04-30 11:52:54 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# Builds code-server into out and the frontend into dist.
|
|
|
|
|
|
|
|
main() {
|
|
|
|
cd "$(dirname "${0}")/../.."
|
|
|
|
|
2020-08-04 20:05:13 +00:00
|
|
|
tsc
|
|
|
|
|
2020-04-30 11:52:54 +00:00
|
|
|
# If out/node/entry.js does not already have the shebang,
|
|
|
|
# we make sure to add it and make it executable.
|
|
|
|
if ! grep -q -m1 "^#!/usr/bin/env node" out/node/entry.js; then
|
|
|
|
sed -i.bak "1s;^;#!/usr/bin/env node\n;" out/node/entry.js && rm out/node/entry.js.bak
|
|
|
|
chmod +x out/node/entry.js
|
|
|
|
fi
|
|
|
|
|
2021-09-15 19:17:39 +00:00
|
|
|
# for arch; we do not use OS from lib.sh and get our own.
|
|
|
|
# lib.sh normalizes macos to darwin - but cloud-agent's binaries do not
|
|
|
|
source ./ci/lib.sh
|
|
|
|
OS="$(uname | tr '[:upper:]' '[:lower:]')"
|
|
|
|
|
2020-10-06 18:19:04 +00:00
|
|
|
if ! [ -f ./lib/coder-cloud-agent ]; then
|
2021-05-05 16:23:30 +00:00
|
|
|
echo "Downloading the cloud agent..."
|
|
|
|
|
2020-12-14 20:18:10 +00:00
|
|
|
set +e
|
2021-05-05 16:23:30 +00:00
|
|
|
curl -fsSL "https://github.com/cdr/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent
|
2020-10-06 18:19:04 +00:00
|
|
|
chmod +x ./lib/coder-cloud-agent
|
2020-12-14 20:18:10 +00:00
|
|
|
set -e
|
2020-10-06 18:19:04 +00:00
|
|
|
fi
|
|
|
|
|
2021-09-15 19:17:39 +00:00
|
|
|
if ! [ -f ./lib/linkup ]; then
|
|
|
|
echo "Downloading Link agent..."
|
|
|
|
|
|
|
|
set +e
|
|
|
|
curl -fsSL "https://storage.googleapis.com/coder-link-releases/latest/linkup-$OS-$ARCH" -o ./lib/linkup
|
|
|
|
chmod +x ./lib/linkup
|
|
|
|
set -e
|
|
|
|
fi
|
|
|
|
|
2021-06-23 17:19:50 +00:00
|
|
|
yarn browserify out/browser/register.js -o out/browser/register.browserified.js
|
|
|
|
yarn browserify out/browser/pages/login.js -o out/browser/pages/login.browserified.js
|
|
|
|
yarn browserify out/browser/pages/vscode.js -o out/browser/pages/vscode.browserified.js
|
2020-04-30 11:52:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|