Skip to content

Commit f8b466e

Browse files
committed
chore: migrate to kcd-scripts
1 parent e61fa80 commit f8b466e

29 files changed

+19191
-80
lines changed

Diff for: .babelrc

-12
This file was deleted.

Diff for: .eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
coverage
3+
dist

Diff for: .eslintrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./node_modules/kcd-scripts/eslint.js",
3+
"rules": {
4+
"max-lines-per-function": "off",
5+
"no-constant-condition": "off",
6+
"no-await-in-loop": "off"
7+
}
8+
}

Diff for: .gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

Diff for: .github/workflows/validate.yml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: validate
2+
on:
3+
push:
4+
branches:
5+
- '+([0-9])?(.{+([0-9]),x}).x'
6+
- 'main'
7+
- 'next'
8+
- 'next-major'
9+
- 'beta'
10+
- 'alpha'
11+
- '!all-contributors/**'
12+
pull_request: {}
13+
jobs:
14+
main:
15+
# ignore all-contributors PRs
16+
if: ${{ !contains(github.head_ref, 'all-contributors') }}
17+
strategy:
18+
matrix:
19+
node: [10.13, 12, 14, 15]
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: 🛑 Cancel Previous Runs
23+
uses: styfle/[email protected]
24+
with:
25+
access_token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: ⬇️ Checkout repo
28+
uses: actions/checkout@v2
29+
30+
- name: ⎔ Setup node
31+
uses: actions/setup-node@v1
32+
with:
33+
node-version: ${{ matrix.node }}
34+
35+
- name: 📥 Download deps
36+
uses: bahmutov/npm-install@v1
37+
with:
38+
useLockFile: false
39+
40+
- name: ▶️ Run validate script
41+
run: npm run validate
42+
43+
- name: ⬆️ Upload coverage report
44+
uses: codecov/codecov-action@v1
45+
46+
release:
47+
needs: main
48+
runs-on: ubuntu-latest
49+
if:
50+
${{ github.repository == 'testing-library/react-hooks-testing-library' &&
51+
contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha',
52+
github.ref) && github.event_name == 'push' }}
53+
steps:
54+
- name: 🛑 Cancel Previous Runs
55+
uses: styfle/[email protected]
56+
with:
57+
access_token: ${{ secrets.GITHUB_TOKEN }}
58+
59+
- name: ⬇️ Checkout repo
60+
uses: actions/checkout@v2
61+
62+
- name: ⎔ Setup node
63+
uses: actions/setup-node@v1
64+
with:
65+
node-version: 14
66+
67+
- name: 📥 Download deps
68+
uses: bahmutov/npm-install@v1
69+
with:
70+
useLockFile: false
71+
72+
- name: 🏗 Run build script
73+
run: npm run build
74+
75+
- name: 🚀 Release
76+
uses: cycjimmy/semantic-release-action@v2
77+
with:
78+
semantic_version: 17
79+
branches: |
80+
[
81+
'+([0-9])?(.{+([0-9]),x}).x',
82+
'main',
83+
'next',
84+
'next-major',
85+
{name: 'beta', prerelease: true},
86+
{name: 'alpha', prerelease: true}
87+
]
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
node_modules
22
coverage
3-
lib
3+
dist
44
.docz
55
site

Diff for: .huskyrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('kcd-scripts/husky')

Diff for: .prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
coverage
3+
dist

