Skip to content

Commit 427fced

Browse files
committed
docs: update documentation
1 parent bfd3f3c commit 427fced

File tree

3 files changed

+88
-59
lines changed

3 files changed

+88
-59
lines changed

CONTRIBUTING.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ series [How to Contribute to an Open Source Project on GitHub][egghead]
88
## Project Setup
99

1010
1. Fork and clone the repo.
11-
2. `$ npm install` to install dependencies.
12-
3. `$ npm run validate` to validate you've got it working.
11+
2. `$ npm ci` to install dependencies without affecting the `package-lock.json`
12+
file.
13+
3. `$ npm run test` to validate you've got it working.
1314
4. Create a branch for your PR.
1415

1516
> Tip: Keep your `master` branch pointing at the original repository and make
@@ -29,15 +30,21 @@ series [How to Contribute to an Open Source Project on GitHub][egghead]
2930
3031
## Committing and Pushing Changes
3132
32-
Please make sure to run the tests before you commit your changes. You can run
33-
`npm run test:update` which will update any snapshots that need updating. Make
34-
sure to include those changes (if they exist) in your commit.
33+
Please make sure to run the unit _and integration_ tests before you send your
34+
PR. You can do so by running `npm run test:all`, which will run all possible
35+
tests. On some Windows/WSL systems, the concurrent integration tests can be
36+
unstable, so set the environment variable `NO_CONCURRENT=true` to run the tests
37+
serially (which will be slow) if you encounter strange errors.
38+
39+
Also, this project comes with Husky git hooks that run unit tests, linters, and
40+
formatters on the source before each commit. To prevent your contributions from
41+
being rejected, avoid circumventing these git hooks.
3542
3643
## Help Needed
3744
38-
Please checkout the [the open issues][issues]
45+
Please checkout the [the open issues][issues].
3946
40-
Also, please watch the repo and respond to questions/bug reports/feature
47+
Also, please watch the repo and respond to questions, bug reports, and feature
4148
requests! Thanks!
4249
4350
<!-- prettier-ignore-start -->

MAINTAINING.md

+72-50
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ This is documentation for maintainers of this project.
44

55
## Code of Conduct
66

7-
Please review, understand, and be an example of it. Violations of the code of
8-
conduct are taken seriously, even (especially) for maintainers.
7+
Please [review][1], understand, and be an example of it. Violations of the code
8+
of conduct are taken seriously, even (especially) for maintainers.
99

1010
## Issues
1111

@@ -16,7 +16,7 @@ minimal reproduction of what they're trying to accomplish or the bug they think
1616
they've found.
1717

1818
Once it's determined that a code change is necessary, point people to
19-
[makeapullrequest.com][1] and invite them to make a pull request. If they're the
19+
[makeapullrequest.com][2] and invite them to make a pull request. If they're the
2020
one who needs the feature, they're the one who can build it. If they need some
2121
hand holding and you have time to lend a hand, please do so. It's an investment
2222
into another human being, and an investment into a potential maintainer.
@@ -32,79 +32,90 @@ As a maintainer, you're fine to make your branches on the main repo or on your
3232
own fork. Either way is fine.
3333

3434
When we receive a pull request, a GitHub Actions build is kicked off
35-
automatically (see [`.github/workflows`][2]). We avoid merging anything that
35+
automatically (see [`.github/workflows`][3]). We avoid merging anything that
3636
fails the Actions workflow.
3737

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

42-
When you merge the pull request, 99% of the time you should use the [Squash and
43-
merge][3] feature. This keeps our git history clean, but more importantly, this
44-
allows us to make any necessary changes to the commit message so we release what
45-
we want to release. See the next section on Releases for more about that.
42+
When you merge the pull request, 99% of the time you should use the [rebase and
43+
merge][4] feature. This keeps our git history clean. If commit messages need to
44+
be adjusted, maintainers should force push new commits with adjusted messages to
45+
the PR branch before merging it in.
46+
47+
The [squash and merge][5] feature can also be used, but keep in mind that
48+
squashing commits will likely damage the [generated][6] [CHANGELOG.md][7],
49+
hinder [bisection][8], and result in [non-atomic commits][9], so use it
50+
sparingly.
4651

4752
## Release
4853

4954
Our releases are automatic. They happen whenever code lands into `master`. A
50-
GitHub Actions build gets kicked off and if it's successful, a tool called
51-
[`semantic-release`][4] is used to automatically publish a new release to npm as
52-
well as a changelog to GitHub. It is only able to determine the version and
53-
whether a release is necessary by the git commit messages. With this in mind,
54-
**please brush up on [the commit message convention][commit] which drives our
55-
releases.**
56-
57-
> One important note about this: Please make sure that commit messages do NOT
55+
GitHub Actions build gets kicked off and, if it's successful, a tool called
56+
[`semantic-release`][10] is used to automatically publish a new release to npm
57+
and GitHub along with an updated changelog. It is only able to determine the
58+
version and whether a release is necessary by the git commit messages. With this
59+
in mind, **please brush up on [the commit message convention][commit] which
60+
drives our releases.**
61+
62+
> One important note about this: please make sure that commit messages do NOT
5863
> contain the words "BREAKING CHANGE" in them unless we want to push a major
5964
> version. I've been burned by this more than once where someone will include
60-
> "BREAKING CHANGE: None" and it will end up releasing a new major version. Not
61-
> a huge deal honestly, but kind of annoying...
65+
> "BREAKING CHANGE: None" and it will end up releasing a new major version. Do
66+
> not do this!
6267
6368
### Manual Releases
6469

