Skip to content

Commit

Permalink
feat: migration towards vitest (#1574)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xobotyi authored Dec 23, 2024
1 parent d8f8e67 commit f5bdf3d
Show file tree
Hide file tree
Showing 353 changed files with 13,887 additions and 20,321 deletions.
8 changes: 8 additions & 0 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const config = {
extends: ['@commitlint/config-conventional'],
rules: {
'footer-max-line-length': [1, 'always', 72],
},
};

export default config;
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

52 changes: 0 additions & 52 deletions .eslintrc.cjs

This file was deleted.

79 changes: 41 additions & 38 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ on:
- master
workflow_dispatch:

env:
HUSKY: 0

jobs:
lint:
name: "Lint"
Expand All @@ -21,15 +18,15 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Enable corepack'
run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: 'yarn'

- uses: bahmutov/npm-install@v1
with:
useRollingCache: true
install-command: yarn --frozen-lockfile
- name: "Install dependencies"
run: yarn install --immutable

- name: "Lint"
run: yarn lint -f @react-hookz/gha
Expand All @@ -42,22 +39,19 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Enable corepack'
run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: 'yarn'

- uses: bahmutov/npm-install@v1
with:
useRollingCache: true
install-command: yarn --frozen-lockfile
- name: "Install dependencies"
run: yarn install --immutable

- name: "Build"
run: yarn build

- name: "Tests against built package"
run: yarn test

test:
name: "Test"
runs-on: ubuntu-latest
Expand All @@ -66,24 +60,32 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 'Enable corepack'
run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: 'yarn'

- uses: bahmutov/npm-install@v1
with:
useRollingCache: true
install-command: yarn --frozen-lockfile
- name: "Install dependencies"
run: yarn install --immutable

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

- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
files: coverage/test-report.junit.xml
fail_ci_if_error: true

- name: "Upload test results to Codecov"
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/test-report.junit.xml
fail_ci_if_error: true

dependabot-merge:
Expand All @@ -98,7 +100,6 @@ jobs:
- uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
target: 'minor'

semantic-release:
name: "Release"
Expand All @@ -111,26 +112,28 @@ jobs:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0

ref: "master"
- name: 'Enable corepack'
run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: 'yarn'

- uses: bahmutov/npm-install@v1
with:
useRollingCache: true
install-command: yarn --frozen-lockfile
- name: Install dependencies
run: yarn install --immutable

- name: "Build package"
- name: "disable postinstall"
run: yarn pinst --disable

- name: "Build"
run: yarn build

- name: "Release"
id: "release"
uses: codfish/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release

gen-contributors:
name: "Generate Contributors List"
Expand Down
17 changes: 13 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
/.idea
node_modules
.idea

yarn-error.log
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

/coverage
/src/**/*.js
/src/**/*.d.ts
/node_modules
/dist
5 changes: 1 addition & 4 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

if [ "$CI" = "true" ]
then
# disable commitlint for CI environments
exit 0
else
echo "Exists"
yarn commitlint --edit
fi
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,ts}": "yarn lint:fix",
"*.mdx?": "yarn lint:fix"
}
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
*
!/src/**/*.js
!/src/**/*.d.ts
!/dist
3 changes: 0 additions & 3 deletions .prettierrc.cjs

This file was deleted.

11 changes: 11 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"branches": [
"master"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github"
]
}
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
Loading

0 comments on commit f5bdf3d

Please sign in to comment.