Skip to content

Commit 1dfdd49

Browse files
committed
chore: improve README and CONTRIBUTING files
1 parent 0d092b7 commit 1dfdd49

File tree

2 files changed

+65
-27
lines changed

2 files changed

+65
-27
lines changed

CONTRIBUTING.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Redocly CLI Contributing Guide
22

3-
Hi! We're really excited that you are interested in contributing to Redocly CLI. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
3+
Hi! We're really excited that you are interested in contributing to Redocly CLI.
4+
Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
45

56
- [Issue reporting guidelines](#issue-reporting-guidelines)
67
- [Pull request guidelines](#pull-request-guidelines)
@@ -48,7 +49,8 @@ npm install # or npm i
4849

4950
To compile the code, run `npm run compile`. To do that on the fly, run `npm run watch` in a separate thread.
5051

51-
To run a specific CLI command, use `npm run cli`, e.g. `npm run cli -- lint resources/museum.yaml --format=stylish`. Please notice that the extra `--` is required to pass arguments to the CLI rather than to NPM itself.
52+
To run a specific CLI command, use `npm run cli`, e.g. `npm run cli -- lint resources/museum.yaml --format=stylish`.
53+
Please notice that the extra `--` is required to pass arguments to the CLI rather than to NPM itself.
5254

5355
Format your code with `npm run prettier` before committing.
5456

@@ -70,13 +72,15 @@ To test local changes as a package, you can use the following steps:
7072

7173
1. Optionally, bump the version of the packages ([see details](#version-updating)).
7274

73-
1. Run `npm run pack:prepare` in the repository's root. This generates **redocly-cli.tgz**, **respect-core.tgz**, and **openapi-core.tgz** files.
75+
1. Run `npm run pack:prepare` in the repository's root.
76+
This generates **redocly-cli.tgz**, **respect-core.tgz**, and **openapi-core.tgz** files.
7477

7578
1. Copy those **.tgz** files to a destination folder and then run `npm install redocly-cli.tgz` there to install Redocly CLI. To install `openapi-core` do the same but with **openapi-core.tgz** file.
7679

7780
## Contribute documentation
7881

79-
Additions and updates to our documentation are very welcome. You can find the documentation in the `docs/` folder, and this is published to https://redocly.com/docs/cli/ as part of our main website.
82+
Additions and updates to our documentation are very welcome.
83+
You can find the documentation in the `docs/` folder, and this is published to https://redocly.com/docs/cli/ as part of our main website.
8084

8185
To preview your documentation changes locally:
8286

@@ -90,11 +94,14 @@ redocly preview
9094

9195
By default, you can access the docs preview at http://localhost:4000 or http://127.0.0.1:4000.
9296

93-
> Please note that currently the custom markdoc tags used in the main website are not available in the local preview version, and links that point to the wider website do show as errors when using a local platform. The pull request workflows generate a full preview, so rest assured that you are able to check everything is in good shape before we review and merge your changes.
97+
> Please note that currently the custom markdoc tags used in the main website are not available in the local preview version, and links that point to the wider website do show as errors when using a local platform.
98+
> The pull request workflows generate a full preview, so rest assured that you are able to check everything is in good shape before we review and merge your changes.
9499
95100
### Prose linting
96101

97-
We are proud of our docs. When you open a pull request, we lint the prose using [Vale](https://vale.sh/). You can also install this tool locally and run it from the root of the project with:
102+
We are proud of our docs.
103+
When you open a pull request, we lint the prose using [Vale](https://vale.sh/).
104+
You can also install this tool locally and run it from the root of the project with:
98105

99106
```bash
100107
vale docs/
@@ -110,7 +117,9 @@ We use [Markdownlint](https://github.com/DavidAnson/markdownlint) to check that
110117
111118
### Markdown link checking
112119

113-
We use [`mlc`](https://github.com/becheran/mlc) to check the links in the `docs/` folder. This tool runs automatically on every pull request, but you can also run it locally if you want to. Visit the project homepage to find the installation instructions for your platform, and then run the command like this:
120+
We use [`mlc`](https://github.com/becheran/mlc) to check the links in the `docs/` folder.
121+
This tool runs automatically on every pull request, but you can also run it locally if you want to.
122+
Visit the project homepage to find the installation instructions for your platform, and then run the command like this:
114123

115124
```bash
116125
mlc docs/
@@ -120,7 +129,8 @@ It only checks links within the local docs (it can't check links to other docs s
120129

121130
## Built-in rules changes
122131

123-
After adding a new rule, make sure it is added to the `minimal`, `recommended`, `recommended-strict` (the same as the previous but with warnings turned into error) and `all` rulesets with appropriate severity levels. The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
132+
After adding a new rule, make sure it is added to the `minimal`, `recommended`, `recommended-strict` (the same as the previous but with warnings turned into error) and `all` rulesets with appropriate severity levels.
133+
The defaults are `off` for `minimal` and `recommended` and `error` for `all`.
124134
Also add the rule to the built-in rules list in [the config types tree](./packages/core/src/types/redocly-yaml.ts).
125135

126136
Separately, open a merge request with the corresponding documentation changes.
@@ -137,11 +147,16 @@ Environment variables should not affect the **core** package logic.
137147

138148
### Command line arguments
139149

140-
Use them to provide some arguments that are specific to a certain command. Think of them as modifiers. They should not affect the **core** package logic.
150+
Use them to provide some arguments that are specific to a certain command.
151+
Think of them as modifiers.
152+
They should not affect the **core** package logic.
141153

142154
### Configuration file
143155

144-
The **redocly.yaml** file is the most flexible way of providing arguments. Please use it to provide arguments that are common for all the commands, for a specific command, or for a specific API. It could be used for providing arguments for both **cli** and **core** packages. Please refer to the [configuration file](https://redocly.com/docs/cli/configuration/) documentation for more details.
156+
The **redocly.yaml** file is the most flexible way of providing arguments.
157+
Please use it to provide arguments that are common for all the commands, for a specific command, or for a specific API.
158+
It could be used for providing arguments for both **cli** and **core** packages.
159+
Please refer to the [configuration file](https://redocly.com/docs/cli/configuration/) documentation for more details.
145160

146161
## Exit codes
147162

@@ -215,14 +230,17 @@ If you made any changes, make sure to compile the code before running the tests.
215230
- **`packages/core/src/types`**: contains the common types for several OpenAPI versions.
216231
- **`packages/core/src/typings`**: contains the common Typescript typings.
217232

233+
- **`packages/respect-core`**: contains the Respect core package.
234+
218235
- **`resources`**: contains some example API descriptions and configuration files that might be useful for testing.
219236

220237
## Release flow
221238

222239
We use [Changesets](https://github.com/changesets/changesets) flow.
223240
After merging a PR with a changeset, the release PR is automatically created.
224241

225-
If the pipelines are not starting, close and reopen the PR. Merging that PR triggers the release process.
242+
If the pipelines are not starting, close and reopen the PR.
243+
Merging that PR triggers the release process.
226244

227245
### Revert a release
228246

README.md

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Redocly CLI
22

3-
[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility. It builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle. Create your own rulesets to make API governance easy, and publish beautiful API reference documentation. Supports OpenAPI 3.1, 3.0 and OpenAPI 2.0 (legacy Swagger).
3+
[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility.
4+
It builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle.
5+
Create your own rulesets to make API governance easy, publish beautiful API reference documentation, and more.
6+
Supports OpenAPI 3.1, 3.0 and OpenAPI 2.0 (legacy Swagger), AsyncAPI 3.0 and 2.6, Arazzo 1.0.
47

58
![build and test](https://github.com/redocly/redocly-cli/actions/workflows/tests.yaml/badge.svg)
69
![npm (scoped)](https://img.shields.io/npm/v/@redocly/cli)
@@ -32,9 +35,8 @@ The minimum required versions of Node.js and NPM are 18.17.0 and 10.8.2 respecti
3235

3336
### Docker
3437

35-
To give the Docker container access to the OpenAPI description files, you need to
36-
mount the containing directory as a volume. Assuming the API description is rooted
37-
in the current working directory, you need the following command:
38+
To give the Docker container access to the OpenAPI description files, you need to mount the containing directory as a volume.
39+
Assuming the API description is rooted in the current working directory, you need the following command:
3840

3941
```sh
4042
docker run --rm -v $PWD:/spec redocly/cli lint path-to-root-file.yaml
@@ -51,55 +53,72 @@ docker run --rm -v $PWD:/spec redocly/cli lint path-to-root-file.yaml
5153

5254
### Generate API reference documentation
5355

54-
Redocly CLI is a great way to render API reference documentation. It uses open source [Redoc](https://github.com/redocly/redoc) to build your documentation. Use a command like this:
56+
Redocly CLI is a great way to render API reference documentation.
57+
It uses open source [Redoc](https://github.com/redocly/redoc) to build your documentation.
58+
Use a command like this:
5559

5660
```sh
5761
redocly build-docs openapi.yaml
5862
```
5963

60-
Your API reference docs are in `redoc-static.html` by default. You can customize this in many ways. [Read the main docs](https://redocly.com/docs/cli/commands/build-docs) for more information.
64+
Your API reference docs are in `redoc-static.html` by default.
65+
You can customize this in many ways.
66+
[Read the main docs](https://redocly.com/docs/cli/commands/build-docs) for more information.
6167

62-
> :bulb: Redocly also has [hosted API reference docs](https://redocly.com/docs/api-registry/guides/api-registry-quickstart/), a (commercial) alternative to Redoc. Both Redoc and Redocly API reference docs can be worked on locally using the `preview-docs` command.
68+
> :bulb: Redocly also has [hosted API reference docs](https://redocly.com/docs/api-registry/guides/api-registry-quickstart/), a (commercial) alternative to Redoc.
69+
> Both Redoc and Redocly API reference docs can be worked on locally using the `preview-docs` command.
6370
6471
### Bundle multiple OpenAPI documents
6572

66-
Having one massive OpenAPI description can be annoying, so most people split them up into multiple documents via `$ref`, only to later find out some tools don't support `$ref` or don't support multiple documents. Redocly CLI to the rescue! It has a `bundle` command you can use to recombine all of those documents back into one single document. The bundled output that Redocly CLI provides is clean, tidy, and looks like a human made it.
73+
Having one massive OpenAPI description can be annoying, so most people split them up into multiple documents via `$ref`, only to later find out some tools don't support `$ref` or don't support multiple documents.
74+
Redocly CLI to the rescue! It has a `bundle` command you can use to recombine all of those documents back into one single document.
75+
The bundled output that Redocly CLI provides is clean, tidy, and looks like a human made it.
6776

6877
### Automate API guidelines with Linting
6978

70-
Check that your API matches the expected API guidelines by using the `lint` command. API guidelines are an important piece of API governance. They help to keep APIs consistent by enforcing the same standards and naming conventions, and they can also guide API teams through potential security hazards and other pitfalls. Automating API guidelines means you can keep APIs consistent and secure throughout their lifecycle. Even better, you can shape the design of the API before it even exists by combining API linting with a design-first API workflow.
79+
Check that your API matches the expected API guidelines by using the `lint` command.
80+
API guidelines are an important piece of API governance. They help to keep APIs consistent by enforcing the same standards and naming conventions, and they can also guide API teams through potential security hazards and other pitfalls.
81+
Automating API guidelines means you can keep APIs consistent and secure throughout their lifecycle.
82+
Even better, you can shape the design of the API before it even exists by combining API linting with a design-first API workflow.
7183

72-
Our API linter is designed for speed on even large documents, and it's easy to run locally, in CI, or anywhere you need it. It's also designed for humans, with meaningful error messages to help you get your API right every time.
84+
Our API linter is designed for speed on even large documents, and it's easy to run locally, in CI, or anywhere you need it.
85+
It's also designed for humans, with meaningful error messages to help you get your API right every time.
7386

7487
Try it like this:
7588

7689
```sh
7790
redocly lint openapi.yaml
7891
```
7992

80-
**Configure the rules** as you wish. Other API Linters use complicated identifiers like JSONPath, but Redocly makes life easy with simple expressions that understand the OpenAPI structure. You can either use the [built-in rules](https://redocly.com/docs/cli/rules) to mix-and-match your ideal API guidelines, or break out the tools to build your own.
93+
**Configure the rules** as you wish.
94+
Other API Linters use complicated identifiers like JSONPath, but Redocly makes life easy with simple expressions that understand the OpenAPI structure.
95+
You can either use the [built-in rules](https://redocly.com/docs/cli/rules) to mix-and-match your ideal API guidelines, or break out the tools to build your own.
8196

82-
**Format the output** in whatever way you need. The `stylish` output is as good as it sounds, but if you need JSON or Checkstyle outputs to integrate with other tools, the `lint` command can output those too.
97+
**Format the output** in whatever way you need.
98+
The `stylish` output is as good as it sounds, but if you need JSON or Checkstyle outputs to integrate with other tools, the `lint` command can output those too.
8399

84100
**Multiple files supported** so you don't need to bundle your API description to lint it; just point Redocly CLI at the "entry point" (e.g.: `openapi.yaml`) and it handles the rest.
85101

86102
[Learn more about API standards and configuring Redocly rules](https://redocly.com/docs/cli/api-standards).
87103

88104
### Transform an OpenAPI description
89105

90-
If your OpenAPI description isn't everything you hoped it would be, enhance it with the Redocly [decorators](https://redocly.com/docs/cli/decorators) feature. This allows you to:
106+
If your OpenAPI description isn't everything you hoped it would be, enhance it with the Redocly [decorators](https://redocly.com/docs/cli/decorators) feature.
107+
This allows you to:
91108

92109
- Publish reference docs with a subset of endpoints for public use
93110
- Improve the docs by adding examples and descriptions
94111
- Adapt an existing OpenAPI description, and replace details like URLs for use on staging platforms
95112

96113
## Data collection
97114

98-
This tool [collects data](./docs/usage-data.md) to help Redocly improve our products and services. You can opt out by setting the `REDOCLY_TELEMETRY` environment variable to `off`.
115+
This tool [collects data](./docs/usage-data.md) to help Redocly improve our products and services.
116+
You can opt out by setting the `REDOCLY_TELEMETRY` environment variable to `off`.
99117

100118
## Update notifications
101119

102-
Redocly CLI checks for updates on startup. You can disable this by setting the `REDOCLY_SUPPRESS_UPDATE_NOTICE` environment variable to `true`.
120+
Redocly CLI checks for updates on startup.
121+
You can disable this by setting the `REDOCLY_SUPPRESS_UPDATE_NOTICE` environment variable to `true`.
103122

104123
## More resources
105124

@@ -111,4 +130,5 @@ Thanks to [graphql-js](https://github.com/graphql/graphql-js) and [eslint](https
111130

112131
## Development
113132

114-
Contributions are welcome! All the information you need is in [CONTRIBUTING.md](CONTRIBUTING.md).
133+
Contributions are welcome!
134+
All the information you need is in [CONTRIBUTING.md](CONTRIBUTING.md).

0 commit comments

Comments
 (0)