Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 50 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
if: ${{ !contains(github.head_ref, 'all-contributors') }}
name: Svelte ${{ matrix.svelte }}, Node ${{ matrix.node }}, ${{ matrix.check }}
runs-on: ubuntu-latest
needs: [build]

# enable OIDC for codecov uploads
permissions:
id-token: write
id-token: write # codecov uploads

strategy:
fail-fast: false
Expand All @@ -41,24 +41,35 @@ jobs:
- { svelte: '5', node: '22', check: 'lint' }
- { svelte: '5', node: '22', check: 'test:examples' }
# Run type checks in latest applicable Node
- { svelte: '3', node: '20', check: 'types:legacy' }
- { svelte: '4', node: '22', check: 'types:legacy' }
- { svelte: '5', node: '22', check: 'types' }
- { svelte: '3', node: '20', check: 'typecheck:legacy' }
- { svelte: '4', node: '22', check: 'typecheck:legacy' }
- { svelte: '5', node: '22', check: 'typecheck' }

steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: 🧱 Setup pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
with:
standalone: ${{ matrix.node == '16' }}

- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: 📥 Download deps
run: npm run install:${{ matrix.svelte }}
- name: 📥 Install dependencies
run: pnpm run install:${{ matrix.svelte }}

- name: 📥 Download build
uses: actions/download-artifact@v4
with:
name: build
path: packages/svelte

- name: ▶️ Run ${{ matrix.check }}
run: npm run ${{ matrix.check }}
run: pnpm run ${{ matrix.check }}

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

- name: 🧱 Setup pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0

- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: 22

- name: 📥 Download deps
run: npm install
- name: 📥 Install dependencies
run: pnpm install

- name: 🏗️ Build types
run: npm run build
- name: 🏗️ Build types and documentation
run: pnpm run build

- name: ⬆️ Upload types build
- name: ⬆️ Upload build
uses: actions/upload-artifact@v4
with:
name: types
path: types
name: build
path: |
packages/svelte/README.md
packages/svelte/types

release:
needs: [main, build]
runs-on: ubuntu-latest
if: ${{ github.repository == 'testing-library/svelte-testing-library' &&
contains('refs/heads/main,refs/heads/next', github.ref) &&
github.event_name == 'push' }}
permissions:
contents: write # GitHub release publish
issues: write # released issues comments
pull-requests: write # released pull requests comments
id-token: write # trusted publishing and npm provenance
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4

- name: 🧱 Setup pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0

- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
node-version: 22

- name: 📥 Downloads types build
- name: 📥 Download build
uses: actions/download-artifact@v4
with:
name: types
path: types
name: build
path: packages/svelte

- name: 🚀 Release
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 24
extra_plugins: |
conventional-changelog-conventionalcommits@8
run: |
pnpm \
--package="@anolilab/multi-semantic-release@2" \
--package="@anolilab/semantic-release-pnpm@2" \
--package="semantic-release@25" \
--package="conventional-changelog-conventionalcommits@9" \
dlx \
multi-semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ yarn.lock

# generated typing output
types
*.tsbuildinfo

# copied documentation
packages/svelte/README.md
47 changes: 18 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,41 @@

## Release

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.
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.

[semantic-release-action]: https://github.com/cycjimmy/semantic-release-action

### Preview release

If you would like to preview the release from a given branch, and...

- You have push access to the repository
- The branch exists in GitHub

...you can preview the next release version and changelog using:

```shell
npm run preview-release
```
[multi-semantic-release]: https://github.com/anolilab/semantic-release/tree/main/packages/multi-semantic-release

## Development setup

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.

After cloning the repository, use the `setup` script to install dependencies and run all checks:

```shell
npm run setup
pnpm run setup
```

### Lint and format

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

```shell
npm run format
pnpm run format
```

To run lint and format checks without making any changes:

```shell
npm run lint
pnpm run lint
```

### Test

Run unit tests once or in watch mode:

```shell
npm test
npm run test:watch
pnpm test
pnpm run test:watch
```

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

```shell
# Svelte 5
npm run install:5
npm run all
pnpm run install:5
pnpm run all

# Svelte 4
npm run install:4
npm run all:legacy
pnpm run install:4
pnpm run all:legacy

# Svelte 3
npm run install:3
npm run all:legacy
pnpm run install:3
pnpm run all:legacy
```

### Docs

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

```shell
npm run docs
pnpm run docs
```

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

```shell
npm run contributors:add
pnpm run contributors:add
```

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

```shell
npm run contributors:generate
pnpm run contributors:generate
```
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default tseslint.config(
},
{
name: 'ignores',
ignores: ['coverage', 'types'],
ignores: ['**/coverage/**', '**/types/**'],
},
{
name: 'simple-import-sort',
Expand Down
7 changes: 3 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ export default {
injectGlobals: true,
moduleNameMapper: {
'^vitest$': '<rootDir>/tests/_jest-vitest-alias.js',
[String.raw`^@testing-library\/svelte$`]: '<rootDir>/src/index.js',
},
resetMocks: true,
restoreMocks: true,
collectCoverageFrom: ['<rootDir>/src/**/*'],
collectCoverageFrom: ['<rootDir>/packages/*/src/**/*'],
coveragePathIgnorePatterns: [
'<rootDir>/src/vite.js',
'<rootDir>/src/vitest.js',
'<rootDir>/packages/svelte/src/vite.js',
'<rootDir>/packages/svelte/src/vitest.js',
],
}
Loading