diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2019-10-09 09:59:34 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2019-10-09 14:48:05 +0200 |
| commit | 206bf6fe05e66eafa17531780b98df97d107e319 (patch) | |
| tree | d9ddeae6230ec84cfd83317703e2fbe8f9ad9b85 | |
| parent | 04250a09391d6eee40a6d144149c92ad0b5b72a2 (diff) | |
| download | mullvadvpn-206bf6fe05e66eafa17531780b98df97d107e319.tar.xz mullvadvpn-206bf6fe05e66eafa17531780b98df97d107e319.zip | |
Use `npm ci` and `npm version`, bump node requirements to v12
| -rw-r--r-- | .travis.yml | 6 | ||||
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | appveyor_gui.yml | 7 | ||||
| -rwxr-xr-x | build.sh | 12 | ||||
| -rwxr-xr-x | prepare_release.sh | 2 | ||||
| -rwxr-xr-x | version_metadata.sh | 9 |
6 files changed, 28 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml index 5c4f4c2844..27cab903cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,13 +10,15 @@ matrix: include: # GUI - Electron - language: node_js - node_js: '8' + node_js: '12' cache: npm services: - xvfb + before_install: + - npm install -g npm install: - cd gui - - npm install + - npm ci --no-optional script: - npm run check-format - npm run lint @@ -181,15 +181,14 @@ storePassword = keystore-password 1. Get the latest **stable** Rust toolchain via [rustup.rs](https://rustup.rs/). -1. Get the latest version 8 LTS release of Node.js and the latest version of npm. +1. Get the latest version 12 release of Node.js and the latest version of npm. #### macOS ```bash - brew install node@8 - export PATH="/usr/local/opt/node@8/bin:$PATH" + brew install node ``` #### Linux - Just download and unpack the `node-v8.xxxx.tar.xz` tarball and add its `bin` directory to your + Just download and unpack the `node-v12.xxxx.tar.xz` tarball and add its `bin` directory to your `PATH`. #### Windows diff --git a/appveyor_gui.yml b/appveyor_gui.yml index c9daf04a4e..d405aea46f 100644 --- a/appveyor_gui.yml +++ b/appveyor_gui.yml @@ -1,8 +1,13 @@ +environment: + nodejs_version: "12" + install: + - ps: Install-Product node 12 + - npm install -g npm - npm --version - node --version - cd gui - - npm install + - npm ci --no-optional # This is the "test phase", tweak it as you see fit test_script: @@ -73,14 +73,12 @@ function restore_metadata_backups() { pushd "$SCRIPT_DIR" echo "Restoring version metadata files..." ./version_metadata.sh restore-backup - mv gui/package-lock.json.bak gui/package-lock.json || true mv Cargo.lock.bak Cargo.lock || true popd } trap 'restore_metadata_backups' EXIT echo "Updating version in metadata files..." -cp gui/package-lock.json gui/package-lock.json.bak cp Cargo.lock Cargo.lock.bak ./version_metadata.sh inject $PRODUCT_VERSION @@ -161,7 +159,15 @@ echo $JSONRPC_RESPONSE | node -e "$JSONRPC_CODE" > dist-assets/relays.json pushd "$SCRIPT_DIR/gui" echo "Installing JavaScript dependencies..." -npm install + +# Add `--no-optional` flag when running on non-macOS environments because `npm ci` attempts to +# install optional dependencies that aren't even available on other platforms. +NPM_CI_ARGS="" +if [ "$(uname -s)" != "Darwin" ]; then + NPM_CI_ARGS+="--no-optional" +fi + +npm ci $NPM_CI_ARGS ################################################################################ # Package release. diff --git a/prepare_release.sh b/prepare_release.sh index b55744403a..f30e2e2749 100755 --- a/prepare_release.sh +++ b/prepare_release.sh @@ -30,8 +30,6 @@ echo "Syncing Cargo.lock with new version numbers" source env.sh "" cargo +stable build -(cd gui/ && npm install) || exit 1 - echo "Commiting metadata changes to git..." git commit -S -m "Updating version in package files" \ gui/package.json \ diff --git a/version_metadata.sh b/version_metadata.sh index 6624ea9f37..e2d3b1907a 100755 --- a/version_metadata.sh +++ b/version_metadata.sh @@ -30,8 +30,9 @@ case "$1" in SEMVER_PATCH="0" # Electron GUI - sed -i.bak -Ee "s/\"version\": \"[^\"]+\",/\"version\": \"$SEMVER_VERSION\",/g" \ - gui/package.json + cp gui/package.json gui/package.json.bak + cp gui/package-lock.json gui/package-lock.json.bak + (cd gui/ && npm version $SEMVER_VERSION --no-git-tag-version) # Rust crates sed -i.bak -Ee "s/^version = \"[^\"]+\"\$/version = \"$SEMVER_VERSION\"/g" \ @@ -61,6 +62,7 @@ EOF "restore-backup") # Electron GUI mv gui/package.json.bak gui/package.json || true + mv gui/package-lock.json.bak gui/package-lock.json || true # Rust crates mv mullvad-daemon/Cargo.toml.bak mullvad-daemon/Cargo.toml || true mv mullvad-cli/Cargo.toml.bak mullvad-cli/Cargo.toml || true @@ -76,6 +78,7 @@ EOF "delete-backup") # Electron GUI rm gui/package.json.bak || true + rm gui/package-lock.json.bak || true # Rust crates rm mullvad-daemon/Cargo.toml.bak || true rm mullvad-cli/Cargo.toml.bak || true @@ -92,4 +95,4 @@ EOF echo "Invalid command" exit 1 ;; -esac
\ No newline at end of file +esac |