65-
This project has an automated release set up. So things are only released when
66-
there are useful changes in the code that justify a release. But sometimes
67-
things get messed up one way or another and we need to trigger the release
68-
ourselves. When this happens, simply bump the number below and commit that with
69-
the following commit message based on your needs:
70+
This project has an automated release set up. That means things are only
71+
released when there are useful changes in the code that justify a release. See
72+
[the release rules][11] for a list of commit types that trigger releases.
7073

71-
#### Major
74+
However, sometimes things get messed up (e.g. CI workflow / GitHub Actions
75+
breaks) and we need to trigger a release ourselves. When this happens,
76+
semantic-release can be triggered locally by following these steps:
7277

73-
```text
74-
fix(release): manually release a major version
78+
> If one of these steps fails, you should address the failure before running the
79+
> next step.
7580
76-
There was an issue with a major release, so this manual-releases.md
77-
change is to release a new major version.
81+
```bash
82+
# These command must be run from the project root
7883

79-
Reference: #<the number of a relevant pull request, issue, or commit>
84+
# 1. Setup the local environment. Add your auth tokens to this file
85+
# ! DO NOT COMMIT THIS FILE !
86+
cp .env.default .env
8087

81-
BREAKING CHANGE: <mention any relevant breaking changes (this is what triggers the major version change so don't skip this!)>
82-
```
88+
# 2. Reset the working directory to a clean state (deletes all ignored files)
89+
npm run clean
8390

84-
#### Minor
91+
# 3. Lint all files
92+
npm run lint:all
8593

86-
```text
87-
feat(release): manually release a minor version
94+
# 4. Build distributables
95+
npm run build:dist
8896

89-
There was an issue with a minor release, so this manual-releases.md
90-
change is to release a new minor version.
97+
# 5. Build auxiliary documentation
98+
npm run build:docs
9199

92-
Reference: #<the number of a relevant pull request, issue, or commit>
93-
```
100+
# 6. Build any external executables (used in GitHub Actions workflows)
101+
npm run build:externals
94102

95-
#### Patch
103+
# 7. Format all files
104+
npm run format
96105

97-
```text
98-
fix(release): manually release a patch version
106+
# 8. Run all possible tests and generate coverage information
107+
npm run test:all
99108

100-
There was an issue with a patch release, so this manual-releases.md
101-
change is to release a new patch version.
109+
# 9. Upload coverage information to codecov (only if you have the proper token)
110+
CODECOV_TOKEN=$(npx --yes dotenv-cli -p CODECOV_TOKEN) codecov
102111

103-
Reference: #<the number of a relevant pull request, issue, or commit>
112+
# 10. Trigger semantic-release locally and generate a new release. This requires
113+
# having tokens for NPM and GitHub with the appropriate permissions. This
114+
# command should be run in a clean environment using a user account without a
115+
# home directory (so no ~/.npmrc or ~/.gnupg directories)
116+
NPM_TOKEN=$(npx --yes dotenv-cli -p NPM_TOKEN) GH_TOKEN=$(npx --yes dotenv-cli -p GITHUB_TOKEN) HUSKY=0 UPDATE_CHANGELOG=true GIT_AUTHOR_NAME=$(git config --global --get user.name) GIT_COMMITTER_NAME=$(git config --global --get user.name) GIT_AUTHOR_EMAIL=$(git config --global --get user.email) GIT_COMMITTER_EMAIL=$(git config --global --get user.email) npx --no-install semantic-release --no-ci --extends "$(pwd)/release.config.js"
104117
```
105118

106-
The number of times we've had to do a manual release is: 1
107-
108119
<!-- lint ignore -->
109120

110121
## Thanks!
@@ -113,7 +124,18 @@ Thank you so much for helping to maintain this project!
113124

114125
[commit]:
115126
https://github.com/conventional-changelog-archived-repos/conventional-changelog-angular/blob/ed32559941719a130bb0327f886d6a32a8cbc2ba/convention.md
116-
[1]: http://makeapullrequest.com
117-
[2]: ./.github/workflows
118-
[3]: https://help.github.com/articles/merging-a-pull-request
119-
[4]: https://github.com/semantic-release/semantic-release
127+
[1]: ./.github/CODE_OF_CONDUCT.md
128+
[2]: http://makeapullrequest.com
129+
[3]: ./.github/workflows
130+
[4]:
131+
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#rebase-and-merge-your-commits
132+
[5]:
133+
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits
134+
[6]: https://github.com/conventional-changelog/conventional-changelog
135+
[7]: https://www.conventionalcommits.org/en/v1.0.0
136+
[8]:
137+
https://www.metaltoad.com/blog/beginners-guide-git-bisect-process-elimination
138+
[9]: https://dev.to/paulinevos/atomic-commits-will-help-you-git-legit-35i7
139+
[10]: https://github.com/semantic-release/semantic-release
140+
[11]:
141+
https://github.com/babel-utils/babel-plugin-tester/blob/c13a2e0ff4ea9289d7a79a5da8949c125c636130/release.config.js#L27

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1322,8 +1322,8 @@ pluginTester({
13221322

13231323
### Fixtures Examples
13241324

1325-
See [`fixtures`][39] for an example directory layout or check out some of these
1326-
other projects:
1325+
See [`fixtures`][39] for an example directory layout or check out the use of
1326+
babel-plugin-tester fixtures in some of these other projects:
13271327

13281328
<!-- lint disable list-item-style -->
13291329

0 commit comments

Comments
 (0)