Skip to content

Commit 524fcf2

Browse files
Copilotabernier
andauthored
Switch from npm to pnpm (#451)
* Initial plan * Switch from npm to pnpm Co-authored-by: abernier <76580+abernier@users.noreply.github.com> * Fix pnpm version and setup order in CI workflow Co-authored-by: abernier <76580+abernier@users.noreply.github.com> * Update to latest pnpm version (10.28.1) and remove explicit version from CI Co-authored-by: abernier <76580+abernier@users.noreply.github.com> * Use corepack instead of npm install -g for pnpm installation Co-authored-by: abernier <76580+abernier@users.noreply.github.com> * Revert from pnpm dlx back to npx Co-authored-by: abernier <76580+abernier@users.noreply.github.com> * Simplify corepack prepare command to read version from package.json Co-authored-by: abernier <76580+abernier@users.noreply.github.com> * Fix Dockerfile: copy package.json before corepack prepare Co-authored-by: abernier <76580+abernier@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
1 parent fa43cf8 commit 524fcf2

File tree

12 files changed

+11767
-14274
lines changed

12 files changed

+11767
-14274
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ updates:
99
directory: '/' # Location of package manifests
1010
schedule:
1111
interval: 'weekly'
12-
- package-ecosystem: "github-actions"
13-
directory: "/"
12+
- package-ecosystem: 'github-actions'
13+
directory: '/'
1414
schedule:
15-
interval: "weekly"
15+
interval: 'weekly'

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
-e THEME_WARNING \
108108
-e THEME_CAUTION \
109109
-e CONTRIBUTORS_PAT \
110-
ghcr.io/pmndrs/docs:${{ inputs.docker_tag }} npm run build
110+
ghcr.io/pmndrs/docs:${{ inputs.docker_tag }} pnpm run build
111111
env:
112112
BASE_PATH: ${{ steps.set-base-path.outputs.BASE_PATH }}
113113
MDX: ${{ inputs.mdx }}

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,23 @@ jobs:
5050
with:
5151
fetch-depth: 0
5252

53+
- name: Setup pnpm
54+
uses: pnpm/action-setup@v4
55+
5356
- name: Setup Node.js
5457
uses: actions/setup-node@v6
5558
with:
5659
node-version-file: '.nvmrc'
57-
cache: 'npm'
60+
cache: 'pnpm'
5861

5962
- name: Install dependencies
60-
run: npm ci
63+
run: pnpm install --frozen-lockfile
6164

6265
- name: Create Release Pull Request or Publish
6366
id: changesets
6467
uses: changesets/action@v1
6568
with:
66-
publish: npm run release
69+
publish: pnpm run release
6770
createGithubReleases: true
6871
env:
6972
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
.pnp.js
77
node_modules/
88

9+
# pnpm
10+
.pnpm-debug.log*
11+
912
# other
1013
.next/
1114
.DS_Store

.husky/pre-commit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
echo "🪝 .husky/pre-commit hook is running"
22

3-
npx tsc --noEmit
4-
npx lint-staged
3+
pnpm exec tsc --noEmit
4+
pnpm exec lint-staged

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
FROM node:24-alpine
22

33
RUN apk add --no-cache libc6-compat git && apk update
4+
45
WORKDIR /app
56

6-
COPY package.json package-lock.json ./
7-
RUN npm ci
7+
# Copy package.json first so corepack can read the packageManager field
8+
COPY package.json pnpm-lock.yaml ./
9+
10+
# Enable corepack and prepare pnpm (reads version from package.json)
11+
RUN corepack enable && corepack prepare --activate
12+
13+
RUN pnpm install --frozen-lockfile
814

915
COPY . .

docs/getting-started/introduction.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Pre-requisites:
2828
```sh
2929
$ git clone https://github.com/pmndrs/docs.git
3030
$ cd docs
31-
$ npm ci
31+
$ pnpm install
3232
```
3333

3434
## Configuration
@@ -136,7 +136,7 @@ $ (
136136

137137
kill $(lsof -ti:"$_PORT")
138138
npx serve $MDX -p $_PORT --no-port-switching --no-clipboard &
139-
npm run dev &
139+
pnpm run dev &
140140

141141
wait
142142
)
@@ -184,7 +184,7 @@ $ (
184184
export THEME_CAUTION="#da3633"
185185
export CONTRIBUTORS_PAT=
186186

187-
npm run build
187+
pnpm run build
188188

189189
kill $(lsof -ti:"$_PORT")
190190
npx serve $MDX -p $_PORT --no-port-switching --no-clipboard &
@@ -265,7 +265,7 @@ $ (
265265
-e THEME_WARNING \
266266
-e THEME_CAUTION \
267267
-e CONTRIBUTORS_PAT \
268-
pmndrs-docs npm run build
268+
pmndrs-docs pnpm run build
269269

270270
kill $(lsof -ti:"$_PORT")
271271
npx serve $MDX -p $_PORT --no-port-switching --no-clipboard &

0 commit comments

Comments
 (0)