diff --git a/.npmignore b/.npmignore index c7459bd..b182fcb 100644 --- a/.npmignore +++ b/.npmignore @@ -1,9 +1,5 @@ -src/ tests/ target/ -Cargo.lock -Cargo.toml -build.rs *.node *.tgz tsconfig.json diff --git a/package.json b/package.json index 106867d..f5baba8 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ }, "license": "Apache-2.0", "devDependencies": { - "@napi-rs/cli": "^2.18.0", "jest": "^28.1.0", "prettier": "^2.8.3", "typedoc": "^0.22.17", @@ -24,13 +23,14 @@ }, "scripts": { "lint": "prettier --check .", - "release-build": "napi build --platform --release --strip", + "release-build": "napi build --platform --release --strip --cargo-flags=--locked", "build": "napi build --platform", - "postinstall": "node download-lib.js", + "postinstall": "node postinstall.js", "test": "jest --verbose --testTimeout 10000", "doc": "typedoc --tsconfig ." }, "dependencies": { + "@napi-rs/cli": "^2.18.0", "https-proxy-agent": "^5.0.1", "node-downloader-helper": "^2.1.5" } diff --git a/postinstall.js b/postinstall.js new file mode 100644 index 0000000..f06926d --- /dev/null +++ b/postinstall.js @@ -0,0 +1,6 @@ +if (process.env.npm_config_build_from_source) { + console.log('building @matrix-org/matrix-sdk-crypto-nodejs from source'); + require('child_process').spawnSync(process.env.npm_execpath || 'npm', ['run', 'release-build']); +} else { + require('./download-lib.js'); +}