2022-08-04 20:03:50 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
|
|
|
echo "Installing global npm packages"
|
2022-08-25 04:13:40 +03:00
|
|
|
cd npm_linux || exit 1
|
2022-08-04 20:03:50 +03:00
|
|
|
npm ci
|
|
|
|
|
2022-08-25 04:13:40 +03:00
|
|
|
cd ../../ || exit 1
|
2022-08-04 20:03:50 +03:00
|
|
|
git submodule update --init chia-blockchain-gui
|
|
|
|
|
2022-08-25 04:13:40 +03:00
|
|
|
cd ./chia-blockchain-gui || exit 1
|
2022-08-04 20:03:50 +03:00
|
|
|
echo "npm build"
|
2023-09-05 18:10:38 +03:00
|
|
|
npx lerna clean -y
|
2022-08-04 20:03:50 +03:00
|
|
|
npm ci
|
|
|
|
# Audit fix does not currently work with Lerna. See https://github.com/lerna/lerna/issues/1663
|
|
|
|
# npm audit fix
|
|
|
|
npm run build
|
|
|
|
LAST_EXIT_CODE=$?
|
|
|
|
if [ "$LAST_EXIT_CODE" -ne 0 ]; then
|
|
|
|
echo >&2 "npm run build failed!"
|
|
|
|
exit $LAST_EXIT_CODE
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove unused packages
|
|
|
|
rm -rf node_modules
|
|
|
|
|
|
|
|
# Other than `chia-blockchain-gui/package/gui`, all other packages are no longer necessary after build.
|
|
|
|
# Since these unused packages make cache unnecessarily fat, here unused packages are removed.
|
2022-12-05 20:44:43 +03:00
|
|
|
echo "Remove unused @chia-network packages to make cache slim"
|
2022-08-04 20:03:50 +03:00
|
|
|
ls -l packages
|
|
|
|
rm -rf packages/api
|
|
|
|
rm -rf packages/api-react
|
|
|
|
rm -rf packages/core
|
|
|
|
rm -rf packages/icons
|
|
|
|
rm -rf packages/wallets
|
|
|
|
|
|
|
|
# Remove unused fat npm modules from the gui package
|
2022-08-25 04:13:40 +03:00
|
|
|
cd ./packages/gui/node_modules || exit 1
|
2022-08-04 20:03:50 +03:00
|
|
|
echo "Remove unused node_modules in the gui package to make cache slim more"
|
|
|
|
rm -rf electron/dist # ~186MB
|
|
|
|
rm -rf "@mui" # ~71MB
|
|
|
|
rm -rf typescript # ~63MB
|
|
|
|
|
2022-12-05 20:44:43 +03:00
|
|
|
# Remove `packages/gui/node_modules/@chia-network` because it causes an error on later `electron-packager` command
|
|
|
|
rm -rf "@chia-network"
|