Skip to content

Commit 2de464b

Browse files
authored
chore: use pnpm workspace (#182)
Renovate runs `pnpm install --recursive --lockfile-only --ignore-scripts --ignore-pnpmfile` and errors on broken `package.json`.
1 parent 11908d7 commit 2de464b

File tree

12 files changed

+259
-60
lines changed

12 files changed

+259
-60
lines changed

.github/actions/pnpm/action.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,12 @@ description: Install pnpm
55
runs:
66
using: composite
77
steps:
8-
- name: Install pnpm
9-
working-directory: fixtures/pnpm8
10-
shell: bash
11-
run: corepack enable
8+
- uses: pnpm/action-setup@v4
129

13-
- name: Setup Node.js
14-
uses: actions/setup-node@v4
10+
- uses: actions/setup-node@v4
1511
with:
1612
node-version-file: .node-version
17-
cache-dependency-path: ./fixtures/pnpm8/package.json
1813
cache: pnpm
1914

20-
- name: pnpm install
21-
working-directory: fixtures/pnpm8
15+
- run: pnpm install
2216
shell: bash
23-
run: pnpm install

.github/workflows/ci.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,7 @@ jobs:
7676
cache-key: wasi
7777
save-cache: ${{ github.ref_name == 'main' }}
7878

79-
- name: corepack
80-
run: corepack enable
81-
82-
- name: Setup Node.js
83-
uses: actions/setup-node@v4
84-
with:
85-
node-version-file: .node-version
86-
cache: pnpm
87-
88-
- name: Install dependencies
89-
run: pnpm install --frozen-lockfile
90-
91-
- name: Install fixtures dependencies
92-
working-directory: fixtures/pnpm8
93-
run: pnpm install --frozen-lockfile
79+
- uses: ./.github/actions/pnpm
9480

9581
- name: Build
9682
run: |

.github/workflows/codecov.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ jobs:
2424
- name: Checkout
2525
uses: taiki-e/checkout-action@v1
2626

27-
- name: Pnpm
28-
uses: ./.github/actions/pnpm
27+
- uses: ./.github/actions/pnpm
2928

3029
- uses: Boshen/setup-rust@main
3130
with:

.github/workflows/release-napi.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,7 @@ jobs:
8585
steps:
8686
- uses: taiki-e/checkout-action@v1
8787

88-
- name: corepack
89-
run: corepack enable
90-
91-
- name: Setup Node.js
92-
uses: actions/setup-node@v4
93-
with:
94-
node-version-file: .node-version
95-
cache: pnpm
96-
97-
- name: Install dependencies
98-
run: pnpm install --frozen-lockfile
99-
100-
- name: Install fixtures dependencies
101-
working-directory: fixtures/pnpm8
102-
run: pnpm install --frozen-lockfile
88+
- uses: ./.github/actions/pnpm
10389

10490
- name: Add Rust Target
10591
run: rustup target add ${{ matrix.target }}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
{
2-
"name": "pnpm8",
2+
"name": "pnpm",
33
"version": "1.0.0",
44
"private": true,
5-
"engines": {
6-
"node": ">=16.0.0"
7-
},
8-
"packageManager": "[email protected]",
95
"devDependencies": {
106
"axios": "1.6.2",
117
"styled-components": "6.1.1",

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ alias r := ready
1010
# or install via `cargo install cargo-binstall`
1111
# Initialize the project by installing all the necessary tools.
1212
init:
13-
cd fixtures/pnpm8 && pnpm install
13+
pnpm install
1414
cargo binstall cargo-watch typos-cli taplo-cli cargo-llvm-cov -y
1515

1616
# When ready, run the same CI commands

napi/__test__/resolver.spec.mjs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,28 +231,29 @@ for (const [title, context, request, expected] of [
231231
}
232232

233233
test('resolve pnpm package', (t) => {
234-
const pnpmProjectPath = join(currentDir, '..', '..', 'fixtures', 'pnpm8')
234+
const rootDir = join(currentDir, '..', '..');
235+
const pnpmProjectPath = join(rootDir, 'fixtures', 'pnpm')
235236
const resolver = new ResolverFactory({
236237
aliasFields: ['browser'],
237238
})
238239
t.deepEqual(resolver.sync(pnpmProjectPath, 'styled-components'), {
239240
path: join(
240-
pnpmProjectPath,
241-
'node_modules/.pnpm/[email protected]_react-dom@18.2.0_react@18.2.0/node_modules/styled-components/dist/styled-components.browser.cjs.js'
241+
rootDir,
242+
'node_modules/.pnpm/[email protected]_react-dom@18.3.1_react@18.[email protected]/node_modules/styled-components/dist/styled-components.browser.cjs.js'
242243
),
243244
})
244245
t.deepEqual(
245246
resolver.sync(
246247
join(
247-
pnpmProjectPath,
248-
'node_modules/.pnpm/[email protected]_react-dom@18.2.0_react@18.2.0/node_modules/styled-components'
248+
rootDir,
249+
'node_modules/.pnpm/[email protected]_react-dom@18.3.1_react@18.[email protected]/node_modules/styled-components'
249250
),
250251
'react'
251252
),
252253
{
253254
path: join(
254-
pnpmProjectPath,
255-
'node_modules/.pnpm/react@18.2.0/node_modules/react/index.js'
255+
rootDir,
256+
'node_modules/.pnpm/react@18.3.1/node_modules/react/index.js'
256257
),
257258
}
258259
)

0 commit comments

Comments
 (0)