Skip to content

Commit 122875c

Browse files
committed
docs(all): remove replace global npm installation, re-write content
1 parent 2e022d7 commit 122875c

File tree

2 files changed

+122
-68
lines changed

2 files changed

+122
-68
lines changed

docs/@v1/installation.md

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,92 +2,119 @@
22

33
Choose the most appropriate installation method for your needs:
44

5-
- [Install locally, using `npm`](#install-globally) to make the `redocly` command available on your system.
5+
- [Install locally, using `npm`](#install-locally) to make the `redocly` command available on your system.
66
- [Use `npx` to get the tool at runtime](#use-the-command-at-runtime) rather than installing it.
7-
- The command is also [available via Docker](#docker) if you'd prefer to use it that way.
7+
- The command is also [available through Docker](#docker).
88

9-
## Install globally
9+
## Install locally
1010

11-
{% admonition type="success" name="Tip" %}
12-
Make sure you have the newest version of `npm` before you begin.
13-
{% /admonition %}
11+
Before you begin, make sure you have the newest version of `npm`.
1412

15-
Install the tool with the following command:
13+
To install Redocly CLI locally:
1614

17-
```shell
18-
npm i -g @redocly/cli@latest
19-
```
15+
1. In your CLI, `cd` to your project's directory.
16+
1. Enter the following command:
17+
18+
```bash
19+
npm i @redocly/cli@latest
20+
```
2021

21-
Running `redocly --version` confirms that the installation was successful, and the currently-installed version of the tool.
22+
1. (Optional) Run `redocly --version` to confirm that the installation was successful and the currently-installed version of the tool.
2223

2324
## Use the command at runtime
2425

25-
[npx](https://docs.npmjs.com/cli/v9/commands/npx/) is npm's package runner. It installs and runs a command without installing it globally. You might use this where you can't install a new command, or in a CI context where the command is only used a handful of times.
26+
[npx](https://docs.npmjs.com/cli/v9/commands/npx/) is `npm`'s package runner.
27+
It installs and runs a command without installing it globally.
2628

27-
To run Redocly CLI with `npx`, the command looks like the following example:
29+
Use this approach where you can't install a new command, or in a CI context where the command is only used a handful of times.
2830

29-
```shell
30-
npx @redocly/cli@latest <command> [options]
31-
```
31+
To run Redocly CLI with `npx`:
32+
33+
- Replace `redocly` with `npx @redocly/cli@latest` to prepend Redocly CLI commands.
34+
35+
```bash
36+
npx @redocly/cli@latest <command> [options]
37+
```
3238

3339
For example, to run `redocly lint` on a file named `openapi.yaml`, use the following command:
3440

35-
```shell
41+
```bash
3642
npx @redocly/cli@latest lint openapi.yaml
3743
```
3844

39-
Replace `redocly` with `npx @redocly/cli@latest` to prepend to other commands you see in documentation.
40-
4145
## <a id="docker"></a>Run commands inside Docker
4246

4347
Redocly CLI is available as a pre-built Docker image in [Docker Hub](https://hub.docker.com/r/redocly/cli) and [GitHub Packages](https://github.com/Redocly/redocly-cli/pkgs/container/cli).
4448

45-
Install [Docker](https://docs.docker.com/get-docker/) if you don't have it already, then pull the image with the following command:
49+
Before you begin, make sure you have Docker [installed](https://docs.docker.com/get-docker/).
50+
51+
To run Redocly CLI commands inside a docker container:
52+
53+
1. Pull the image:
54+
4655
{% tabs %}
4756
{% tab label="Docker Hub" %}
4857

49-
```shell
58+
```bash
5059
docker pull redocly/cli
5160
```
5261

5362
{% /tab %}
5463
{% tab label="GitHub Packages" %}
5564

56-
```shell
65+
```bash
5766
docker pull ghcr.io/redocly/cli
5867
```
5968

6069
{% /tab %}
6170
{% /tabs %}
62-
To give a Docker container access to your OpenAPI description files, you need to mount the containing directory as a volume. Assuming the API description is in the current working directory, the command to use is:
6371

64-
```shell Example with lint command
65-
docker run --rm -v $PWD:/spec redocly/cli lint openapi.yaml
66-
```
72+
1. To give a Docker container access to your OpenAPI description files, mount the containing directory as a volume:
73+
74+
```bash Example with lint command
75+
docker run --rm -v $PWD:/spec redocly/cli lint openapi.yaml
76+
```
77+
This example assumes that the API description file is in your current working folder.
6778

6879
## Run CLI behind a proxy
6980

70-
If you need to run the CLI tool behind a proxy, you can use the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to configure the proxy settings. These environment variables are commonly used to specify the proxy server for HTTP and HTTPS traffic, respectively.
81+
To run the CLI tool behind a proxy, you can use the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to configure the proxy settings.
82+
These environment variables specify the proxy server for HTTP and HTTPS traffic, respectively.
7183

7284
### Set up Proxy Environment Variables
7385

74-
Before running the CLI behind a proxy, make sure to set the appropriate proxy environment variables. Open a terminal and use the following commands:
86+
To set the proxy environment variables:
87+
88+
- Open a terminal and use the following command:
89+
90+
{% tabs %}
91+
{% tab label="HTTP proxy" %}
7592

7693
```bash
77-
# For HTTP proxy
7894
export HTTP_PROXY=http://your-http-proxy-server:port
95+
```
7996

80-
# For HTTPS proxy
97+
{% /tab %}
98+
{% tab label="HTTPS proxy" %}
99+
100+
```bash
81101
export HTTPS_PROXY=https://your-https-proxy-server:port
82102
```
83103

104+
{% /tab %}
105+
{% /tabs %}
106+
84107
### Use Environment Variables with CLI Commands
85108

86-
You can also directly include the proxy environment variables in the command itself. For example:
109+
To directly include the proxy environment variables in a Redocly CLI command:
87110

88-
```bash
89-
HTTPS_PROXY=https://your-https-proxy-server:port redocly lint --extends minimal openapi.yaml
90-
```
111+
- Prepend the command with the environment variable and its value.
112+
113+
For example:
114+
115+
```bash
116+
HTTPS_PROXY=https://your-https-proxy-server:port redocly lint --extends minimal openapi.yaml
117+
```
91118

92119
## Next steps
93120

docs/@v2/installation.md

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,92 +2,119 @@
22

33
Choose the most appropriate installation method for your needs:
44

5-
- [Install locally, using `npm`](#install-globally) to make the `redocly` command available on your system.
5+
- [Install locally, using `npm`](#install-locally) to make the `redocly` command available on your system.
66
- [Use `npx` to get the tool at runtime](#use-the-command-at-runtime) rather than installing it.
7-
- The command is also [available via Docker](#docker) if you'd prefer to use it that way.
7+
- The command is also [available through Docker](#docker).
88

9-
## Install globally
9+
## Install locally
1010

11-
{% admonition type="success" name="Tip" %}
12-
Make sure you have the newest version of `npm` before you begin.
13-
{% /admonition %}
11+
Before you begin, make sure you have the newest version of `npm`.
1412

15-
Install the tool with the following command:
13+
To install Redocly CLI locally:
1614

17-
```shell
18-
npm i -g @redocly/cli@latest
19-
```
15+
1. In your CLI, `cd` to your project's directory.
16+
1. Enter the following command:
17+
18+
```bash
19+
npm i @redocly/cli@latest
20+
```
2021

21-
Running `redocly --version` confirms that the installation was successful, and the currently-installed version of the tool.
22+
1. (Optional) Run `redocly --version` to confirm that the installation was successful and the currently-installed version of the tool.
2223

2324
## Use the command at runtime
2425

25-
[npx](https://docs.npmjs.com/cli/v9/commands/npx/) is npm's package runner. It installs and runs a command without installing it globally. You might use this where you can't install a new command, or in a CI context where the command is only used a handful of times.
26+
[npx](https://docs.npmjs.com/cli/v9/commands/npx/) is `npm`'s package runner.
27+
It installs and runs a command without installing it globally.
2628

27-
To run Redocly CLI with `npx`, the command looks like the following example:
29+
Use this approach where you can't install a new command, or in a CI context where the command is only used a handful of times.
2830

29-
```shell
30-
npx @redocly/cli@latest <command> [options]
31-
```
31+
To run Redocly CLI with `npx`:
32+
33+
- Replace `redocly` with `npx @redocly/cli@latest` to prepend Redocly CLI commands.
34+
35+
```bash
36+
npx @redocly/cli@latest <command> [options]
37+
```
3238

3339
For example, to run `redocly lint` on a file named `openapi.yaml`, use the following command:
3440

35-
```shell
41+
```bash
3642
npx @redocly/cli@latest lint openapi.yaml
3743
```
3844

39-
Replace `redocly` with `npx @redocly/cli@latest` to prepend to other commands you see in documentation.
40-
4145
## <a id="docker"></a>Run commands inside Docker
4246

4347
Redocly CLI is available as a pre-built Docker image in [Docker Hub](https://hub.docker.com/r/redocly/cli) and [GitHub Packages](https://github.com/Redocly/redocly-cli/pkgs/container/cli).
4448

45-
Install [Docker](https://docs.docker.com/get-docker/) if you don't have it already, then pull the image with the following command:
49+
Before you begin, make sure you have Docker [installed](https://docs.docker.com/get-docker/).
50+
51+
To run Redocly CLI commands inside a docker container:
52+
53+
1. Pull the image:
54+
4655
{% tabs %}
4756
{% tab label="Docker Hub" %}
4857

49-
```shell
58+
```bash
5059
docker pull redocly/cli
5160
```
5261

5362
{% /tab %}
5463
{% tab label="GitHub Packages" %}
5564

56-
```shell
65+
```bash
5766
docker pull ghcr.io/redocly/cli
5867
```
5968

6069
{% /tab %}
6170
{% /tabs %}
62-
To give a Docker container access to your OpenAPI description files, you need to mount the containing directory as a volume. Assuming the API description is in the current working directory, the command to use is:
6371

64-
```shell Example with lint command
65-
docker run --rm -v $PWD:/spec redocly/cli lint openapi.yaml
66-
```
72+
1. To give a Docker container access to your OpenAPI description files, mount the containing directory as a volume:
73+
74+
```bash Example with lint command
75+
docker run --rm -v $PWD:/spec redocly/cli lint openapi.yaml
76+
```
77+
This example assumes that the API description file is in your current working folder.
6778

6879
## Run CLI behind a proxy
6980

70-
If you need to run the CLI tool behind a proxy, you can use the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to configure the proxy settings. These environment variables are commonly used to specify the proxy server for HTTP and HTTPS traffic, respectively.
81+
To run the CLI tool behind a proxy, you can use the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to configure the proxy settings.
82+
These environment variables specify the proxy server for HTTP and HTTPS traffic, respectively.
7183

7284
### Set up Proxy Environment Variables
7385

74-
Before running the CLI behind a proxy, make sure to set the appropriate proxy environment variables. Open a terminal and use the following commands:
86+
To set the proxy environment variables:
87+
88+
- Open a terminal and use the following command:
89+
90+
{% tabs %}
91+
{% tab label="HTTP proxy" %}
7592

7693
```bash
77-
# For HTTP proxy
7894
export HTTP_PROXY=http://your-http-proxy-server:port
95+
```
7996

80-
# For HTTPS proxy
97+
{% /tab %}
98+
{% tab label="HTTPS proxy" %}
99+
100+
```bash
81101
export HTTPS_PROXY=https://your-https-proxy-server:port
82102
```
83103

104+
{% /tab %}
105+
{% /tabs %}
106+
84107
### Use Environment Variables with CLI Commands
85108

86-
You can also directly include the proxy environment variables in the command itself. For example:
109+
To directly include the proxy environment variables in a Redocly CLI command:
87110

88-
```bash
89-
HTTPS_PROXY=https://your-https-proxy-server:port redocly lint --extends minimal openapi.yaml
90-
```
111+
- Prepend the command with the environment variable and its value.
112+
113+
For example:
114+
115+
```bash
116+
HTTPS_PROXY=https://your-https-proxy-server:port redocly lint --extends minimal openapi.yaml
117+
```
91118

92119
## Next steps
93120

0 commit comments

Comments
 (0)