Skip to content

chore: migrate to kcd #502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Dec 6, 2020
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
12 changes: 0 additions & 12 deletions .babelrc

This file was deleted.

5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
coverage
lib
.docz
site
10 changes: 10 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "./node_modules/kcd-scripts/eslint.js",
"rules": {
"max-lines-per-function": "off",
"no-constant-condition": "off",
"no-await-in-loop": "off",
"react-hooks/rules-of-hooks": "off",
"no-console": "off"
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/---feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: "I have a suggestion (and might want to implement myself \U0001F642)!"
title: ''
labels: enhancement
assignees: ''

---

<!--
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: validate
on:
push:
branches:
- '+([0-9])?(.{+([0-9]),x}).x'
- 'main'
- 'next'
- 'next-major'
- 'beta'
- 'alpha'
- '!all-contributors/**'
pull_request: {}
jobs:
main:
# ignore all-contributors PRs
if: ${{ !contains(github.head_ref, 'all-contributors') }}
strategy:
matrix:
node: [10.13, 12, 14, 15]
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

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

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

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: ▶️ Run validate script
run: npm run validate

- name: ⬆️ Upload coverage report
uses: codecov/codecov-action@v1

release:
needs: main
runs-on: ubuntu-latest
if:
${{ github.repository == 'testing-library/react-hooks-testing-library' &&
contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha',
github.ref) && github.event_name == 'push' }}
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

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

- name: ⎔ Setup node
uses: actions/setup-node@v1
with:
node-version: 14

- name: 📥 Download deps
uses: bahmutov/npm-install@v1
with:
useLockFile: false

- name: 🏗 Run build script
run: npm run build

- name: 🚀 Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'next',
'next-major',
{name: 'beta', prerelease: true},
{name: 'alpha', prerelease: true}
]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .huskyrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('kcd-scripts/husky')
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
coverage
lib
.docz
site
8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
printWidth: 100,
semi: false,
singleQuote: true,
arrowParens: 'always',
proseWrap: 'always',
trailingComma: 'none'
}
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CHANGELOG

