Skip to content

Commit f54fe4d

Browse files
committed
chore: switch to pnpm monorepo
1 parent 734e290 commit f54fe4d

33 files changed

+287
-194
lines changed

.github/workflows/release.yml

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ jobs:
1919
if: ${{ !contains(github.head_ref, 'all-contributors') }}
2020
name: Svelte ${{ matrix.svelte }}, Node ${{ matrix.node }}, ${{ matrix.check }}
2121
runs-on: ubuntu-latest
22+
needs: [build]
2223

23-
# enable OIDC for codecov uploads
2424
permissions:
25-
id-token: write
25+
id-token: write # codecov uploads
2626

2727
strategy:
2828
fail-fast: false
@@ -41,24 +41,35 @@ jobs:
4141
- { svelte: '5', node: '22', check: 'lint' }
4242
- { svelte: '5', node: '22', check: 'test:examples' }
4343
# Run type checks in latest applicable Node
44-
- { svelte: '3', node: '20', check: 'types:legacy' }
45-
- { svelte: '4', node: '22', check: 'types:legacy' }
46-
- { svelte: '5', node: '22', check: 'types' }
44+
- { svelte: '3', node: '20', check: 'typecheck:legacy' }
45+
- { svelte: '4', node: '22', check: 'typecheck:legacy' }
46+
- { svelte: '5', node: '22', check: 'typecheck' }
4747

4848
steps:
4949
- name: ⬇️ Checkout repo
5050
uses: actions/checkout@v4
5151

52+
- name: 🧱 Setup pnpm
53+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
54+
with:
55+
standalone: ${{ matrix.node == '16' }}
56+
5257
- name: ⎔ Setup node
5358
uses: actions/setup-node@v4
5459
with:
5560
node-version: ${{ matrix.node }}
5661

57-
- name: 📥 Download deps
58-
run: npm run install:${{ matrix.svelte }}
62+
- name: 📥 Install dependencies
63+
run: pnpm run install:${{ matrix.svelte }}
64+
65+
- name: 📥 Download build
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: build
69+
path: packages/svelte
5970

6071
- name: ▶️ Run ${{ matrix.check }}
61-
run: npm run ${{ matrix.check }}
72+
run: pnpm run ${{ matrix.check }}
6273

6374
- name: ⬆️ Upload coverage report
6475
if: ${{ startsWith(matrix.check, 'test:') }}
@@ -73,50 +84,66 @@ jobs:
7384
- name: ⬇️ Checkout repo
7485
uses: actions/checkout@v4
7586

87+
- name: 🧱 Setup pnpm
88+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
89+
7690
- name: ⎔ Setup node
7791
uses: actions/setup-node@v4
7892
with:
7993
node-version: 22
8094

81-
- name: 📥 Download deps
82-
run: npm install
95+
- name: 📥 Install dependencies
96+
run: pnpm install
8397

84-
- name: 🏗️ Build types
85-
run: npm run build
98+
- name: 🏗️ Build types and documentation
99+
run: pnpm run build
86100

87-
- name: ⬆️ Upload types build
101+
- name: ⬆️ Upload build
88102
uses: actions/upload-artifact@v4
89103
with:
90-
name: types
91-
path: types
104+
name: build
105+
path: |
106+
packages/svelte/README.md
107+
packages/svelte/types
92108
93109
release:
94110
needs: [main, build]
95111
runs-on: ubuntu-latest
96112
if: ${{ github.repository == 'testing-library/svelte-testing-library' &&
97113
contains('refs/heads/main,refs/heads/next', github.ref) &&
98114
github.event_name == 'push' }}
115+
permissions:
116+
contents: write # GitHub release publish
117+
issues: write # released issues comments
118+
pull-requests: write # released pull requests comments
119+
id-token: write # trusted publishing and npm provenance
99120
steps:
100121
- name: ⬇️ Checkout repo
101122
uses: actions/checkout@v4
102123

124+
- name: 🧱 Setup pnpm
125+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
126+
103127
- name: ⎔ Setup node
104128
uses: actions/setup-node@v4
105129
with:
106130
node-version: 22
107131

108-
- name: 📥 Downloads types build
132+
- name: 📥 Download build
109133
uses: actions/download-artifact@v4
110134
with:
111-
name: types
112-
path: types
135+
name: build
136+
path: packages/svelte
113137

