Skip to content

Commit

Permalink
chore(binding/nodejs,website): Replace yarn with pnpm (apache#3730)
Browse files Browse the repository at this point in the history
chore(bindings/nodejs,website): replace yarn with pnpm

Signed-off-by: suyanhanx <[email protected]>
  • Loading branch information
suyanhanx authored Dec 9, 2023
1 parent b57d590 commit b0f9869
Show file tree
Hide file tree
Showing 22 changed files with 11,074 additions and 14,725 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/post_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sudo apt install -y python3-dev python3-pip python3-venv
# Setup for nodejs binding
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt-get install -y nodejs
sudo corepack enable
corepack prepare yarn@stable --activate
corepack prepare pnpm@stable --activate

# Setup for java binding
sudo apt install -y default-jdk
Expand Down Expand Up @@ -68,4 +68,4 @@ opam init --auto-setup --yes --disable-sandboxing # container can't use sandboxi
opam install -y dune ounit2 ocamlformat

# Setup for Cpp binding
sudo apt install -y ninja-build
sudo apt install -y ninja-build
4 changes: 2 additions & 2 deletions .github/actions/behavior_test_binding_nodejs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ runs:
shell: bash
working-directory: bindings/nodejs
run: |
yarn build:debug
yarn test
pnpm build:debug
pnpm test
env:
NAPI_FEATURES: ${{ inputs.feature }}
OPENDAL_TEST: ${{ inputs.service }}
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/behavior_test_binding_nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,23 @@ jobs:
connect-host: ${{ secrets.OP_CONNECT_HOST }}
connect-token: ${{ secrets.OP_CONNECT_TOKEN }}

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
env:
SKIP_YARN_COREPACK_CHECK: true
cache: pnpm
cache-dependency-path: "bindings/nodejs/pnpm-lock.yaml"

- name: Corepack
working-directory: bindings/nodejs
run: corepack enable

- name: Install dependencies
working-directory: bindings/nodejs
run: yarn install --immutable
run: pnpm install --frozen-lockfile

- name: Test Core
uses: ./.github/actions/behavior_test_binding_nodejs
Expand Down
78 changes: 43 additions & 35 deletions .github/workflows/bindings_nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,28 @@ jobs:
- name: Setup Rust toolchain
uses: ./.github/actions/setup

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
env:
SKIP_YARN_COREPACK_CHECK: true
cache: pnpm
cache-dependency-path: "bindings/nodejs/pnpm-lock.yaml"

- name: Corepack
run: corepack enable

- name: Install dependencies
run: yarn install --immutable
run: pnpm install --frozen-lockfile

- name: Check format
run: yarn run prettier --check .
run: pnpm exec prettier --check .

- name: Build
run: yarn build
run: pnpm build

- name: Check diff
run: git diff --exit-code
Expand All @@ -89,7 +91,7 @@ jobs:
-e NAPI_TARGET=x86_64-unknown-linux-gnu \
-w /build/bindings/nodejs \
ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian \
bash -c "yarn build"
bash -c "pnpm build"
cd bindings/nodejs
# change owner to current user
sudo chown -R 1001:121 *.node
Expand All @@ -102,7 +104,7 @@ jobs:
ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 \
bash -c "set -e &&
rustup target add aarch64-unknown-linux-gnu &&
yarn build --target aarch64-unknown-linux-gnu &&
pnpm build --target aarch64-unknown-linux-gnu &&
aarch64-unknown-linux-gnu-strip *.node"
cd bindings/nodejs
# change owner to current user
Expand All @@ -116,7 +118,7 @@ jobs:
ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine \
bash -c "set -e &&
rustup target add aarch64-unknown-linux-musl &&
yarn build --target aarch64-unknown-linux-musl &&
pnpm build --target aarch64-unknown-linux-musl &&
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node"
cd bindings/nodejs
# change owner to current user
Expand All @@ -131,18 +133,19 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
env:
SKIP_YARN_COREPACK_CHECK: true
cache: pnpm
cache-dependency-path: "bindings/nodejs/pnpm-lock.yaml"
- name: Corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
run: pnpm install --frozen-lockfile
- name: Build
shell: bash
working-directory: .
Expand All @@ -159,11 +162,11 @@ jobs:
matrix:
settings:
- target: x86_64-pc-windows-msvc
build: yarn build
build: pnpm build
- target: aarch64-pc-windows-msvc
build: |
rustup target add aarch64-pc-windows-msvc;
NAPI_TARGET=aarch64-pc-windows-msvc yarn build
NAPI_TARGET=aarch64-pc-windows-msvc pnpm build
# Notes: this defaults only apply on run tasks.
defaults:
Expand All @@ -174,18 +177,19 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
env:
SKIP_YARN_COREPACK_CHECK: true
cache: pnpm
cache-dependency-path: "bindings/nodejs/pnpm-lock.yaml"
- name: Corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
run: pnpm install --frozen-lockfile
- name: Build
shell: bash
run: ${{ matrix.settings.build }}
Expand All @@ -202,7 +206,7 @@ jobs:
settings:
- target: x86_64-apple-darwin
build: |
yarn build
pnpm build
strip -x *.node
- target: aarch64-apple-darwin
build: |
Expand All @@ -214,7 +218,7 @@ jobs:
rustup target add aarch64-apple-darwin;
export NAPI_TARGET=aarch64-apple-darwin;
yarn build
pnpm build
strip -x *.node
# Notes: this defaults only apply on run tasks.
Expand All @@ -226,18 +230,19 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
env:
SKIP_YARN_COREPACK_CHECK: true
cache: pnpm
cache-dependency-path: "bindings/nodejs/pnpm-lock.yaml"
- name: Corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
run: pnpm install --frozen-lockfile
- name: Build
run: ${{ matrix.settings.build }}
shell: bash
Expand All @@ -260,23 +265,26 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Corepack
run: corepack enable
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: "18"
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
cache: pnpm
cache-dependency-path: "bindings/nodejs/pnpm-lock.yaml"
- name: Corepack
run: corepack enable
- name: Install dependencies
run: yarn install --immutable
run: pnpm install --frozen-lockfile

- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: bindings/nodejs/artifacts
- name: Move artifacts
run: yarn run napi artifacts
run: pnpm exec napi artifacts

- name: List packages
run: ls -R ./npm
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,26 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: "bindings/nodejs/yarn.lock"
env:
SKIP_YARN_COREPACK_CHECK: true
cache: pnpm
cache-dependency-path: "bindings/nodejs/pnpm-lock.yaml"
- name: Corepack
working-directory: bindings/nodejs
run: corepack enable

- name: Install dependencies
working-directory: bindings/nodejs
run: yarn install --immutable
run: pnpm install --frozen-lockfile

- name: Build bindings/nodejs Docs
working-directory: bindings/nodejs
run: yarn docs
run: pnpm run docs

- name: Upload docs
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -294,13 +296,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: "website/yarn.lock"
env:
SKIP_YARN_COREPACK_CHECK: true
cache: pnpm
cache-dependency-path: "website/pnpm-lock.yaml"

- name: Corepack
working-directory: website
Expand Down Expand Up @@ -362,11 +366,11 @@ jobs:

- name: Install Dependencies
working-directory: website
run: yarn install --immutable
run: pnpm install --frozen-lockfile

- name: Build
working-directory: website
run: yarn build
run: pnpm build

- name: Copy asf file
run: cp .asf.yaml ./website/build/.asf.yaml
Expand Down
2 changes: 2 additions & 0 deletions bindings/nodejs/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.npmrc
target
Cargo.lock
.cargo
Expand All @@ -7,6 +8,7 @@ npm
.prettierignore
rustfmt.toml
yarn.lock
pnpm-lock.yaml
*.node
.yarn
__test__
Expand Down
1 change: 1 addition & 0 deletions bindings/nodejs/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shell-emulator=true
1 change: 1 addition & 0 deletions bindings/nodejs/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ target
generated.js
generated.d.ts
.yarn
pnpm-lock.yaml
18 changes: 0 additions & 18 deletions bindings/nodejs/.yarnrc.yml

This file was deleted.

Loading

0 comments on commit b0f9869

Please sign in to comment.