2020-05-08 11:48:49 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2024-10-05 08:08:14 +08:00
|
|
|
# Once we have an NPM package, use this script to copy it to a separate
|
|
|
|
# directory (./release-standalone) and install the dependencies. This new
|
|
|
|
# directory can then be packaged as a platform-specific release.
|
|
|
|
|
2020-05-08 11:48:49 +08:00
|
|
|
main() {
|
|
|
|
cd "$(dirname "${0}")/../.."
|
2021-09-09 03:05:49 +08:00
|
|
|
|
2020-05-16 22:55:46 +08:00
|
|
|
source ./ci/lib.sh
|
2020-05-08 11:48:49 +08:00
|
|
|
|
2022-12-09 01:44:27 +08:00
|
|
|
rsync "$RELEASE_PATH/" "$RELEASE_PATH-standalone"
|
2020-05-28 04:39:17 +08:00
|
|
|
RELEASE_PATH+=-standalone
|
2020-05-08 11:48:49 +08:00
|
|
|
|
2024-10-05 08:08:14 +08:00
|
|
|
# Package managers may shim their own "node" wrapper into the PATH, so run
|
|
|
|
# node and ask it for its true path.
|
2020-05-08 11:48:49 +08:00
|
|
|
local node_path
|
2023-09-28 11:17:47 +08:00
|
|
|
node_path="$(node <<< 'console.info(process.execPath)')"
|
2020-05-08 11:48:49 +08:00
|
|
|
|
|
|
|
mkdir -p "$RELEASE_PATH/bin"
|
2021-09-09 03:05:49 +08:00
|
|
|
mkdir -p "$RELEASE_PATH/lib"
|
2020-05-08 11:48:49 +08:00
|
|
|
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
|
2020-05-22 07:18:50 +08:00
|
|
|
rsync "$node_path" "$RELEASE_PATH/lib/node"
|
2020-05-08 11:48:49 +08:00
|
|
|
|
2023-06-22 03:00:52 +08:00
|
|
|
chmod 755 "$RELEASE_PATH/lib/node"
|
|
|
|
|
2022-08-05 00:03:28 +08:00
|
|
|
pushd "$RELEASE_PATH"
|
2022-09-07 02:03:27 +08:00
|
|
|
npm install --unsafe-perm --omit=dev
|
2024-07-26 01:16:15 +08:00
|
|
|
# Code deletes some files from the extension node_modules directory which
|
|
|
|
# leaves broken symlinks in the corresponding .bin directory. nfpm will fail
|
|
|
|
# on these broken symlinks so clean them up.
|
|
|
|
rm -fr "./lib/vscode/extensions/node_modules/.bin"
|
2022-08-05 00:03:28 +08:00
|
|
|
popd
|
2020-05-08 11:48:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|