Skip to content

Commit 8e68f80

Browse files
committed
Move to pnpm
1 parent e7f857c commit 8e68f80

18 files changed

Lines changed: 144 additions & 21174 deletions

File tree

.github/actions/setup-npm-demos-npm/action.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/actions/setup-npm-demos-react/action.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/actions/setup-npm/action.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Setup demo pnpm"
2+
description: "A composite action to setup pnpm for npm demo"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Get Node.js version
8+
id: get-node-version
9+
shell: bash
10+
run: echo "node_version=$(grep node .tool-versions | cut -d' ' -f2)" >> $GITHUB_OUTPUT
11+
- name: Setup Node
12+
uses: actions/setup-node@v4
13+
with:
14+
node-version: ${{ steps.get-node-version.outputs.node_version }}
15+
- name: Install pnpm
16+
uses: pnpm/action-setup@v4
17+
with:
18+
version: 9
19+
- name: Get pnpm store directory
20+
id: pnpm-cache
21+
shell: bash
22+
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
23+
- name: Setup pnpm cache
24+
uses: actions/cache@v4
25+
with:
26+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
27+
key: ${{ runner.os }}-pnpm-store-npm-demo-${{ hashFiles('demos/npm/pnpm-lock.yaml') }}
28+
restore-keys: ${{ runner.os }}-pnpm-store-
29+
- name: Install dependencies
30+
shell: bash
31+
run: pnpm --prefix demos/npm install --frozen-lockfile
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Setup react demo pnpm"
2+
description: "A composite action to setup pnpm for react demo"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Get Node.js version
8+
id: get-node-version
9+
shell: bash
10+
run: echo "node_version=$(grep node .tool-versions | cut -d' ' -f2)" >> $GITHUB_OUTPUT
11+
- name: Setup Node
12+
uses: actions/setup-node@v4
13+
with:
14+
node-version: ${{ steps.get-node-version.outputs.node_version }}
15+
- name: Install pnpm
16+
uses: pnpm/action-setup@v4
17+
with:
18+
version: 9
19+
- name: Get pnpm store directory
20+
id: pnpm-cache
21+
shell: bash
22+
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
23+
- name: Setup pnpm cache
24+
uses: actions/cache@v4
25+
with:
26+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
27+
key: ${{ runner.os }}-pnpm-store-react-demo-${{ hashFiles('demos/react/pnpm-lock.yaml') }}
28+
restore-keys: ${{ runner.os }}-pnpm-store-
29+
- name: Install dependencies
30+
shell: bash
31+
run: pnpm --prefix demos/react install --frozen-lockfile
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Setup pnpm"
2+
description: "A composite action to setup pnpm"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Get Node.js version
8+
id: get-node-version
9+
shell: bash
10+
run: echo "node_version=$(grep node .tool-versions | cut -d' ' -f2)" >> $GITHUB_OUTPUT
11+
- name: Setup Node
12+
uses: actions/setup-node@v4
13+
with:
14+
node-version: ${{ steps.get-node-version.outputs.node_version }}
15+
- name: Install pnpm
16+
uses: pnpm/action-setup@v4
17+
with:
18+
version: 9
19+
- name: Get pnpm store directory
20+
id: pnpm-cache
21+
shell: bash
22+
run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
23+
- name: Setup pnpm cache
24+
uses: actions/cache@v4
25+
with:
26+
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
27+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
28+
restore-keys: ${{ runner.os }}-pnpm-store-
29+
- name: Install dependencies
30+
shell: bash
31+
run: pnpm install --frozen-lockfile

.github/workflows/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,18 @@ jobs:
7777
- name: Patch version
7878
run: ./scripts/patch-version.sh "${{ github.ref_name }}"
7979

80+
- name: Install pnpm
81+
uses: pnpm/action-setup@v4
82+
with:
83+
version: 9
84+
8085
- name: Setup registry access
8186
run: |
8287
echo '@optable:registry=https://registry.npmjs.org/' > ~/.npmrc
8388
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_CI_ACCESS_TOKEN }}" >> ~/.npmrc
8489
8590
- name: Publish to NPM
86-
run: npm publish --access public
91+
run: pnpm publish --access public --no-git-checks
8792

8893
deploy-sdk-to-gcs:
8994
needs: [deploy-sdk-to-npm, define-gcs-versions-to-update]

.github/workflows/reusable-build.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ jobs:
1919
- name: Checkout code
2020
uses: actions/checkout@v4
2121

22-
- name: Setup npm
23-
uses: ./.github/actions/setup-npm
22+
- name: Setup pnpm
23+
uses: ./.github/actions/setup-pnpm
2424

2525
- name: Patch build.json version
2626
run: ./scripts/patch-version.sh "${{ inputs.version }}"
2727

2828
- name: Build web production
29-
run: npm run build-web -- --mode=production
29+
run: pnpm build-web -- --mode=production
3030

3131
- name: Upload artifacts
3232
uses: actions/upload-artifact@v4
@@ -41,14 +41,14 @@ jobs:
4141
- name: Checkout code
4242
uses: actions/checkout@v4
4343

44-
- name: Setup npm
45-
uses: ./.github/actions/setup-npm
44+
- name: Setup pnpm
45+
uses: ./.github/actions/setup-pnpm
4646

4747
- name: Patch build.json version
4848
run: ./scripts/patch-version.sh "${{ inputs.version }}"
4949

5050
- name: Transpile lib
51-
run: npm run build-lib
51+
run: pnpm build-lib
5252

5353
- name: Upload artifacts
5454
uses: actions/upload-artifact@v4
@@ -99,14 +99,14 @@ jobs:
9999
path: lib/dist
100100

101101
# SDK has a dependency on third-party js-sha256, we need to install node_modules in the root directory
102-
- name: Setup npm
103-
uses: ./.github/actions/setup-npm
102+
- name: Setup pnpm
103+
uses: ./.github/actions/setup-pnpm
104104

105-
- name: Setup npm react demo
106-
uses: ./.github/actions/setup-npm-demos-react
105+
- name: Setup pnpm react demo
106+
uses: ./.github/actions/setup-pnpm-demos-react
107107

108108
- name: Build react demo
109-
run: npm run build
109+
run: pnpm run build
110110

111111
- name: Upload artifacts
112112
uses: actions/upload-artifact@v4
@@ -124,11 +124,11 @@ jobs:
124124
- name: Checkout code
125125
uses: actions/checkout@v4
126126

127-
- name: Setup npm demos npm
128-
uses: ./.github/actions/setup-npm-demos-npm
127+
- name: Setup pnpm demos npm
128+
uses: ./.github/actions/setup-pnpm-demos-npm
129129

130130
- name: Build npm-demo
131-
run: npm run build
131+
run: pnpm run build
132132

133133
- name: Upload artifacts
134134
uses: actions/upload-artifact@v4

.github/workflows/reusable-lint-test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ jobs:
88
- name: Checkout code
99
uses: actions/checkout@v4
1010

11-
- name: Setup npm
12-
uses: ./.github/actions/setup-npm
11+
- name: Setup pnpm
12+
uses: ./.github/actions/setup-pnpm
1313

1414
- name: Test
15-
run: npm run test
15+
run: pnpm test
1616

1717
prettier:
1818
runs-on: ubuntu-22.04
1919
steps:
2020
- name: Checkout code
2121
uses: actions/checkout@v4
2222

23-
- name: Setup npm
24-
uses: ./.github/actions/setup-npm
23+
- name: Setup pnpm
24+
uses: ./.github/actions/setup-pnpm
2525

2626
- name: Run prettier
27-
run: npm run format
27+
run: pnpm format
2828

2929
- name: Check if prettier changed files
3030
run: git diff --exit-code || (echo "ESLint fixed some files. Please commit the changes." && exit 1)

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ demos/**/*.html
99
!demos/react/src/index.html
1010
!demos/index-nocookies.html
1111
!demos/index.html
12+
13+
# pnpm
14+
pnpm-lock.yaml
15+
.pnpm-debug.log

0 commit comments

Comments
 (0)