Skip to content

Commit 271aecf

Browse files
authored
Update CONTRIBUTING.md (#1079)
1 parent bc52343 commit 271aecf

File tree

3 files changed

+224
-228
lines changed

3 files changed

+224
-228
lines changed

CONTRIBUTING.md

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,23 @@ Please check out the [the open issues](https://github.com/drwpow/openapi-typescr
1010

1111
Contributing doesn’t have to be in code! Simply answering questions in open issues, or providing workarounds, is just as important a contribution as making pull requests.
1212

13-
## Setup
13+
## Opening a Pull Request
1414

15-
### Dependencies
15+
Pull requests are **welcome** for this repo! Bugfixes will always be accepted, though in some cases some small changes may be requested.
16+
17+
However, if adding a feature or breaking change, please **open an issue first to discuss.** This ensures no time or work is wasted writing code that won’t be accepted to the project (see [Project Goals](./README.md#-project-goals)). Undiscussed feature work may be rejected at the discretion of the maintainers.
18+
19+
### Setup
1620

1721
1. Install [pnpm](https://pnpm.io/)
18-
2. Fork and clone the repo
22+
2. [Fork this repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and clone your copy locally
1923
3. Run `pnpm i` to install dependencies
20-
4. Create a branch for your PR with `git checkout -b pr/your-branch-name`
2124

22-
### VS Code setup
25+
### Writing code
2326

24-
If using VS Code, the following extensions are recommended (or their equivalent extensions if using another editor)
27+
Create a new branch for your PR with `git checkout -b your-branch-name`. Add the relevant code as well as docs and tests. When you push everything up (`git push`), navigate back to your repo GitHub and you should see a prompt to open a new PR.
2528

26-
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
27-
28-
## Workflow
29+
While best practices for commit messages are encouraged (e.g. start with an imperative verb, keep it short, use the body if needed), this repo doesn’t follow any specific guidelines like [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). Clarity is favored over strict rules. Changelogs are generated separately from git (see [the Changelogs section](#changelogs)
2930

3031
When working locally, run:
3132

@@ -35,6 +36,10 @@ npm run dev
3536

3637
This will compile the code as you change automatically.
3738

39+
### Writing the PR
40+
41+
**Please fill out the template!** It’s a very lightweight template 🙂.
42+
3843
### TDD
3944

4045
This library is a great usecase for [test-driven development (TDD)](https://en.wikipedia.org/wiki/Test-driven_development). If you’re new to this, the basic workflow is:
@@ -45,16 +50,6 @@ This library is a great usecase for [test-driven development (TDD)](https://en.w
4550

4651
_Code generation is hard!_ And for that reason, starting with a very clear expectation of your end-goal can make working easier.
4752

48-
### Unit tests or snapshot tests?
49-
50-
This library has both unit tests (tests that test a tiny part of a schema) and snapshot tests (tests that run over an entire, complete schema). When opening a PR, the former are more valuable than the latter, and are always required. However, updating snapshot tests can help with the following:
51-
52-
- Fixing bugs that deal with multiple schemas with remote `$ref`s
53-
- Fixing Node.js or OS-related bugs
54-
- Adding a CLI option that changes the entire output
55-
56-
For most PRs, **snapshot tests can be avoided.** But for scenarios similar to the ones mentioned, they can ensure everything is working as expected.
57-
5853
#### Updating snapshot tests
5954

6055
To add a schema as a snapshot test, modify the [/scripts/download-schemas.ts](/scripts/download-schemas.ts) script with a path to download. There are both single-file schemas as well as multi-file schemas.
@@ -76,6 +71,16 @@ When opening a pull request, make sure all of the following is done:
7671

7772
Lastly, be sure to fill out the complete PR template!
7873

74+
### Changelogs
75+
76+
The changelog is generated via [changesets](https://github.com/changesets/changesets), and is separate from Git commit messages and pull request titles. To write a human-readable changelog for your changes, run:
77+
78+
```
79+
npx changeset
80+
```
81+
82+
This will ask if it’s a `patch`, `minor`, or `major` change ([semver](https://semver.org/)), along with a plain description of what you did. Commit this new file along with the rest of your PR, and during the next release this will go into the official changelog!
83+
7984
## Testing
8085

8186
This library uses [Vitest](https://vitest.dev/) for testing. There’s a great [VS Code extension](https://marketplace.visualstudio.com/items?itemName=ZixuanChen.vitest-explorer) you can optionally use if you’d like in-editor debugging tools.
@@ -93,7 +98,7 @@ npm test
9398
To run an individual test:
9499

95100
```bash
96-
npx vitest [partial filename]
101+
npm test -- [partial filename]
97102
```
98103

99104
To start the entire test suite in watch mode:
@@ -117,3 +122,13 @@ npm run lint
117122
```bash
118123
npm run update:examples
119124
```
125+
126+
### Unit tests or snapshot tests?
127+
128+
This library has both unit tests (tests that test a tiny part of a schema) and snapshot tests (tests that run over an entire, complete schema). When opening a PR, the former are more valuable than the latter, and are always required. However, updating snapshot tests can help with the following:
129+
130+
- Fixing bugs that deal with multiple schemas with remote `$ref`s
131+
- Fixing Node.js or OS-related bugs
132+
- Adding a CLI option that changes the entire output
133+
134+
For most PRs, **snapshot tests can be avoided.** But for scenarios similar to the ones mentioned, they can ensure everything is working as expected.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@
5252
"fast-glob": "^3.2.12",
5353
"js-yaml": "^4.1.0",
5454
"supports-color": "^9.3.1",
55-
"undici": "^5.21.0",
55+
"undici": "^5.22.0",
5656
"yargs-parser": "^21.1.1"
5757
},
5858
"devDependencies": {
5959
"@types/degit": "^2.8.3",
6060
"@types/js-yaml": "^4.0.5",
61-
"@types/node": "^18.15.11",
62-
"@typescript-eslint/eslint-plugin": "^5.57.1",
63-
"@typescript-eslint/parser": "^5.57.1",
61+
"@types/node": "^18.15.12",
62+
"@typescript-eslint/eslint-plugin": "^5.59.0",
63+
"@typescript-eslint/parser": "^5.59.0",
6464
"@vitest/coverage-c8": "^0.29.8",
6565
"degit": "^2.8.4",
6666
"del-cli": "^5.0.0",
67-
"eslint": "^8.37.0",
67+
"eslint": "^8.38.0",
6868
"eslint-config-prettier": "^8.8.0",
6969
"eslint-plugin-prettier": "^4.2.1",
7070
"execa": "^6.1.0",
7171
"prettier": "^2.8.7",
72-
"typescript": "^5.0.3",
73-
"vite": "^4.2.1",
72+
"typescript": "^5.0.4",
73+
"vite": "^4.3.0",
7474
"vite-node": "^0.29.8",
7575
"vitest": "^0.29.8"
7676
}

0 commit comments

Comments
 (0)