The changelog is automatically updated using
[semantic-release](https://github.com/semantic-release/semantic-release). You can see it on the
[releases page](../../releases).
8 changes: 4 additions & 4 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ further defined and clarified by project maintainers.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting
the project team at mpeyper7@gmail.com. All complaints will be reviewed and investigated and
will result in a response that is deemed necessary and appropriate to the circumstances. The project
team is obligated to maintain confidentiality with regard to the reporter of an incident. Further
details of specific enforcement policies may be posted separately.
the project team at mpeyper7@gmail.com. All complaints will be reviewed and investigated and will
result in a response that is deemed necessary and appropriate to the circumstances. The project team
is obligated to maintain confidentiality with regard to the reporter of an incident. Further details
of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face
temporary or permanent repercussions as determined by other members of the project's leadership.
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Please make sure to run the tests before you commit your changes. You can do so

### Update Typings

The TypeScript type definitions can be found in the [DefinitelyTyped repo](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/testing-library__react-hooks).
The TypeScript type definitions can be found in the
[DefinitelyTyped repo](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/testing-library__react-hooks).

## Help needed

Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [react-hooks-testing-library](#react-hooks-testing-library)
- [The problem](#the-problem)
- [The solution](#the-solution)
- [When to use this library](#when-to-use-this-library)
- [When not to use this library](#when-not-to-use-this-library)
- [Example](#example)
- [`useCounter.js`](#usecounterjs)
- [`useCounter.test.js`](#usecountertestjs)
- [Installation](#installation)
- [Peer Dependencies](#peer-dependencies)
- [API](#api)
- [Contributors](#contributors)
- [Issues](#issues)
- [🐛 Bugs](#-bugs)
- [💡 Feature Requests](#-feature-requests)
- [❓ Questions](#-questions)
- [LICENSE](#license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

<div align="center">
<h1>react-hooks-testing-library</h1>

Expand All @@ -6,7 +29,7 @@
height="80"
width="80"
alt="ram"
src="https://raw.githubusercontent.com/testing-library/react-hooks-testing-library/master/other/ram.png"
src="https://raw.githubusercontent.com/testing-library/react-hooks-testing-library/master/public/ram.png"
/>
</a>

Expand Down
6 changes: 3 additions & 3 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ function waitForValueToChange(selector: function(): any, options?: {
}): Promise<void>
```

Returns a `Promise` that resolves if the value returned from the provided selector changes. It is
expected that the [`result` of `renderHook`](/reference/api#result) will be used to select the
value for comparison.
Returns a `Promise` that resolves if the value returned from the provided selector changes. It is
expected that the [`result` of `renderHook`](/reference/api#result) will be used to select the value
for comparison.

#### `interval`

Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ route: '/'
height="80"
width="80"
alt="ram"
src="https://raw.githubusercontent.com/mpeyper/react-hooks-testing-library/master/other/ram.png"
src="https://raw.githubusercontent.com/mpeyper/react-hooks-testing-library/master/public/ram.png"
/>
</a>

Expand Down
2 changes: 1 addition & 1 deletion doczrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default {
files: '**/*.{md,mdx}',
src: 'docs',
dest: 'site',
public: './other',
public: './public',
ignore: ['CODE_OF_CONDUCT.md', 'CONTRIBUTING.md', 'LICENSE.md'],
htmlContext: {
favicon: '/public/ram.png'
Expand Down
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { jest: jestConfig } = require('kcd-scripts/config')

module.exports = Object.assign(jestConfig, {
roots: ['<rootDir>/src', '<rootDir>/test'],
testMatch: ['<rootDir>/test/*.js']
})
78 changes: 78 additions & 0 deletions other/MAINTAINING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Maintaining

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

**Table of Contents**

- [Code of Conduct](#code-of-conduct)
- [Issues](#issues)
- [Pull Requests](#pull-requests)
- [Release](#release)
- [Thanks!](#thanks)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

This is documentation for maintainers of this project.

## Code of Conduct

Please review, understand, and be an example of it. Violations of the code of conduct are taken
seriously, even (especially) for maintainers.

## Issues

We want to support and build the community. We do that best by helping people learn to solve their
own problems. We have an issue template and hopefully most folks follow it. If it's not clear what
the issue is, invite them to create a minimal reproduction of what they're trying to accomplish or
the bug they think they've found.

Once it's determined that a code change is necessary, point people to
[makeapullrequest.com](https://makeapullrequest.com) and invite them to make a pull request. If
they're the one who needs the feature, they're the one who can build it. If they need some hand
holding and you have time to lend a hand, please do so. It's an investment into another human being,
and an investment into a potential maintainer.

Remember that this is open source, so the code is not yours, it's ours. If someone needs a change in
the codebase, you don't have to make it happen yourself. Commit as much time to the project as you
want/need to. Nobody can ask any more of you than that.

## Pull Requests

As a maintainer, you're fine to make your branches on the main repo or on your own fork. Either way
is fine.

When we receive a pull request, a GitHub Action is kicked off automatically (see the
`.github/workflows/validate.yml` for what runs in the Action). We avoid merging anything that breaks
the GitHub Action.

Please review PRs and focus on the code rather than the individual. You never know when this is
someone's first ever PR and we want their experience to be as positive as possible, so be uplifting
and constructive.

When you merge the pull request, 99% of the time you should use the
[Squash and merge](https://help.github.com/articles/merging-a-pull-request/) feature. This keeps our
git history clean, but more importantly, this allows us to make any necessary changes to the commit
message so we release what we want to release. See the next section on Releases for more about that.

## Release

Our releases are automatic. They happen whenever code lands into `main`. A GitHub Action gets kicked
off and if it's successful, a tool called
[`semantic-release`](https://github.com/semantic-release/semantic-release) is used to automatically
publish a new release to npm as well as a changelog to GitHub. It is only able to determine the
version and whether a release is necessary by the git commit messages. With this in mind, **please
brush up on [the commit message convention][commit] which drives our releases.**

> One important note about this: Please make sure that commit messages do NOT contain the words
> "BREAKING CHANGE" in them unless we want to push a major version. I've been burned by this more
> than once where someone will include "BREAKING CHANGE: None" and it will end up releasing a new
> major version. Not a huge deal honestly, but kind of annoying...

## Thanks!

Thank you so much for helping to maintain this project!

<!-- prettier-ignore-start -->
[commit]: https://github.com/conventional-changelog-archived-repos/conventional-changelog-angular/blob/ed32559941719a130bb0327f886d6a32a8cbc2ba/convention.md
<!-- prettier-ignore-end -->
43 changes: 43 additions & 0 deletions other/manual-releases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# manual-releases

This project has an automated release set up. So things are only released when there are useful
changes in the code that justify a release. But sometimes things get messed up one way or another
and we need to trigger the release ourselves. When this happens, simply bump the number below and
commit that with the following commit message based on your needs:

**Major**

```
fix(release): manually release a major version

There was an issue with a major release, so this manual-releases.md
change is to release a new major version.

Reference: #<the number of a relevant pull request, issue, or commit>

BREAKING CHANGE: <mention any relevant breaking changes (this is what triggers the major version change so don't skip this!)>
```

**Minor**

```
feat(release): manually release a minor version

There was an issue with a minor release, so this manual-releases.md
change is to release a new minor version.

Reference: #<the number of a relevant pull request, issue, or commit>
```

**Patch**

```
fix(release): manually release a patch version

There was an issue with a patch release, so this manual-releases.md
change is to release a new patch version.

Reference: #<the number of a relevant pull request, issue, or commit>
```

The number of times we've had to do a manual release is: 0
Loading