Skip to content

Commit f5bdf3d

Browse files
authored
feat: migration towards vitest (#1574)
Improve `resolveHookState` function - it has better typings overall and passes previous state to state updater only in case it is being passed to `resolveHookState` function. BREAKING CHANGE: resolve hook state does not pass `undefined` to `nextState` function when while being called without `previousState` anymore
1 parent d8f8e67 commit f5bdf3d

File tree

353 files changed

+13887
-20321
lines changed

Some content is hidden

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

353 files changed

+13887
-20321
lines changed

.commitlintrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const config = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
'footer-max-line-length': [1, 'always', 72],
5+
},
6+
};
7+
8+
export default config;

.eslintignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 52 deletions
This file was deleted.

.github/workflows/ci-cd.yml

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ on:
99
- master
1010
workflow_dispatch:
1111

12-
env:
13-
HUSKY: 0
14-
1512
jobs:
1613
lint:
1714
name: "Lint"
@@ -21,15 +18,15 @@ jobs:
2118
uses: actions/checkout@v4
2219
with:
2320
fetch-depth: 0
24-
21+
- name: 'Enable corepack'
22+
run: corepack enable
2523
- uses: actions/setup-node@v4
2624
with:
27-
node-version: 20
25+
node-version: 22
26+
cache: 'yarn'
2827

29-
- uses: bahmutov/npm-install@v1
30-
with:
31-
useRollingCache: true
32-
install-command: yarn --frozen-lockfile
28+
- name: "Install dependencies"
29+
run: yarn install --immutable
3330

3431
- name: "Lint"
3532
run: yarn lint -f @react-hookz/gha
@@ -42,22 +39,19 @@ jobs:
4239
uses: actions/checkout@v4
4340
with:
4441
fetch-depth: 0
45-
42+
- name: 'Enable corepack'
43+
run: corepack enable
4644
- uses: actions/setup-node@v4
4745
with:
48-
node-version: 20
46+
node-version: 22
47+
cache: 'yarn'
4948

50-
- uses: bahmutov/npm-install@v1
51-
with:
52-
useRollingCache: true
53-
install-command: yarn --frozen-lockfile
49+
- name: "Install dependencies"
50+
run: yarn install --immutable
5451

5552
- name: "Build"
5653
run: yarn build
5754

58-
- name: "Tests against built package"
59-
run: yarn test
60-
6155
test:
6256
name: "Test"
6357
runs-on: ubuntu-latest
@@ -66,24 +60,32 @@ jobs:
6660
uses: actions/checkout@v4
6761
with:
6862
fetch-depth: 0
69-
63+
- name: 'Enable corepack'
64+
run: corepack enable
7065
- uses: actions/setup-node@v4
7166
with:
72-
node-version: 20
67+
node-version: 22
68+
cache: 'yarn'
7369

74-
- uses: bahmutov/npm-install@v1
75-
with:
76-
useRollingCache: true
77-
install-command: yarn --frozen-lockfile
70+
- name: "Install dependencies"
71+
run: yarn install --immutable
7872

7973
- name: "Test"
80-
run: yarn build:clean && yarn test:coverage --testLocationInResults --reporters=default --reporters=@jamesacarr/jest-reporter-github-actions
74+
run: yarn test:coverage --reporter='github-actions' --reporter='junit' --outputFile='./coverage/test-report.junit.xml' --reporter=default
8175

8276
- name: "Upload coverage to Codecov"
83-
uses: codecov/codecov-action@v4
77+
uses: codecov/codecov-action@v5
8478
with:
8579
token: ${{ secrets.CODECOV_TOKEN }}
86-
files: coverage/lcov.info
80+
files: coverage/test-report.junit.xml
81+
fail_ci_if_error: true
82+
83+
- name: "Upload test results to Codecov"
84+
if: ${{ !cancelled() }}
85+
uses: codecov/test-results-action@v1
86+
with:
87+
token: ${{ secrets.CODECOV_TOKEN }}
88+
files: coverage/test-report.junit.xml
8789
fail_ci_if_error: true
8890

8991
dependabot-merge:
@@ -98,7 +100,6 @@ jobs:
98100
- uses: fastify/github-action-merge-dependabot@v3
99101
with:
100102
github-token: ${{ secrets.GITHUB_TOKEN }}
101-
target: 'minor'
102103

103104
semantic-release:
104105
name: "Release"
@@ -111,26 +112,28 @@ jobs:
111112
- name: "Checkout"
112113
uses: actions/checkout@v4
113114
with:
114-
fetch-depth: 0
115-
115+
ref: "master"
116+
- name: 'Enable corepack'
117+
run: corepack enable
116118
- uses: actions/setup-node@v4
117119
with:
118-
node-version: 20
120+
node-version: 22
121+
cache: 'yarn'
119122

120-
- uses: bahmutov/npm-install@v1
121-
with:
122-
useRollingCache: true
123-
install-command: yarn --frozen-lockfile
123+
- name: Install dependencies
124+
run: yarn install --immutable
124125

125-
- name: "Build package"
126+
- name: "disable postinstall"
127+
run: yarn pinst --disable
128+
129+
- name: "Build"
126130
run: yarn build
127131

128132
- name: "Release"
129-
id: "release"
130-
uses: codfish/[email protected]
131133
env:
132134
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
133135
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
136+
run: yarn semantic-release
134137

135138
gen-contributors:
136139
name: "Generate Contributors List"

.gitignore

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
/.idea
2-
node_modules
1+
.idea
2+
3+
yarn-error.log
4+
.yarn/*
5+
!.yarn/cache
6+
!.yarn/patches
7+
!.yarn/plugins
8+
!.yarn/releases
9+
!.yarn/sdks
10+
!.yarn/versions
11+
312
/coverage
4-
/src/**/*.js
5-
/src/**/*.d.ts
13+
/node_modules
14+
/dist

.husky/commit-msg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
41
if [ "$CI" = "true" ]
52
then
63
# disable commitlint for CI environments
74
exit 0
85
else
9-
echo "Exists"
6+
yarn commitlint --edit
107
fi

.lintstagedrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{js,ts}": "yarn lint:fix",
3+
"*.mdx?": "yarn lint:fix"
4+
}

.npmignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
*
2-
!/src/**/*.js
3-
!/src/**/*.d.ts
2+
!/dist

.prettierrc.cjs

Lines changed: 0 additions & 3 deletions
This file was deleted.

.releaserc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"branches": [
3+
"master"
4+
],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
"@semantic-release/npm",
9+
"@semantic-release/github"
10+
]
11+
}

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

0 commit comments

Comments
 (0)