Skip to content

Commit 2d771b4

Browse files
authored
Merge pull request #177 from SableClient/chore/migrate-to-pnpm
chore: migrate package manager from npm to pnpm
2 parents a24dd7c + e037a40 commit 2d771b4

21 files changed

Lines changed: 10892 additions & 24895 deletions

.github/actions/setup/action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,27 @@ inputs:
55
install-command:
66
description: Command used to install dependencies.
77
required: false
8-
default: npm ci
8+
default: pnpm install --frozen-lockfile --ignore-scripts
99
build:
1010
description: Whether to build the app after installing dependencies.
1111
required: false
1212
default: 'false'
1313
build-command:
1414
description: Command used when build is enabled.
1515
required: false
16-
default: npm run build
16+
default: pnpm run build
1717

1818
runs:
1919
using: composite
2020
steps:
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
23+
2124
- name: Setup node
2225
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
2326
with:
2427
node-version-file: '.node-version'
25-
cache: 'npm'
28+
cache: 'pnpm'
2629

2730
- name: Install dependencies
2831
shell: bash

.github/workflows/cloudflare-web-preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
echo "preview_url=${preview_url}" >> "$GITHUB_OUTPUT"
111111
112112
- name: Publish summary and PR comment
113-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
113+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
114114
env:
115115
MARKER: '<!-- cloudflare-worker-preview -->'
116116
PREVIEW_URL: ${{ steps.preview.outputs.preview_url }}

.github/workflows/docker-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ jobs:
6969
- name: Setup app
7070
uses: ./.github/actions/setup
7171
with:
72-
install-command: npm ci --ignore-scripts
72+
install-command: pnpm install --frozen-lockfile --ignore-scripts
7373

7474
- name: Build site
7575
env:
7676
VITE_BUILD_HASH: ${{ steps.vars.outputs.short_sha }}
7777
VITE_IS_RELEASE_TAG: ${{ steps.release_tag.outputs.is_release }}
7878
run: |
79-
NODE_OPTIONS=--max_old_space_size=4096 npm run build
79+
NODE_OPTIONS=--max_old_space_size=4096 pnpm run build
8080
8181
- name: Set up QEMU
8282
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0

.github/workflows/prepare-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333

3434
- name: Enrich changelog with PR attribution
35-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
35+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
3636
with:
3737
github-token: ${{ secrets.GITHUB_TOKEN }}
3838
script: |

.github/workflows/quality-checks.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: ./.github/actions/setup
2222

2323
- name: Check formatting
24-
run: npm run fmt:check
24+
run: pnpm run fmt:check
2525

2626
lint:
2727
name: Lint
@@ -38,7 +38,7 @@ jobs:
3838
uses: ./.github/actions/setup
3939

4040
- name: Run ESLint
41-
run: npm run lint
41+
run: pnpm run lint
4242

4343
typecheck:
4444
name: Typecheck
@@ -55,7 +55,7 @@ jobs:
5555
uses: ./.github/actions/setup
5656

5757
- name: Run TypeScript typecheck
58-
run: npm run typecheck -- --pretty false
58+
run: pnpm run typecheck --pretty false
5959

6060
knip:
6161
name: Knip
@@ -70,8 +70,6 @@ jobs:
7070

7171
- name: Setup app
7272
uses: ./.github/actions/setup
73-
with:
74-
install-command: npm ci --ignore-scripts
7573

7674
- name: Run Knip
77-
run: npm run knip
75+
run: pnpm run knip

