Skip to content

Commit

Permalink
node: Remove "install" script that invokes node-gyp-build
Browse files Browse the repository at this point in the history
- For local development, this built the Rust library automatically
  when you invoked `yarn install`, whether you wanted it to or not.

- For the published package, this either did nothing (if the correct
  prebuilds were present) or produced a weird error (if they weren't).
  You can't use the published package without prebuilds, so maybe this
  was useful, but you'd find that out pretty quickly when loading the
  module failed.

- If you used the "link" feature to build Signal Desktop with a local
  checkout of libsignal, this would build the Rust library
  automatically when you `install`ed in the *Desktop* directory,
  whether you wanted it to or not.

- If you pointed Signal Desktop at a local checkout by copy instead of
  link, this would just fail, because the Rust parts wouldn't be
  copied with it.

Overall, it's simpler to just have this step be explicit.
  • Loading branch information
jrose-signal committed Jul 10, 2024
1 parent 773530e commit 36c6eeb
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ jobs:
- run: yarn install --frozen-lockfile
working-directory: node

- run: yarn node-gyp rebuild
working-directory: node

- run: yarn tsc
working-directory: node

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
with:
node-version-file: '.nvmrc'

- run: npx yarn install --ignore-scripts --frozen-lockfile
- run: npx yarn install --frozen-lockfile
working-directory: node

- name: Build for arm64
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/slow_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ jobs:
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'
- run: npx yarn install --ignore-scripts --frozen-lockfile
- run: npx yarn install --frozen-lockfile
working-directory: node
- name: Build for arm64
run: npx prebuildify --napi -t ${{ steps.get-nvm-version.outputs.node-version }} --arch arm64
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,13 @@ To learn about the Swift build process see [``swift/README.md``](swift/)
You'll need Node installed to build. If you have [nvm][], you can run `nvm use` to select an
appropriate version automatically.

We use [`yarn`](https://classic.yarnpkg.com/) as our package manager. The Rust library will automatically be built when you run `yarn install`.
We use [`yarn`](https://classic.yarnpkg.com/) as our package manager, and `node-gyp` to control building the Rust library.

```shell
$ cd node
$ nvm use
$ yarn install
$ yarn node-gyp rebuild # clean->configure->build
$ yarn tsc
$ yarn test
```
Expand Down
2 changes: 1 addition & 1 deletion node/docker-prebuildify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ docker build --build-arg "UID=${UID:-501}" --build-arg "GID=${GID:-501}" --build
# We run `yarn install` to make sure the correct prebuildify version is used.
docker run ${IS_TTY:+ -it} --init --rm -v "${PWD}":/home/libsignal/src ${DOCKER_IMAGE} sh -c '
cd ~/src/node &&
npx yarn install --ignore-scripts --frozen-lockfile &&
npx yarn install --frozen-lockfile &&
env CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
CC=aarch64-linux-gnu-gcc \
CXX=aarch64-linux-gnu-g++ \
Expand Down
1 change: 0 additions & 1 deletion node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"prebuilds/*/*.node"
],
"scripts": {
"install": "node-gyp-build",
"build": "node-gyp build",
"build-with-debug-level-logs": "npx --libsignal-debug-level-logs node-gyp build",
"tsc": "tsc -b",
Expand Down

0 comments on commit 36c6eeb

Please sign in to comment.