Skip to content

Commit 791da7d

Browse files
Boshenclaude
andauthored
Switch from npm to pnpm (#436)
* Switch from npm to pnpm - Add `packageManager` field to package.json with pnpm 10.28.2 - Update all CI workflows to use pnpm/action-setup@v4 - Replace manual node_modules caching with setup-node's built-in pnpm cache - Update GitHub Actions to v4 (checkout, setup-node, action-gh-release) - Replace package-lock.json with pnpm-lock.yaml Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add missing type dependencies for TypeScript build - Add @marko/compiler, pug-lexer, and fast-glob as devDependencies - Pin prettier-plugin-jsdoc to 1.3.3 (v1.8.0 has a bug with hasOwnProperty) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ba6c355 commit 791da7d

7 files changed

Lines changed: 4979 additions & 7721 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,32 @@ concurrency:
1515

1616
env:
1717
CI: true
18-
CACHE_PREFIX: stable
1918
NODE_VERSION: 22
2019

2120
jobs:
2221
build:
2322
runs-on: ubuntu-latest
2423

2524
steps:
26-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
26+
27+
- name: Install pnpm
28+
uses: pnpm/action-setup@v4
2729

2830
- name: Use Node.js ${{ env.NODE_VERSION }}
29-
uses: actions/setup-node@v3
31+
uses: actions/setup-node@v4
3032
with:
3133
node-version: ${{ env.NODE_VERSION }}
32-
registry-url: "https://registry.npmjs.org"
33-
34-
- name: Use cached node_modules
35-
id: cache
36-
uses: actions/cache@v3
37-
with:
38-
path: node_modules
39-
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}
34+
cache: pnpm
4035

4136
- name: Install dependencies
42-
run: npm install --force
37+
run: pnpm install
4338

4439
- name: Check formatting
45-
run: npm run format -- --check
40+
run: pnpm run format --check
4641

4742
- name: Build Prettier Plugin
48-
run: |
49-
npm run build
43+
run: pnpm run build
5044

5145
- name: Test against Prettier v3
52-
run: |
53-
NODE_OPTIONS=--experimental-vm-modules npm run test
46+
run: pnpm run test

.github/workflows/prepare-release.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
env:
1010
CI: true
11+
NODE_VERSION: 22
1112

1213
permissions:
1314
contents: read
@@ -19,12 +20,8 @@ jobs:
1920

2021
runs-on: ubuntu-latest
2122

22-
strategy:
23-
matrix:
24-
node-version: [22]
25-
2623
steps:
27-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2825

2926
- run: git fetch --tags -f
3027

@@ -33,21 +30,28 @@ jobs:
3330
run: |
3431
echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
3532
33+
- name: Install pnpm
34+
uses: pnpm/action-setup@v4
35+
36+
- name: Use Node.js ${{ env.NODE_VERSION }}
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: ${{ env.NODE_VERSION }}
40+
cache: pnpm
41+
registry-url: 'https://registry.npmjs.org'
42+
43+
- name: Install dependencies
44+
run: pnpm install
45+
3646
- name: Get release notes
3747
run: |
38-
RELEASE_NOTES=$(npm run release-notes --silent)
48+
RELEASE_NOTES=$(pnpm run release-notes --silent)
3949
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
4050
echo "$RELEASE_NOTES" >> $GITHUB_ENV
4151
echo "EOF" >> $GITHUB_ENV
4252
43-
- name: Use Node.js ${{ matrix.node-version }}
44-
uses: actions/setup-node@v3
45-
with:
46-
node-version: ${{ matrix.node-version }}
47-
registry-url: 'https://registry.npmjs.org'
48-
4953
- name: Release
50-
uses: softprops/action-gh-release@v1
54+
uses: softprops/action-gh-release@v2
5155
with:
5256
draft: true
5357
tag_name: ${{ env.TAG_NAME }}

.github/workflows/release-insiders.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ concurrency:
1313

1414
env:
1515
CI: true
16-
CACHE_PREFIX: stable
1716
NODE_VERSION: 22
1817
RELEASE_CHANNEL: insiders
1918

@@ -22,41 +21,36 @@ jobs:
2221
runs-on: ubuntu-latest
2322

2423
steps:
25-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
25+
26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v4
2628

2729
- name: Use Node.js ${{ env.NODE_VERSION }}
28-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
2931
with:
3032
node-version: ${{ env.NODE_VERSION }}
33+
cache: pnpm
3134
registry-url: "https://registry.npmjs.org"
3235

33-
- name: Use cached node_modules
34-
id: cache
35-
uses: actions/cache@v3
36-
with:
37-
path: node_modules
38-
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}
39-
4036
- name: Install dependencies
41-
run: npm install
37+
run: pnpm install
4238

4339
- name: Build Prettier Plugin
44-
run: |
45-
npm run build
40+
run: pnpm run build
4641

4742
- name: Test
48-
run: |
49-
NODE_OPTIONS=--experimental-vm-modules npm run test
43+
run: pnpm run test
5044

5145
- name: Resolve version
5246
id: vars
5347
run: |
5448
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
5549
5650
- name: "Version based on commit: 0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }}"
57-
run: npm version 0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }} --force --no-git-tag-version
51+
run: pnpm version 0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }} --force --no-git-tag-version
5852

5953
- name: Publish
60-
run: npm publish --provenance --tag ${{ env.RELEASE_CHANNEL }}
54+
run: pnpm publish --provenance --tag ${{ env.RELEASE_CHANNEL }} --no-git-checks
6155
env:
6256
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,39 @@ concurrency:
1414

1515
env:
1616
CI: true
17-
CACHE_PREFIX: stable
1817
NODE_VERSION: 22
1918

2019
jobs:
2120
build:
2221
runs-on: ubuntu-latest
2322

2423
steps:
25-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
25+
26+
- name: Install pnpm
27+
uses: pnpm/action-setup@v4
2628

2729
- name: Use Node.js ${{ env.NODE_VERSION }}
28-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
2931
with:
3032
node-version: ${{ env.NODE_VERSION }}
33+
cache: pnpm
3134
registry-url: "https://registry.npmjs.org"
3235

33-
- name: Use cached node_modules
34-
id: cache
35-
uses: actions/cache@v3
36-
with:
37-
path: node_modules
38-
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ env.CACHE_PREFIX }}-node_modules-${{ hashFiles('**/package-lock.json') }}
39-
4036
- name: Install dependencies
41-
run: npm install
37+
run: pnpm install
4238

4339
- name: Build Prettier Plugin
44-
run: |
45-
npm run build
40+
run: pnpm run build
4641

4742
- name: Test
48-
run: |
49-
NODE_OPTIONS=--experimental-vm-modules npm run test
43+
run: pnpm run test
5044

5145
- name: Calculate environment variables
5246
run: |
53-
echo "RELEASE_CHANNEL=$(npm run release-channel --silent)" >> $GITHUB_ENV
47+
echo "RELEASE_CHANNEL=$(pnpm run release-channel --silent)" >> $GITHUB_ENV
5448
5549
- name: Publish
56-
run: npm publish --provenance --tag ${{ env.RELEASE_CHANNEL }}
50+
run: pnpm publish --provenance --tag ${{ env.RELEASE_CHANNEL }} --no-git-checks
5751
env:
5852
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)