114138
- name: 🚀 Release
115-
uses: cycjimmy/semantic-release-action@v4
116-
with:
117-
semantic_version: 24
118-
extra_plugins: |
119-
conventional-changelog-conventionalcommits@8
139+
run: |
140+
pnpm \
141+
--package="@anolilab/multi-semantic-release@2" \
142+
--package="@anolilab/semantic-release-pnpm@2" \
143+
--package="semantic-release@25" \
144+
--package="conventional-changelog-conventionalcommits@9" \
145+
dlx \
146+
multi-semantic-release
120147
env:
121148
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122149
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ yarn.lock
1313

1414
# generated typing output
1515
types
16+
*.tsbuildinfo
17+
18+
# copied documentation
19+
packages/svelte/README.md

CONTRIBUTING.md

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,52 +9,41 @@
99

1010
## Release
1111

12-
The module is released automatically from the `main` and `next` branches using [semantic-release-action][]. Version bumps and change logs are generated from the commit messages.
12+
The module is released automatically from the `main` and `next` branches using [multi-semantic-release][]. Version bumps and change logs are generated from the commit messages.
1313

14-
[semantic-release-action]: https://github.com/cycjimmy/semantic-release-action
15-
16-
### Preview release
17-
18-
If you would like to preview the release from a given branch, and...
19-
20-
- You have push access to the repository
21-
- The branch exists in GitHub
22-
23-
...you can preview the next release version and changelog using:
24-
25-
```shell
26-
npm run preview-release
27-
```
14+
[multi-semantic-release]: https://github.com/anolilab/semantic-release/tree/main/packages/multi-semantic-release
2815

2916
## Development setup
3017

18+
This repository uses `pnpm` as its package manager. See the `pnpm` [installation guide](https://pnpm.io/installation) to set it up through whatever method you prefer.
19+
3120
After cloning the repository, use the `setup` script to install dependencies and run all checks:
3221

3322
```shell
34-
npm run setup
23+
pnpm run setup
3524
```
3625

3726
### Lint and format
3827

3928
Run auto-formatting to ensure any changes adhere to the code style of the repository:
4029

4130
```shell
42-
npm run format
31+
pnpm run format
4332
```
4433

4534
To run lint and format checks without making any changes:
4635

4736
```shell
48-
npm run lint
37+
pnpm run lint
4938
```
5039

5140
### Test
5241

5342
Run unit tests once or in watch mode:
5443

5544
```shell
56-
npm test
57-
npm run test:watch
45+
pnpm test
46+
pnpm run test:watch
5847
```
5948

6049
### Using different versions of Svelte
@@ -63,34 +52,34 @@ Use the provided script to set up your environment for different versions of Sve
6352

6453
```shell
6554
# Svelte 5
66-
npm run install:5
67-
npm run all
55+
pnpm run install:5
56+
pnpm run all
6857

6958
# Svelte 4
70-
npm run install:4
71-
npm run all:legacy
59+
pnpm run install:4
60+
pnpm run all:legacy
7261

7362
# Svelte 3
74-
npm run install:3
75-
npm run all:legacy
63+
pnpm run install:3
64+
pnpm run all:legacy
7665
```
7766

7867
### Docs
7968

8069
Use the `docs` script to ensure the README's table of contents is up to date:
8170

8271
```shell
83-
npm run docs
72+
pnpm run docs
8473
```
8574

8675
Use `contributors:add` to add a contributor to the README:
8776

8877
```shell
89-
npm run contributors:add
78+
pnpm run contributors:add
9079
```
9180

9281
Use `contributors:generate` to ensure the README's contributor list is up to date:
9382

9483
```shell
95-
npm run contributors:generate
84+
pnpm run contributors:generate
9685
```

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default tseslint.config(
3737
},
3838
{
3939
name: 'ignores',
40-
ignores: ['coverage', 'types'],
40+
ignores: ['**/coverage/**', '**/types/**'],
4141
},
4242
{
4343
name: 'simple-import-sort',

jest.config.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ export default {
1717
injectGlobals: true,
1818
moduleNameMapper: {
1919
'^vitest$': '<rootDir>/tests/_jest-vitest-alias.js',
20-
[String.raw`^@testing-library\/svelte$`]: '<rootDir>/src/index.js',
2120
},
2221
resetMocks: true,
2322
restoreMocks: true,
24-
collectCoverageFrom: ['<rootDir>/src/**/*'],
23+
collectCoverageFrom: ['<rootDir>/packages/*/src/**/*'],
2524
coveragePathIgnorePatterns: [
26-
'<rootDir>/src/vite.js',
27-
'<rootDir>/src/vitest.js',
25+
'<rootDir>/packages/svelte/src/vite.js',
26+
'<rootDir>/packages/svelte/src/vitest.js',
2827
],
2928
}

0 commit comments

Comments
 (0)