Skip to content

Commit 950b675

Browse files
authored
feat: support pnpm lockfile v9 (#122)
1 parent adc8b97 commit 950b675

File tree

5 files changed

+170
-24
lines changed

5 files changed

+170
-24
lines changed

.github/workflows/test.yaml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test
22

33
on:
44
push:
5-
branches: [ main, "releases/v*"]
5+
branches: [main, "releases/v*"]
66
pull_request:
77
workflow_dispatch:
88

@@ -20,14 +20,14 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
os: [ ubuntu-latest, macos-latest, windows-latest ]
23+
os: [ubuntu-latest, macos-latest, windows-latest]
2424
steps:
2525
- name: Checkout
2626
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
2727
- name: Setup Biome CLI
2828
uses: ./
2929
with:
30-
version: '1.5.1'
30+
version: "1.5.1"
3131
- name: Retrieve the version
3232
id: version
3333
shell: bash
@@ -48,7 +48,7 @@ jobs:
4848
strategy:
4949
fail-fast: false
5050
matrix:
51-
os: [ ubuntu-latest, macos-latest, windows-latest ]
51+
os: [ubuntu-latest, macos-latest, windows-latest]
5252
steps:
5353
- name: Checkout
5454
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
@@ -71,12 +71,12 @@ jobs:
7171
fi
7272
7373
test-pnpm:
74-
name: Auto-detect version (pnpm)
74+
name: Auto-detect version (pnpm)
7575
runs-on: ${{ matrix.os }}
7676
strategy:
7777
fail-fast: false
7878
matrix:
79-
os: [ ubuntu-latest, macos-latest, windows-latest ]
79+
os: [ubuntu-latest, macos-latest, windows-latest]
8080
steps:
8181
- name: Checkout
8282
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
@@ -98,13 +98,41 @@ jobs:
9898
exit 1
9999
fi
100100
101+
test-pnpm-9:
102+
name: Auto-detect version (pnpm lockfile v9)
103+
runs-on: ${{ matrix.os }}
104+
strategy:
105+
fail-fast: false
106+
matrix:
107+
os: [ubuntu-latest, macos-latest, windows-latest]
108+
steps:
109+
- name: Checkout
110+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
111+
- name: Setup Biome CLI
112+
uses: ./
113+
with:
114+
working-dir: "test/fixtures/pnpm-9"
115+
- name: Retrieve the version
116+
id: version
117+
shell: bash
118+
run: echo "version=$(biome --version)" >> "$GITHUB_OUTPUT"
119+
- name: Check equality
120+
shell: bash
121+
run: |
122+
if [ "Version: ${{ env.BIOME_EXPECTED_VERSION }}" == "${{ steps.version.outputs.version }}" ]; then
123+
exit 0
124+
else
125+
echo "Versions do not match"
126+
exit 1
127+
fi
128+
101129
test-yarn:
102-
name: Auto-detect version (yarn)
130+
name: Auto-detect version (yarn)
103131
runs-on: ${{ matrix.os }}
104132
strategy:
105133
fail-fast: false
106134
matrix:
107-
os: [ ubuntu-latest, macos-latest, windows-latest ]
135+
os: [ubuntu-latest, macos-latest, windows-latest]
108136
steps:
109137
- name: Checkout
110138
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
@@ -127,12 +155,12 @@ jobs:
127155
fi
128156
129157
test-bun:
130-
name: Auto-detect version (bun)
158+
name: Auto-detect version (bun)
131159
runs-on: ${{ matrix.os }}
132160
strategy:
133161
fail-fast: false
134162
matrix:
135-
os: [ ubuntu-latest, macos-latest, windows-latest ]
163+
os: [ubuntu-latest, macos-latest, windows-latest]
136164
steps:
137165
- name: Checkout
138166
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
@@ -160,7 +188,7 @@ jobs:
160188
strategy:
161189
fail-fast: false
162190
matrix:
163-
os: [ ubuntu-latest, macos-latest, windows-latest ]
191+
os: [ubuntu-latest, macos-latest, windows-latest]
164192
steps:
165193
- name: Checkout
166194
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4

dist/index.mjs

Lines changed: 7 additions & 13 deletions
Large diffs are not rendered by default.

src/version.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ const extractVersionFromPnpmLockFile = async (
8888
await readFile(join(root, "pnpm-lock.yaml"), "utf8"),
8989
);
9090
return (
91+
// pnpm lockfile 9
92+
lockfile.importers["."]?.devDependencies["@biomejs/biome"]?.version ??
93+
lockfile.importers["."]?.dependencies["@biomejs/biome"]?.version ??
94+
// pnpm lockfile 3,4,5,6
9195
lockfile.devDependencies?.["@biomejs/biome"]?.version ??
9296
lockfile.dependencies?.["@biomejs/biome"]?.version
9397
);

test/fixtures/pnpm-9/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "pnpm",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"devDependencies": {
13+
"@biomejs/biome": "1.5.0"
14+
}
15+
}

test/fixtures/pnpm-9/pnpm-lock.yaml

Lines changed: 105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)