Skip to content

Commit 5707490

Browse files
authored
chore: promote @testing-library/svelte-core to stable (#466)
2 parents 02dc607 + fe7ccb4 commit 5707490

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1039
-534
lines changed

.editorconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ insert_final_newline = true
88
trim_trailing_whitespace = true
99

1010
[*.md]
11-
max_line_length = off
1211
trim_trailing_whitespace = false

.github/workflows/release.yml

Lines changed: 51 additions & 28 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
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,54 +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/dist
108+
packages/svelte-core/dist
92109
93110
release:
94-
permissions:
95-
contents: write # GitHub release publish
96-
issues: write # released issues comments
97-
pull-requests: write # released pull requests comments
98-
id-token: write # trusted publishing and npm provenance
99111
needs: [main, build]
100112
runs-on: ubuntu-latest
101113
if: ${{ github.repository == 'testing-library/svelte-testing-library' &&
102114
contains('refs/heads/main,refs/heads/next', github.ref) &&
103115
github.event_name == 'push' }}
116+
permissions:
117+
contents: write # GitHub release publish
118+
issues: write # released issues comments
119+
pull-requests: write # released pull requests comments
120+
id-token: write # trusted publishing and npm provenance
104121
steps:
105122
- name: ⬇️ Checkout repo
106123
uses: actions/checkout@v4
107124

125+
- name: 🧱 Setup pnpm
126+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
127+
108128
- name: ⎔ Setup node
109129
uses: actions/setup-node@v4
110130
with:
111131
node-version: 24
112132

113-
- name: 📥 Downloads types build
133+
- name: 📥 Download build
114134
uses: actions/download-artifact@v4
115135
with:
116-
name: types
117-
path: types
136+
name: build
137+
path: packages
118138

119139
- name: 🚀 Release
120-
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 #v6.0.0
121-
with:
122-
semantic_version: 25
123-
extra_plugins: |
124-
conventional-changelog-conventionalcommits@9
140+
run: |
141+
pnpm \
142+
--package="@anolilab/multi-semantic-release@3" \
143+
--package="@anolilab/semantic-release-pnpm@3" \
144+
--package="semantic-release@25" \
145+
--package="conventional-changelog-conventionalcommits@9" \
146+
dlx \
147+
multi-semantic-release
125148
env:
126149
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ package-lock.json
1212
yarn.lock
1313

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

CONTRIBUTING.md

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,52 +9,49 @@
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
14+
[multi-semantic-release]: https://github.com/anolilab/semantic-release/tree/main/packages/multi-semantic-release
1515

16-
### Preview release
17-
18-
If you would like to preview the release from a given branch, and...
16+
## Development setup
1917

20-
- You have push access to the repository
21-
- The branch exists in GitHub
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.
2219

23-
...you can preview the next release version and changelog using:
20+
After cloning the repository, use the `setup` script to install dependencies, build, and run all checks:
2421

2522
```shell
26-
npm run preview-release
23+
pnpm run setup
2724
```
2825

29-
## Development setup
26+
### Build
3027

31-
After cloning the repository, use the `setup` script to install dependencies and run all checks:
28+
To build types and docs:
3229

3330
```shell
34-
npm run setup
31+
pnpm run build
3532
```
3633

3734
### Lint and format
3835

3936
Run auto-formatting to ensure any changes adhere to the code style of the repository:
4037

4138
```shell
42-
npm run format
39+
pnpm run format
4340
```
4441

4542
To run lint and format checks without making any changes:
4643

4744
```shell
48-
npm run lint
45+
pnpm run lint
4946
```
5047

5148
### Test
5249

5350
Run unit tests once or in watch mode:
5451

5552
```shell
56-
npm test
57-
npm run test:watch
53+
pnpm test
54+
pnpm run test:watch
5855
```
5956

6057
### Using different versions of Svelte
@@ -63,34 +60,28 @@ Use the provided script to set up your environment for different versions of Sve
6360

6461
```shell
6562
# Svelte 5
66-
npm run install:5
67-
npm run all
63+
pnpm run install:5
64+
pnpm run all
6865

6966
# Svelte 4
70-
npm run install:4
71-
npm run all:legacy
67+
pnpm run install:4
68+
pnpm run all:legacy
7269

7370
# Svelte 3
74-
npm run install:3
75-
npm run all:legacy
71+
pnpm run install:3
72+
pnpm run all:legacy
7673
```
7774

78-
### Docs
79-
80-
Use the `docs` script to ensure the README's table of contents is up to date:
81-
82-
```shell
83-
npm run docs
84-
```
75+
### Contributors
8576

8677
Use `contributors:add` to add a contributor to the README:
8778

8879
```shell
89-
npm run contributors:add
80+
pnpm run contributors:add
9081
```
9182

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

9485
```shell
95-
npm run contributors:generate
86+
pnpm run contributors:generate
9687
```

eslint.config.js

Lines changed: 2 additions & 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/**', '**/dist/**'],
4141
},
4242
{
4343
name: 'simple-import-sort',
@@ -68,6 +68,7 @@ export default tseslint.config(
6868
name: 'extras',
6969
rules: {
7070
'unicorn/prevent-abbreviations': 'off',
71+
'unicorn/prefer-dom-node-append': 'off',
7172
},
7273
},
7374
{

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)