diff options
| -rwxr-xr-x | desktop/scripts/install-scripts.sh | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/desktop/scripts/install-scripts.sh b/desktop/scripts/install-scripts.sh new file mode 100755 index 0000000000..b827f55aa3 --- /dev/null +++ b/desktop/scripts/install-scripts.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +set -eu + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +DESKTOP_DIR="$( cd "$SCRIPT_DIR/.." && pwd )" +REPO_DIR="$( cd "$SCRIPT_DIR/../.." && pwd )" + +source "$REPO_DIR/scripts/utils/log" + +function desktop_ci() { + desktop_pre_install + pushd "$DESKTOP_DIR" + npm ci --no-audit --no-fund + popd + desktop_post_install +} + +function desktop_install() { + desktop_pre_install + pushd "$DESKTOP_DIR" + npm install + popd + desktop_post_install +} + + +function desktop_post_install() { + # Setup electron after install + pushd "$DESKTOP_DIR/node_modules/electron" + npm run postinstall + popd + + # Run postinstall in our own packages + pushd "$DESKTOP_DIR" + npm run postinstall --if-present --ws + popd +} + +function desktop_pre_install() { + # Run preinstall in our own packages + pushd "$DESKTOP_DIR" + npm run preinstall --if-present --ws + popd +} + +case ${1-:""} in + ci) + desktop_ci + ;; + install) + desktop_install + ;; + *) + log_error "Invalid argument. Specify 'ci' or 'install' as the first argument." + exit 1 +esac + |
