Migrate from yarn to npm

This commit is contained in:
Jordan Rose
2024-10-31 16:34:44 -07:00
parent ee773bbde8
commit f9c2694dcb
9 changed files with 5217 additions and 2930 deletions

View File

@@ -336,24 +336,24 @@ jobs:
run: rust/bridge/node/bin/gen_ts_decl.py --verify
if: matrix.os == 'ubuntu-latest'
- run: yarn install --frozen-lockfile
- run: npm ci
working-directory: node
- run: yarn node-gyp rebuild
- run: npx node-gyp rebuild
working-directory: node
- run: yarn tsc
- run: npm run tsc
working-directory: node
- run: yarn lint
- run: npm run lint
if: matrix.os == 'ubuntu-latest'
working-directory: node
- run: yarn format -c
- run: npm run format -c
if: matrix.os == 'ubuntu-latest'
working-directory: node
- run: yarn test
- run: npm run test
working-directory: node
swift_package:

View File

@@ -78,7 +78,7 @@ jobs:
with:
node-version-file: '.nvmrc'
- run: npx yarn install --frozen-lockfile
- run: npm ci
working-directory: node
- name: Build for arm64
@@ -196,19 +196,19 @@ jobs:
path: debuginfo
merge-multiple: true
- run: yarn install --frozen-lockfile
- run: npm ci
working-directory: node
- run: yarn tsc
- run: npm run tsc
working-directory: node
- run: yarn lint
- run: npm run lint
working-directory: node
- run: yarn format -c
- run: npm run format -c
working-directory: node
- run: yarn test
- run: npm run test
working-directory: node
env:
PREBUILDS_ONLY: 1

View File

@@ -219,7 +219,7 @@ jobs:
with:
submodules: recursive
- run: node/docker-prebuildify.sh
- run: yarn tsc && yarn test
- run: npm run tsc && npm run test
working-directory: node
env:
PREBUILDS_ONLY: 1
@@ -250,7 +250,7 @@ jobs:
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'
- run: npx yarn install --frozen-lockfile
- run: npm ci
working-directory: node
- name: Build for arm64
run: npx prebuildify --napi -t ${{ steps.get-nvm-version.outputs.node-version }} --arch arm64

View File

@@ -162,18 +162,18 @@ 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, and `node-gyp` to control building the Rust library.
We use `npm` 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
$ npm install
$ npx node-gyp rebuild # clean->configure->build
$ npm run tsc
$ npm run test
```
When testing changes locally, you can use `yarn build` to do an incremental rebuild of the Rust library. Alternately, `yarn build-with-debug-level-logs` will rebuild without filtering out debug- and verbose-level logs.
When testing changes locally, you can use `npm run build` to do an incremental rebuild of the Rust library. Alternately, `npm run build-with-debug-level-logs` will rebuild without filtering out debug- and verbose-level logs.
When exposing new APIs to Node, you will need to run `rust/bridge/node/bin/gen_ts_decl.py` in
addition to rebuilding.

View File

@@ -8,7 +8,7 @@ For the most part, libsignal is tested using each language's usual testing infra
% ./gradlew client:test server:test android:connectedAndroidTest
# Node
% yarn build && yarn tsc && yarn test
% npm run build && npm run tsc && npm run test
# Swift
% ./build_ffi.sh --generate-ffi && swift test

View File

@@ -18,7 +18,7 @@ format-all:
cargo fmt
taplo fmt
(cd swift && swiftformat --swiftversion 5 .)
(cd node && yarn format)
(cd node && npm run format)
(cd java && ./gradlew spotlessApply)
# Same as format-all, but does not actually make changes; merely fails if code is not yet formatted.
@@ -26,13 +26,13 @@ check-format-all:
cargo fmt --all -- --check
taplo fmt --check
(cd swift && swiftformat --swiftversion 5 . --lint)
(cd node && yarn format-check)
(cd node && npm run format-check)
(cd java && ./gradlew spotlessCheck)
# Runs some quick local checks; useful to make sure CI will not fail immediately after push.
check-pre-commit:
just check-format-all
(cd node && yarn lint)
(cd node && npm run lint)
(cd swift && ./verify_error_codes.sh)
(cd swift && swiftlint lint --strict)
cargo test --workspace --all-features --verbose --no-fail-fast -- --include-ignored

View File

@@ -22,10 +22,10 @@ docker build --build-arg "UID=${UID:-501}" --build-arg "GID=${GID:-501}" --build
# We build both architectures in the same run action to save on intermediates
# (including downloading dependencies)
# We run `yarn install` to make sure the correct prebuildify version is used.
# We run `npm ci` 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 --frozen-lockfile &&
npm ci &&
env CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
CC=aarch64-linux-gnu-gcc \
CXX=aarch64-linux-gnu-g++ \

5191
node/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff