Skip to content

Commit 1e64b78

Browse files
committed
Replace npm with pnpm
This commits migrates the project from npm to pnpm to take advantage of the improved performance and enhanced dependency management. pnpm offers faster installation times through its use of hard links and a global content-addressable store, which eliminates duplicate downloads and provides substantial disk space savings by sharing dependencies across projects. The migration also improves dependency reliability by preventing phantom dependencies through stricter dependency resolution, while maintaining full compatibility with existing npm workflows and the `package.json` format.
1 parent cdbc509 commit 1e64b78

File tree

10 files changed

+3127
-4811
lines changed

10 files changed

+3127
-4811
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99

1010
permissions: {}
1111

12+
env:
13+
# renovate: datasource=npm depName=pnpm
14+
PNPM_VERSION: 10.12.4
15+
1216
jobs:
1317
test:
1418
name: Test
@@ -19,12 +23,17 @@ jobs:
1923
with:
2024
persist-credentials: false
2125

26+
- name: Install pnpm
27+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
28+
with:
29+
version: ${{ env.PNPM_VERSION }}
30+
2231
- name: Install node dependencies
23-
run: npm ci
32+
run: pnpm install --frozen-lockfile
2433

2534
- name: Test
2635
run: |
27-
npm run test
36+
pnpm test
2837
2938
lint:
3039
name: Lint
@@ -35,12 +44,17 @@ jobs:
3544
with:
3645
persist-credentials: false
3746

47+
- name: Install pnpm
48+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
49+
with:
50+
version: ${{ env.PNPM_VERSION }}
51+
3852
- name: Install node dependencies
39-
run: npm ci
53+
run: pnpm install --frozen-lockfile
4054

4155
- name: Lint
4256
run: |
43-
npm run lint
57+
pnpm lint
4458
4559
format:
4660
name: Format
@@ -51,11 +65,16 @@ jobs:
5165
with:
5266
persist-credentials: false
5367

68+
- name: Install pnpm
69+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
70+
with:
71+
version: ${{ env.PNPM_VERSION }}
72+
5473
- name: Install Prettier
55-
run: npm ci
74+
run: pnpm install --frozen-lockfile
5675

5776
- name: Format
58-
run: npx prettier --check .
77+
run: pnpm prettier --check .
5978

6079
zizmor:
6180
name: Zizmor
@@ -99,16 +118,21 @@ jobs:
99118
with:
100119
persist-credentials: false
101120

121+
- name: Install pnpm
122+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
123+
with:
124+
version: ${{ env.PNPM_VERSION }}
125+
102126
- name: Install node dependencies
103-
run: npm ci
127+
run: pnpm install --frozen-lockfile
104128

105129
- name: Check is packaged
106130
run: |
107131
# Compile to single js files.
108-
npm run package
132+
pnpm package
109133
110134
# Assert that the git diff is empty.
111-
git diff --exit-code || (echo "Git diff is not empty. Please run 'npm run package' and commit the changes." && exit 1)
135+
git diff --exit-code || (echo "Git diff is not empty. Please run 'pnpm package' and commit the changes." && exit 1)
112136
113137
# This job tests the action directly by running it against a mock server.
114138
action-test:

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Ignore artifacts:
22
dist
3+
pnpm-lock.yaml

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ You can't run this action locally as it requires a GitHub environment.
1818
To install node dependencies, run:
1919

2020
```sh
21-
npm install
21+
pnpm install
2222
```
2323

2424
### Packaging
@@ -29,7 +29,7 @@ compile the TypeScript code and its dependencies into a single file
2929
in the `dist/` directory:
3030

3131
```sh
32-
npm run package
32+
pnpm package
3333
```
3434

3535
This approach is inspired by the [typescript-action](https://github.com/actions/typescript-action)
@@ -62,7 +62,7 @@ We use [Prettier](https://prettier.io/) to format TypeScript, Markdown, and YAML
6262
To format all files, run:
6363

6464
```sh
65-
npx prettier --write .
65+
pnpm prettier --write .
6666
```
6767

6868
### Linting
@@ -72,7 +72,7 @@ We use [ESLint](https://eslint.org/) for linting TypeScript files.
7272
To check for linting errors, run:
7373

7474
```sh
75-
npx eslint
75+
pnpm eslint
7676
```
7777

7878
### Testing
@@ -86,7 +86,7 @@ There are two types of tests running in [ci.yml](.github/workflows/ci.yml):
8686
To run these tests locally, run:
8787

8888
```sh
89-
npm run test
89+
pnpm test
9090
```
9191

9292
## Crates.io Documentation

0 commit comments

Comments
 (0)