diff options
| author | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-02-17 17:40:50 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-02-25 12:50:57 +0100 |
| commit | 3d7510a63c14d204379f36857898b5fcb9d2e0fc (patch) | |
| tree | 1856352eac2d6137c47dcbda12ac4c32e44aac04 | |
| parent | cefb461fdb7d81c220eb1c86ca979c3585110bc4 (diff) | |
| download | mullvadvpn-3d7510a63c14d204379f36857898b5fcb9d2e0fc.tar.xz mullvadvpn-3d7510a63c14d204379f36857898b5fcb9d2e0fc.zip | |
Set postinstall script to build typescript lib
We want the typescript files to be available
after the npm installation has completed.[1]
Previously we only built the typescript files in
packages when they would be used on the platform
we are building for.
However, until the typescript files have been
generated we can't use imports in the mullvad-vpn
package to the other packages, such as
win-shortcuts.
If we use imports from these packages then the
builds will fail on platforms where these
packages are not used, as they haven't been built
before we transpile typescript into javascript.
The build failure occurs as typescript will try
to transpile all files in the directories
specified in tsconfig.json, regardless if the
file will actually be used for the platform or
not.
[1] https://linear.app/mullvad/issue/DES-1588/switch-to-other-build-system#comment-3546e3b9
| -rw-r--r-- | desktop/packages/nseventforwarder/package.json | 6 | ||||
| -rw-r--r-- | desktop/packages/win-shortcuts/package.json | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/desktop/packages/nseventforwarder/package.json b/desktop/packages/nseventforwarder/package.json index a85821c7ad..bc99c152c3 100644 --- a/desktop/packages/nseventforwarder/package.json +++ b/desktop/packages/nseventforwarder/package.json @@ -6,13 +6,15 @@ "description": "", "main": "./lib/index.cjs", "scripts": { - "cargo-build": "tsc && cargo build", + "cargo-build": "npm run build-typescript && cargo build", + "build-typescript": "tsc", "build-debug": "npm run cargo-build && mkdir -p debug && cp ${CARGO_TARGET_DIR:-../../../target}/debug/libnseventforwarder.dylib debug/index.node", "build-arm": "npm run cargo-build -- --release --locked --target aarch64-apple-darwin && mkdir -p dist/darwin-arm64 && cp ${CARGO_TARGET_DIR:-../../../target}/aarch64-apple-darwin/release/libnseventforwarder.dylib dist/darwin-arm64/index.node", "build-x86": "npm run cargo-build -- --release --locked --target x86_64-apple-darwin && mkdir -p dist/darwin-x64 && cp ${CARGO_TARGET_DIR:-../../../target}/x86_64-apple-darwin/release/libnseventforwarder.dylib dist/darwin-x64/index.node", "clean": "rm -rf debug; rm -rf dist", "lint": "eslint .", - "lint-fix": "eslint --fix ." + "lint-fix": "eslint --fix .", + "postinstall": "npm run build-typescript" }, "exports": { ".": { diff --git a/desktop/packages/win-shortcuts/package.json b/desktop/packages/win-shortcuts/package.json index 245c9ef179..d549adcc89 100644 --- a/desktop/packages/win-shortcuts/package.json +++ b/desktop/packages/win-shortcuts/package.json @@ -6,13 +6,15 @@ "description": "", "main": "./lib/index.cjs", "scripts": { - "cargo-build": "tsc && cargo build", + "cargo-build": "npm run build-typescript && cargo build", "build-debug": "npm run cargo-build && (test -d debug || mkdir debug) && cp ../../../target/debug/win_shortcuts.dll debug/index.node", "build-arm": "npm run cargo-build -- --release --target aarch64-pc-windows-msvc && (test -d dist || mkdir dist) && (test -d dist/win32-arm64-msvc || mkdir \"dist/win32-arm64-msvc\") && cp ../../../target/aarch64-pc-windows-msvc/release/win_shortcuts.dll dist/win32-arm64-msvc/index.node", + "build-typescript": "tsc", "build-x86": "npm run cargo-build -- --release --target x86_64-pc-windows-msvc && (test -d dist || mkdir dist) && (test -d dist/win32-x64-msvc || mkdir \"dist/win32-x64-msvc\") && cp ../../../target/x86_64-pc-windows-msvc/release/win_shortcuts.dll dist/win32-x64-msvc/index.node", "clean": "rm -rf debug; rm -rf dist", "lint": "eslint .", - "lint-fix": "eslint --fix ." + "lint-fix": "eslint --fix .", + "postinstall": "npm run build-typescript" }, "exports": { ".": { |