.github/workflows/require-changeset.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
fi
5050
5151
- name: Manage changeset comment
52-
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
52+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
5353
env:
5454
SKIP: ${{ steps.labels.outputs.skip }}
5555
CHANGESET_FOUND: ${{ steps.check.outputs.found }}
@@ -86,7 +86,7 @@ jobs:
8686
8787
**How to add a changeset:**
8888
89-
1. Run \`npm run document-change\` (interactive) and commit the generated file, or
89+
1. Run \`pnpm run document-change\` (interactive) and commit the generated file, or
9090
2. Manually create \`.changeset/<descriptive-name>.md\`:
9191
9292
\`\`\`md

.npmrc

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

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dist
22
node_modules
33
package.json
4-
package-lock.json
4+
pnpm-lock.yaml
55
LICENSE
66
README.md
77
CHANGELOG.md

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ Also, we use [ESLint](https://eslint.org/) for clean and stylistically consisten
3939

4040
**Pull requests are not merged unless all quality checks are passing.** At minimum, `format`, `lint`, `typecheck`, and `knip` must all be green before a pull request can be merged. Run these locally before opening or updating a pull request:
4141

42-
- `npm run fmt:check`
43-
- `npm run lint`
44-
- `npm run typecheck`
45-
- `npm run knip`
42+
- `pnpm run fmt:check`
43+
- `pnpm run lint`
44+
- `pnpm run typecheck`
45+
- `pnpm run knip`
4646

4747
## Restrictions on Generative AI Usage
4848

@@ -62,7 +62,7 @@ We use [Knope](https://knope.tech/) with the Knope GitHub Bot to manage change d
6262

6363
If you have used [Changesets](https://github.com/changesets/changesets) before, Knope should feel very similar. The main difference is scope: Changesets is typically used for JavaScript repositories because it relies on `package.json`, while Knope is multi-language.
6464

65-
If you prefer, you can install the Knope CLI yourself using the [official installation guide](https://knope.tech/installation/). This repo also exposes the CLI through npm scripts, so you can run `npm run knope -- <subcommand>` (for example: `npm run knope -- document-change`). Otherwise, this repo installs Knope for you via `postinstall`, so running `npm i` is enough.
65+
If you prefer, you can install the Knope CLI yourself using the [official installation guide](https://knope.tech/installation/). This repo also exposes the CLI through pnpm scripts, so you can run `pnpm run knope -- <subcommand>` (for example: `pnpm run knope -- document-change`). Otherwise, this repo installs Knope for you via `postinstall`, so running `pnpm i` is enough.
6666

6767
### Documenting a change
6868

@@ -72,8 +72,8 @@ For user-facing pull requests, add one before requesting review.
7272

7373
CLI paths:
7474

75-
- `npm run document-change`
76-
- `npm run knope -- document-change`
75+
- `pnpm run document-change`
76+
- `pnpm run knope -- document-change`
7777
- `knope document-change` (if Knope is installed locally)
7878

7979
All commands open an interactive prompt; fill in the package, change type, and short summary, then commit the generated change file in your PR.
@@ -112,11 +112,11 @@ Releases are driven by Knope Bot (`[bot.releases].enabled = true`):
112112

113113
Maintainers can preview behavior without changing files:
114114

115-
- `npm run knope -- release --dry-run`
115+
- `pnpm run knope -- release --dry-run`
116116

117117
You can also validate the local Knope config with:
118118

119-
- `npm run knope -- --validate`
119+
- `pnpm run knope -- --validate`
120120

121121
**For any query or design discussion, join our [Matrix room](https://matrix.to/#/#sable:sable.moe).**
122122

Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1+
## Base
2+
FROM --platform=$BUILDPLATFORM node:24.13.1-alpine AS base
3+
ENV PNPM_HOME="/pnpm"
4+
ENV PATH="$PNPM_HOME:$PATH"
5+
RUN corepack enable
6+
17
## Builder
2-
FROM --platform=$BUILDPLATFORM node:24.13.1-alpine AS builder
8+
FROM base AS builder
39

410
WORKDIR /src
511

612
ARG VITE_BUILD_HASH
713
ARG VITE_IS_RELEASE_TAG=false
814
ENV VITE_BUILD_HASH=$VITE_BUILD_HASH
915
ENV VITE_IS_RELEASE_TAG=$VITE_IS_RELEASE_TAG
10-
11-
COPY .npmrc package.json package-lock.json /src/
12-
RUN npm ci --ignore-scripts
16+
COPY pnpm-lock.yaml /src/
17+
RUN pnpm fetch
1318
COPY . /src/
19+
RUN pnpm install --offline --frozen-lockfile --ignore-scripts
1420
ENV NODE_OPTIONS=--max_old_space_size=4096
15-
RUN npm run build
21+
RUN pnpm run build
1622

1723
## Dist
1824
FROM scratch AS site-dist

0 commit comments

Comments
 (0)