Skip to content

Commit d17b5b9

Browse files
authored
docs(all): remove replace global npm installation, re-write content (#2453)
1 parent cb9aba3 commit d17b5b9

File tree

2 files changed

+118
-62
lines changed

2 files changed

+118
-62
lines changed

docs/@v1/installation.md

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,92 +2,120 @@
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
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
1920
```
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
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
6575
docker run --rm -v $PWD:/spec redocly/cli lint openapi.yaml
6676
```
6777

78+
This example assumes that the API description file is in your current working folder.
79+
6880
## Run CLI behind a proxy
6981

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.
82+
To run the CLI tool behind a proxy, you can use the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to configure the proxy settings.
83+
These environment variables specify the proxy server for HTTP and HTTPS traffic, respectively.
7184

7285
### Set up Proxy Environment Variables
7386

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:
87+
To set the proxy environment variables:
88+
89+
- Open a terminal and use the following command:
90+
91+
{% tabs %}
92+
{% tab label="HTTP proxy" %}
7593

7694
```bash
77-
# For HTTP proxy
7895
export HTTP_PROXY=http://your-http-proxy-server:port
96+
```
7997

80-
# For HTTPS proxy
98+
{% /tab %}
99+
{% tab label="HTTPS proxy" %}
100+
101+
```bash
81102
export HTTPS_PROXY=https://your-https-proxy-server:port
82103
```
83104

105+
{% /tab %}
106+
{% /tabs %}
107+
84108
### Use Environment Variables with CLI Commands
85109

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

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

92120
## Next steps
93121

docs/@v2/installation.md

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,92 +2,120 @@
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
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
1920
```
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
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
6575
docker run --rm -v $PWD:/spec redocly/cli lint openapi.yaml
6676
```
6777

78+
This example assumes that the API description file is in your current working folder.
79+
6880
## Run CLI behind a proxy
6981

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.
82+
To run the CLI tool behind a proxy, you can use the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to configure the proxy settings.
83+
These environment variables specify the proxy server for HTTP and HTTPS traffic, respectively.
7184

7285
### Set up Proxy Environment Variables
7386

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:
87+
To set the proxy environment variables:
88+
89+
- Open a terminal and use the following command:
90+
91+
{% tabs %}
92+
{% tab label="HTTP proxy" %}
7593

7694
```bash
77-
# For HTTP proxy
7895
export HTTP_PROXY=http://your-http-proxy-server:port
96+
```
7997

80-
# For HTTPS proxy
98+
{% /tab %}
99+
{% tab label="HTTPS proxy" %}
100+
101+
```bash
81102
export HTTPS_PROXY=https://your-https-proxy-server:port
82103
```
83104

105+
{% /tab %}
106+
{% /tabs %}
107+
84108
### Use Environment Variables with CLI Commands
85109

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

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

92120
## Next steps
93121

0 commit comments

Comments
 (0)