chia-blockchain/build_scripts/build_macos-1-gui.sh
Izumi Hoshino b3b56a64d1
Replace electron-packager with electron-builder (#12953)
* Install electron-builder

* Replaced electron-packager with electron-builder for windows

* Upgraded electron-builder version for mac

* Replaced electron-packager with electron-builder for Linux and integreated deb/rpm dir

* Updated mac installer job

* Fixed app.asar location

* Fixed dmg name for arm64 mac

* Updated installer-version.py

* Updated Linux(deb) installer CI job

* Updated Linux(rpm) installer CI job

* Fixed Linux(rpm) install CI issue

* Revert to use `electron-packager` instead of `electron-builder` for arm64 .deb installer

* Fixed lint errors

* Fixed rpm installer job issue

* Updated Windows installer CI job

* Fixed rpm installer CI job

* Simplified arm64 build

* Added -y option to `apt install` command

* Added `dmg-license` as npm build dependency for MacOS

* Attempt to set product name appropriately for each platform

* Specified productNames in commands

* Fixed arm64 installer issue

* Stopped to create link '/opt/chia/daemon'

* Updated desktop app name for linux installers

* Updated packageName for linux installers

* Abort build jobs when 'cd' fails

* Updated the GUI submodule ref (main:5e52b7f53478d4f39b4a0f0203f41e31dd53aee9)

Co-authored-by: Jeff Cruikshank <jeff@chia.net>
2022-08-24 20:13:40 -05:00

49 lines
1.3 KiB
Bash

#!/bin/bash
set -o errexit -o nounset
git status
echo "Installing global npm packages"
cd npm_macos || exit 1
npm ci
PATH=$(npm bin):$PATH
cd ../../ || exit 1
git submodule update --init chia-blockchain-gui
cd ./chia-blockchain-gui || exit 1
echo "npm build"
lerna clean -y
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, unused packages should be removed.
echo "Remove unused @chia packages to make cache slim"
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
cd ./packages/gui/node_modules || exit 1
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
# Remove `packages/gui/node_modules/@chia` because it causes an error on later `electron-packager` command
rm -rf "@chia"