From 92bdefe365f0da450160c0833b0d7265e63ba080 Mon Sep 17 00:00:00 2001 From: Tobias Järvelöv Date: Thu, 9 Apr 2026 14:11:53 +0200 Subject: Add .npmrc --- desktop/.npmrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 desktop/.npmrc diff --git a/desktop/.npmrc b/desktop/.npmrc new file mode 100644 index 0000000000..bf735bdb32 --- /dev/null +++ b/desktop/.npmrc @@ -0,0 +1,3 @@ +ignore-scripts=true # disable preinstall/postinstall life cycle hooks +min-release-age=1 # 1 day +allow-git=none -- cgit v1.3-3-g829e From 6246a8fa04ffc8c31836932eb6b4bb205cd4a350 Mon Sep 17 00:00:00 2001 From: Tobias Järvelöv Date: Fri, 10 Apr 2026 17:11:40 +0200 Subject: Add shell script to replace npm lifecycle operations --- desktop/scripts/install-scripts.sh | 57 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 desktop/scripts/install-scripts.sh 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 + -- cgit v1.3-3-g829e From 5ea98af9fc97106c2180ce1bf6843a4631fffdc3 Mon Sep 17 00:00:00 2001 From: Tobias Järvelöv Date: Fri, 10 Apr 2026 17:13:31 +0200 Subject: Add custom npm scripts 'ci' and 'install' to replace their counterparts --- desktop/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/desktop/package.json b/desktop/package.json index 6fdb56cbed..aa78647557 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -13,6 +13,8 @@ "license": "GPL-3.0-or-later", "scripts": { "lint": "eslint --ignore-pattern packages/ . && npm run lint --workspaces --if-present", + "ci": "bash ./scripts/install-scripts.sh ci", + "install": "bash ./scripts/install-scripts.sh install", "lint-fix": "eslint --fix --ignore-pattern packages/ . && npm run lint-fix --workspaces --if-present", "test": "npm run test --workspaces --if-present" }, -- cgit v1.3-3-g829e From 002a33da79b1e10f0b595349d6d3d3ce55590aa6 Mon Sep 17 00:00:00 2001 From: Tobias Järvelöv Date: Fri, 10 Apr 2026 17:14:17 +0200 Subject: Update package-lock.json after adding custom 'install' script --- desktop/package-lock.json | 1 + 1 file changed, 1 insertion(+) diff --git a/desktop/package-lock.json b/desktop/package-lock.json index 2a74d992cb..419a1a21ad 100644 --- a/desktop/package-lock.json +++ b/desktop/package-lock.json @@ -7,6 +7,7 @@ "": { "name": "desktop", "version": "0.0.0", + "hasInstallScript": true, "license": "GPL-3.0-or-later", "workspaces": [ "packages/*" -- cgit v1.3-3-g829e From 765cf12e4512de39e1a611b3212dcb2d4ba3a266 Mon Sep 17 00:00:00 2001 From: Tobias Järvelöv Date: Fri, 10 Apr 2026 17:13:54 +0200 Subject: Update usage of 'npm ci' and `npm install` to 'npm run` counterparts --- .github/workflows/frontend.yml | 2 +- .github/workflows/translations.yml | 2 +- BuildInstructions.md | 2 +- build.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index c6bd51e2f8..f0d5c23d39 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -32,7 +32,7 @@ jobs: - name: Install dependencies working-directory: desktop shell: bash - run: npm ci + run: npm run ci - name: Check formatting if: matrix.os == 'ubuntu-latest' diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml index ee5eafb27a..0aa99fcdab 100644 --- a/.github/workflows/translations.yml +++ b/.github/workflows/translations.yml @@ -30,7 +30,7 @@ jobs: - name: Install JS dependencies working-directory: desktop shell: bash - run: npm ci + run: npm run ci - name: Verify translations shell: bash diff --git a/BuildInstructions.md b/BuildInstructions.md index 9bf2f2eda9..18eba2977c 100644 --- a/BuildInstructions.md +++ b/BuildInstructions.md @@ -329,7 +329,7 @@ This section is for building the desktop app individually. 1. Install all the JavaScript dependencies by running: ```bash - npm install -w mullvad-vpn + npm run install ``` 1. Start the Electron app in development mode by running: diff --git a/build.sh b/build.sh index b83995acbb..955bb2e6e4 100755 --- a/build.sh +++ b/build.sh @@ -462,7 +462,7 @@ if [[ "$DAEMON_ONLY" == "false" ]]; then log_header "Installing JavaScript dependencies" pushd desktop - npm ci --no-audit --no-fund + npm run ci pushd packages/mullvad-vpn -- cgit v1.3-3-g829e