Fix api docs dependencies (#3229)

* fix: broken install URL. Closes #3122.

* fix: remove redoc-cli from package.json. Set redoc-cli@version specifier in generate-api-docs.sh instead. Remove the requirement to run yarn install just for redoc-cli.

* fix: update README with npx help.

* Update api-docs/README.md

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* Update api-docs/README.md

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>

* fix: replace prompt override option for compatibility with npm@6.

Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>
pull/3233/head
Jason Stirnaman 2021-10-07 14:21:05 -05:00 committed by GitHub
parent b594e30782
commit 48505c805c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 4556 deletions

View File

@ -26,17 +26,20 @@ api-docs/
Because the API documentation HTML is gitignored, you must manually generate it
to view the API docs locally.
Verify that you have a working `npx` (it's included with Node.js).
In your terminal, run:
```sh
npx --version
```
If `npx` returns errors, [download](https://nodejs.org/en/) and run a recent version of the Node.js installer for your OS.
In your terminal, from the root of the docs repo, run:
```sh
cd api-docs
# Install dependencies
yarn install
# Generate the API docs
generate-api-docs.sh
sh generate-api-docs.sh
```

View File

@ -1,5 +1,7 @@
#!/bin/bash -e
set -e
# Get list of versions from directory names
versions="$(ls -d -- */ | grep -v 'node_modules')"
@ -40,8 +42,16 @@ weight: 304
---
"
# Use npx to install and run the specified version of redoc-cli.
# npm_config_yes=true npx overrides the prompt
# and (vs. npx --yes) is compatible with npm@6 and npm@7.
redocCLI="redoc-cli@0.12.3"
npm --version
# Use Redoc to generate the v2 API html
npx redoc-cli bundle $version/swagger.yml \
npm_config_yes=true npx $redocCLI bundle $version/swagger.yml \
-t template.hbs \
--title="InfluxDB $titleVersion API documentation" \
--options.sortPropsAlphabetically \
@ -52,7 +62,7 @@ weight: 304
# Use Redoc to generate the v1 compatibility API html
npx redoc-cli bundle $version/swaggerV1Compat.yml \
npm_config_yes=true npx $redocCLI bundle $version/swaggerV1Compat.yml \
-t template.hbs \
--title="InfluxDB $titleVersion v1 compatibility API documentation" \
--options.sortPropsAlphabetically \

View File

@ -3,9 +3,5 @@
"name": "api-docs",
"version": "1.0.0",
"description": "InfluxDB API documentation",
"license": "MIT",
"dependencies": {
"npx": "^10.2.2",
"redoc-cli": "0.9.13"
}
"license": "MIT"
}

File diff suppressed because it is too large Load Diff