|
4 | 4 |
|
5 | 5 | If you have questions about the library, found a bug or want to suggest a feature, please create an issue.
|
6 | 6 |
|
7 |
| -## Development |
| 7 | +## Documentation |
8 | 8 |
|
9 |
| -- Install dependencies: |
| 9 | +You can visit the [docs website](https://json-schema-form.vercel.app/), however its source is not in the repo yet, only the build (`/docs_build`). Our docs are still coupled to Remote's internal Design System and integration tests. The effort to decouple it at the moment is too high. |
| 10 | + |
| 11 | +So our strategy is to at each new PR, to update the docs internally and manually copy its build to this repo. |
| 12 | + |
| 13 | +## Setup |
| 14 | + |
| 15 | +- Install the dependencies: |
10 | 16 |
|
11 | 17 | ```bash
|
12 | 18 | npm ci
|
13 | 19 | ```
|
14 | 20 |
|
15 |
| -- Run tests: |
| 21 | +- Run the tests: |
16 | 22 |
|
17 | 23 | ```
|
18 | 24 | npm test
|
19 | 25 | ```
|
20 | 26 |
|
21 |
| -### Documentation |
| 27 | +## Development workflow |
22 | 28 |
|
23 |
| -You can visit the [docs website](https://json-schema-form.vercel.app/), however its source is not in the repo yet, only the build (`/docs_build`). Our docs are still coupled to Remote's internal Design System and integration tests. The effort to decouple it at the moment is too high. |
| 29 | +### Creating a new branch |
24 | 30 |
|
25 |
| -So our strategy is to at each new PR, to update the docs internally and manually copy its build to this repo. |
| 31 | +Submit your branch pointing to `main`. |
| 32 | + |
| 33 | +Please, always add tests to your bug fixs and new features. |
| 34 | + |
| 35 | +### Testing the PR in your project |
| 36 | + |
| 37 | +#### Local release |
| 38 | + |
| 39 | +The simplest way to test your PR in your project is by installing it locally as a "tarball" version. |
| 40 | + |
| 41 | +1. Run `npm run release:local`, which will create the tarball. It will output a suggest npm command to re-install the package in your project. Example: |
| 42 | + |
| 43 | +``` |
| 44 | + npm un @remoteoss/json-schema-form && npm i -S /Users/kim/Documents/my-repos/json-schema-form/local-0.1.0-beta.0.tgz |
| 45 | +``` |
| 46 | + |
| 47 | +2. Then go to your project and run the command above. |
| 48 | + |
| 49 | +You can re-run this `release:local` as many times as you need. Remember to re-install the package each time a new tarball is created. |
| 50 | + |
| 51 | +#### Public release |
| 52 | + |
| 53 | +If you need a public release (for example, to run it on your project CI), you can publish a `dev` release. |
| 54 | + |
| 55 | +Note that only core maintainers (Remoters) can publish public releases. If needed, ask us in the PR and we'll do it for you. Check #3 for the video walkthrough. |
| 56 | + |
| 57 | +1. Locally run the script `npm run release:dev:patch` or `npm run release:dev:minor` depending on your changes. |
| 58 | + a. You'll be shown what's the new version and prompt you if it's correct. Eg |
| 59 | + |
| 60 | + ``` |
| 61 | + Creating a new dev... |
| 62 | + :: Current version: 1.0.0 |
| 63 | + :::::: New version: 1.0.1-dev.20230516175718 |
| 64 | + Ready to commit and publish it? (y/n) |
| 65 | + |
| 66 | + ``` |
| 67 | + |
| 68 | + b. Then it will ask for the `@remoteoss` OTP for the NPM access to publish it. |
| 69 | + c. Done! 🎉 |
| 70 | + |
| 71 | +Every `dev` release is [tagged as `dev`](https://docs.npmjs.com/cli/v9/commands/npm-publish#tag), which means it won't be automatically installed in your project by default. |
| 72 | +You must specify the exact version, for example: |
| 73 | + |
| 74 | +```bash |
| 75 | +npm i -S @remoteoss/ [email protected] |
| 76 | +``` |
| 77 | + |
| 78 | +You can create as many dev releases as you need during the PRs, by running the same command. |
| 79 | + |
| 80 | +### Merging a PR |
| 81 | + |
| 82 | +A PR needs all CI checks to pass. |
| 83 | + |
| 84 | +By default, prefer to "Squash and Merge" giving it a message that follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). |
| 85 | + |
| 86 | +The final release is done after merge. |
| 87 | + |
| 88 | +### Publishing a stable release |
| 89 | + |
| 90 | +1. Checkout `main` and pull the latest commit |
| 91 | +2. Depending if you want a `path` or `minor`, run the command `npm release:main:patch` or `npm release:main:minor`. |
| 92 | + |
| 93 | + a. You'll be shown what's the new version and prompt you if it's correct. Eg |
26 | 94 |
|
27 |
| -## Pull requests (PR) |
| 95 | + ``` |
| 96 | + Creating a new dev... |
| 97 | + :: Current version: 1.0.0-beta.0 |
| 98 | + :::::: New version: 1.1.0-beta.0 |
| 99 | + Ready to commit and publish it? (y/n) |
28 | 100 |
|
29 |
| -Maintainers merge PRs by squashing the commits and editing the merge commit message using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). |
| 101 | + ``` |
30 | 102 |
|
31 |
| -## Releases |
| 103 | + b. Then it will update the CHANGELOG using [generate-changelog](https://github.com/lob/generate-changelog). You may change it if needed, before going to the next step. |
| 104 | + c. Finally, it will ask for the `@remoteoss` OTP for the NPM access to publish it. |
| 105 | + d. Done! A new release is [published on NPM](https://www.npmjs.com/package/@remoteoss/json-schema-form)! 🎉 |
32 | 106 |
|
33 |
| -For each new PR merged, a GitHub action is triggered to create a new release. |
| 107 | +3. Create [a new Github Release](https://github.com/remoteoss/json-schema-form/releases/new). |
| 108 | + - Choose the tag matching the newest version. |
| 109 | + - The title is the version eg "v1.0.0-beta.0" |
| 110 | + - Copy the new part of the CHANGELOG to the description. |
0 commit comments