Skip to content

Commit 03337c8

Browse files
committed
Switch from npm to pnpm
1 parent d7d8b1f commit 03337c8

8 files changed

Lines changed: 1069 additions & 1395 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,21 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v5
1515

16+
# The action reads the pnpm version from the packageManager field in package.json.
17+
- name: Install pnpm
18+
uses: pnpm/action-setup@v6
19+
1620
- name: Use Node.js
1721
uses: actions/setup-node@v4
1822
with:
1923
node-version: "22"
20-
cache: "npm"
21-
22-
- name: Cache node modules
23-
uses: actions/cache@v4
24-
with:
25-
path: node_modules
26-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
27-
restore-keys: |
28-
${{ runner.os }}-node-
24+
cache: "pnpm"
2925

3026
- name: Install dependencies
31-
run: npm ci
27+
run: pnpm install --frozen-lockfile
3228

3329
- name: Run lint
34-
run: npm run lint
30+
run: pnpm run lint
3531

3632
- name: Run build
37-
run: npm run build
33+
run: pnpm run build

‎.prettierignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
package-lock.json
1+
pnpm-lock.yaml
22
devenv.lock

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Formats source code from stdin and writes the formatted code to stdout.
55
## Install
66

77
```sh
8-
npm install
9-
npm run build
10-
npm link
8+
pnpm install
9+
pnpm run build
10+
pnpm add --global "$PWD"
1111
```
1212

1313
## Usage
@@ -49,7 +49,7 @@ To see all the options, run `format-code shortcuts --help`.
4949

5050
## Development
5151

52-
The project uses [devenv](https://devenv.sh) to install Node.js and npm. To
52+
The project uses [devenv](https://devenv.sh) to install Node.js and pnpm. To
5353
enter the dev shell, run:
5454

5555
```sh

‎devenv.nix‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
languages.javascript = {
55
enable = true;
6-
npm.enable = true;
6+
pnpm.enable = true;
77
};
88

99
git-hooks.hooks = {
@@ -22,11 +22,12 @@
2222
settings.binPath = "./node_modules/.bin/prettier";
2323
};
2424

25-
# The hook list has no TypeScript hook, so the hook runs the npm script.
25+
# The hook list has no TypeScript hook.
26+
# Use the TypeScript from node_modules, so the hook and CI use the same version.
2627
tsc = {
2728
enable = true;
2829
name = "tsc";
29-
entry = "npm run types";
30+
entry = "./node_modules/.bin/tsc --noEmit";
3031
files = "\\.ts$|^tsconfig\\.json$";
3132
pass_filenames = false;
3233
};

0 commit comments

Comments
 (0)