Diff for: .prettierrc.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
printWidth: 100,
3+
semi: false,
4+
singleQuote: true,
5+
arrowParens: 'always',
6+
proseWrap: 'always',
7+
trailingComma: 'none',
8+
}

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CHANGELOG
2+
3+
The changelog is automatically updated using
4+
[semantic-release](https://github.com/semantic-release/semantic-release). You
5+
can see it on the [releases page](../../releases).

Diff for: other/MAINTAINING.md

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Maintaining
2+
3+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
4+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
5+
6+
**Table of Contents**
7+
8+
- [Code of Conduct](#code-of-conduct)
9+
- [Issues](#issues)
10+
- [Pull Requests](#pull-requests)
11+
- [Release](#release)
12+
- [Thanks!](#thanks)
13+
14+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
15+
16+
This is documentation for maintainers of this project.
17+
18+
## Code of Conduct
19+
20+
Please review, understand, and be an example of it. Violations of the code of
21+
conduct are taken seriously, even (especially) for maintainers.
22+
23+
## Issues
24+
25+
We want to support and build the community. We do that best by helping people
26+
learn to solve their own problems. We have an issue template and hopefully most
27+
folks follow it. If it's not clear what the issue is, invite them to create a
28+
minimal reproduction of what they're trying to accomplish or the bug they think
29+
they've found.
30+
31+
Once it's determined that a code change is necessary, point people to
32+
[makeapullrequest.com](https://makeapullrequest.com) and invite them to make a
33+
pull request. If they're the one who needs the feature, they're the one who can
34+
build it. If they need some hand holding and you have time to lend a hand,
35+
please do so. It's an investment into another human being, and an investment
36+
into a potential maintainer.
37+
38+
Remember that this is open source, so the code is not yours, it's ours. If
39+
someone needs a change in the codebase, you don't have to make it happen
40+
yourself. Commit as much time to the project as you want/need to. Nobody can ask
41+
any more of you than that.
42+
43+
## Pull Requests
44+
45+
As a maintainer, you're fine to make your branches on the main repo or on your
46+
own fork. Either way is fine.
47+
48+
When we receive a pull request, a GitHub Action is kicked off automatically (see
49+
the `.github/workflows/validate.yml` for what runs in the Action). We avoid
50+
merging anything that breaks the GitHub Action.
51+
52+
Please review PRs and focus on the code rather than the individual. You never
53+
know when this is someone's first ever PR and we want their experience to be as
54+
positive as possible, so be uplifting and constructive.
55+
56+
When you merge the pull request, 99% of the time you should use the
57+
[Squash and merge](https://help.github.com/articles/merging-a-pull-request/)
58+
feature. This keeps our git history clean, but more importantly, this allows us
59+
to make any necessary changes to the commit message so we release what we want
60+
to release. See the next section on Releases for more about that.
61+
62+
## Release
63+
64+
Our releases are automatic. They happen whenever code lands into `main`. A
65+
GitHub Action gets kicked off and if it's successful, a tool called
66+
[`semantic-release`](https://github.com/semantic-release/semantic-release) is
67+
used to automatically publish a new release to npm as well as a changelog to
68+
GitHub. It is only able to determine the version and whether a release is
69+
necessary by the git commit messages. With this in mind, **please brush up on
70+
[the commit message convention][commit] which drives our releases.**
71+
72+
> One important note about this: Please make sure that commit messages do NOT
73+
> contain the words "BREAKING CHANGE" in them unless we want to push a major
74+
> version. I've been burned by this more than once where someone will include
75+
> "BREAKING CHANGE: None" and it will end up releasing a new major version. Not
76+
> a huge deal honestly, but kind of annoying...
77+
78+
## Thanks!
79+
80+
Thank you so much for helping to maintain this project!
81+
82+
<!-- prettier-ignore-start -->
83+
[commit]: https://github.com/conventional-changelog-archived-repos/conventional-changelog-angular/blob/ed32559941719a130bb0327f886d6a32a8cbc2ba/convention.md
84+
<!-- prettier-ignore-end -->

Diff for: other/USERS.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Users
2+
3+
If you or your company uses this project, add your name to this list! Eventually
4+
we may have a website to showcase these (wanna build it!?)
5+
6+
> No users have been added yet!
7+
8+
<!--
9+
This file should just be a bulleted list like this:
10+
11+
- [Company/Project/Person](https://example.com) uses it in [some app](https://example.com)
12+
-->

Diff for: other/manual-releases.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# manual-releases
2+
3+
This project has an automated release set up. So things are only released when
4+
there are useful changes in the code that justify a release. But sometimes
5+
things get messed up one way or another and we need to trigger the release
6+
ourselves. When this happens, simply bump the number below and commit that with
7+
the following commit message based on your needs:
8+
9+
**Major**
10+
11+
```
12+
fix(release): manually release a major version
13+
14+
There was an issue with a major release, so this manual-releases.md
15+
change is to release a new major version.
16+
17+
Reference: #<the number of a relevant pull request, issue, or commit>
18+
19+
BREAKING CHANGE: <mention any relevant breaking changes (this is what triggers the major version change so don't skip this!)>
20+
```
21+
22+
**Minor**
23+
24+
```
25+
feat(release): manually release a minor version
26+
27+
There was an issue with a minor release, so this manual-releases.md
28+
change is to release a new minor version.
29+
30+
Reference: #<the number of a relevant pull request, issue, or commit>
31+
```
32+
33+
**Patch**
34+
35+
```
36+
fix(release): manually release a patch version
37+
38+
There was an issue with a patch release, so this manual-releases.md
39+
change is to release a new patch version.
40+
41+
Reference: #<the number of a relevant pull request, issue, or commit>
42+
```
43+
44+
The number of times we've had to do a manual release is: 0

Diff for: package.json

+10-55
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@testing-library/react-hooks",
33
"version": "3.4.2",
44
"description": "Simple and complete React hooks testing utilities that encourage good testing practices.",
5-
"main": "lib/index.js",
5+
"main": "dist/index.js",
66
"keywords": [
77
"testing",
88
"react",
@@ -11,7 +11,7 @@
1111
"integration"
1212
],
1313
"files": [
14-
"lib",
14+
"dist",
1515
"src",
1616
"pure.js",
1717
"dont-cleanup-after-each.js"
@@ -23,80 +23,35 @@
2323
},
2424
"license": "MIT",
2525
"scripts": {
26+
"setup": "npm install && npm run validate -s",
27+
"validate": "kcd-scripts validate",
2628
"prepare": "npm run build",
27-
"build": "babel --out-dir lib src",
29+
"build": "kcd-scripts build",
2830
"format": "prettier-eslint --write \"**/*.{js,ts,json,yml,md,mdx}\"",
2931
"coverage": "codecov",
30-
"test": "jest",
31-
"test:ci": "npm run test && npm run coverage",
32+
"test": "kcd-scripts test",
33+
"test:update": "npm test -- --updateSnapshot --coverage",
3234
"docs:dev": "docz dev",
3335
"docs:build": "docz build",
3436
"contributors:add": "all-contributors add"
3537
},
3638
"dependencies": {
37-
"@babel/runtime": "^7.5.4",
38-
"@types/testing-library__react-hooks": "^3.4.0"
39+
"@babel/runtime": "^7.12.5"
3940
},
4041
"devDependencies": {
41-
"@babel/cli": "7.12.8",
42-
"@babel/core": "7.12.9",
43-
"@babel/plugin-proposal-object-rest-spread": "7.12.1",
44-
"@babel/plugin-transform-modules-commonjs": "7.12.1",
45-
"@babel/plugin-transform-runtime": "7.12.1",
46-
"@babel/preset-env": "7.12.7",
47-
"@babel/preset-react": "7.12.7",
42+
"@types/jest": "^26.0.15",
43+
"kcd-scripts": "^7.2.0",
4844
"all-contributors-cli": "6.19.0",
4945
"babel-eslint": "10.1.0",
5046
"babel-plugin-module-resolver": "4.0.0",
5147
"codecov": "3.8.1",
5248
"docz": "2.3.1",
5349
"docz-theme-default": "1.2.0",
54-
"eslint": "7.14.0",
55-
"eslint-config-prettier": "6.15.0",
56-
"eslint-plugin-prettier": "3.2.0",
57-
"husky": "4.3.0",
58-
"jest": "26.6.3",
59-
"lint-staged": "10.5.2",
60-
"prettier": "2.2.1",
61-
"prettier-eslint": "12.0.0",
62-
"prettier-eslint-cli": "5.0.0",
6350
"react": "17.0.1",
6451
"react-test-renderer": "17.0.1"
6552
},
6653
"peerDependencies": {
6754
"react": ">=16.9.0",
6855
"react-test-renderer": ">=16.9.0"
69-
},
70-
"jest": {
71-
"collectCoverage": true,
72-
"coverageDirectory": "./coverage/",
73-
"collectCoverageFrom": [
74-
"**/src/**"
75-
],
76-
"testURL": "http://localhost/"
77-
},
78-
"prettier": {
79-
"printWidth": 100,
80-
"semi": false,
81-
"singleQuote": true,
82-
"arrowParens": "always",
83-
"proseWrap": "always",
84-
"trailingComma": "none"
85-
},
86-
"eslintConfig": {
87-
"extends": [
88-
"plugin:prettier/recommended"
89-
],
90-
"parser": "babel-eslint"
91-
},
92-
"husky": {
93-
"hooks": {
94-
"pre-commit": "lint-staged"
95-
}
96-
},
97-
"lint-staged": {
98-
"*.{js,ts,json,yml,md,mdx}": [
99-
"prettier-eslint --write"
100-
]
10156
}
10257
}

0 commit comments

Comments
 (0)