Install dependencies as project dependencies from NPM repo (#2476)

* Added hugo-extended, postcss, postcss-cli, and autoprefixer as devDependencies. Run npm install or yarn install. (#2474)

* Replaced global hugo and yarn installs with project-level yarn install.

* Replaced npm package.lock with yarn.lock (#2474).

* enhancement: update README with instructions for installing NODE.JS dependencies. (#2474)

* updated api doc generator script to use npx

* Update README.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update README.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update README.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update README.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update README.md

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

* Update package.json

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

* fix: indentation. (#2476)

* update: Added separate dependencies list for api-docs.
- Moved redoc-cli to a separate package.json in api-docs. Excluded
api-docs/node_modules from generate-api-docs.sh.
- Updated redoc-cli argument sequence to agree with their docs.
- Updated READMEs.
- Fixed typos.

* update: add api-docs > yarn install to .circleci

* Added language and consistency to code block. Specify where to run the command.

Co-authored-by: Scott Anderson <scott@influxdata.com>
Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>
Co-authored-by: Scott Anderson <sanderson@users.noreply.github.com>
pull/2581/head
Jason Stirnaman 2021-05-24 12:11:01 -05:00 committed by GitHub
parent 51ad1397dc
commit f13e34de6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 3516 additions and 40 deletions

View File

@ -15,15 +15,15 @@ jobs:
- run:
name: Make bin folder
command: mkdir -p $HOME/bin
- run:
name: Install Hugo
command: ./deploy/ci-install-hugo.sh
- run:
name: Install s3deploy
command: ./deploy/ci-install-s3deploy.sh
- run:
name: Install NodeJS dependencies
command: sudo yarn global add postcss-cli@8.3.0 autoprefixer@9.8.6 redoc-cli@0.9.13
command: yarn install
- run:
name: Install API documentation dependencies
command: cd api-docs && yarn install
- run:
name: Generate API documentation
command: cd api-docs && bash generate-api-docs.sh
@ -33,7 +33,7 @@ jobs:
- /home/circleci/bin
- run:
name: Hugo Build
command: $HOME/bin/hugo -v --minify --destination workspace/public
command: npx hugo -v --minify --destination workspace/public
- persist_to_workspace:
root: workspace
paths:

View File

@ -3,13 +3,16 @@
</p>
# InfluxDB 2.0 Documentation
This repository contains the InfluxDB 2.x documentation published at [docs.influxdata.com](https://docs.influxdata.com).
## Contributing
We welcome and encourage community contributions.
For information about contributing to the InfluxData documentation, see [Contribution guidelines](CONTRIBUTING.md).
## Reporting a Vulnerability
InfluxData takes security and our users' trust very seriously.
If you believe you have found a security issue in any of our open source projects,
please responsibly disclose it by contacting security@influxdata.com.
@ -20,37 +23,32 @@ including our GPG key, can be found at https://www.influxdata.com/how-to-report-
1. [**Clone this repository**](https://help.github.com/articles/cloning-a-repository/) to your local machine.
2. **Install Hugo**
2. **Install NodeJS, Yarn, Hugo, & Asset Pipeline Tools**
The InfluxData documentation uses [Hugo](https://gohugo.io/), a static site generator built in Go.
The InfluxData documentation utilizes Hugo's asset pipeline and requires the extended version of Hugo.
See the Hugo documentation for information about how to [download and install Hugo](https://gohugo.io/getting-started/installing/).
The InfluxData documentation uses [Hugo](https://gohugo.io/), a static site generator built in Go. The site uses Hugo's asset pipeline, which requires the extended version of Hugo along with NodeJS tools like PostCSS, to build and process stylesheets and javascript.
_**Note:** The most recent version of Hugo tested with this documentation is **0.81.0**._
3. **Install NodeJS, Yarn, & Asset Pipeline Tools**
This project uses tools written in NodeJS to build and process stylesheets and javascript.
To successfully build assets:
To install the required dependencies and build the assets, do the following:
1. [Install NodeJS](https://nodejs.org/en/download/)
2. [Install Yarn](https://classic.yarnpkg.com/en/docs/install/)
3. Run the following command to install the necessary tools:
3. In your terminal, from the `docs-v2` directory, install the dependencies:
```sh
sudo yarn global add postcss-cli@8.3.0 autoprefixer@9.8.6
```
```sh
cd docs-v2
yarn install
```
_**Note:** The most recent version of Hugo tested with this documentation is **0.83.1**._
3. To generate the API docs, see [api-docs/README.md](api-docs/README.md).
4. **Start the Hugo server**
Hugo provides a local development server that generates the HTML pages, builds
the static assets, and serves them at `localhost:1313`.
Hugo provides a local development server that generates the HTML pages, builds the static assets, and serves them at `localhost:1313`.
Start the Hugo server from the repository:
In your terminal, start the Hugo server:
```
$ cd docs-v2/
$ hugo server
```
View the docs at [localhost:1313](http://localhost:1313).
```sh
npx hugo server
```
5. View the docs at [localhost:1313](http://localhost:1313).

15
api-docs/README.md Normal file → Executable file
View File

@ -9,7 +9,7 @@ The InfluxDB docs deployment process uses swagger files in the `api-docs` direct
to generate version-specific API documentation.
### Versioned swagger files
Structure versions swagger files using the following pattern:
The structure versions swagger files using the following pattern:
```
api-docs/
@ -26,12 +26,17 @@ api-docs/
Because the API documentation HTML is gitignored, you must manually generate it
to view the API docs locally.
From the root of the docs repo, run:
In your terminal, from the root of the docs repo, run:
```sh
# Install redoc-cli
npm install -g redoc-cli
cd api-docs
# Install dependencies
yarn install
# Generate the API docs
cd api-docs && generate-api-docs.sh
generate-api-docs.sh
```

16
api-docs/generate-api-docs.sh Normal file → Executable file
View File

@ -1,7 +1,7 @@
#!/bin/bash -e
# Get list of versions from directory names
versions="$(ls -d -- */)"
versions="$(ls -d -- */ | grep -v 'node_modules')"
for version in $versions
do
@ -28,9 +28,9 @@ weight: 102
---
"
v1frontmatter="---
title: InfluxDB $titleVersion v1 compatiblity API documentation
title: InfluxDB $titleVersion v1 compatibility API documentation
description: >
The InfluxDB v1 compatility API provides a programmatic interface for interactions with InfluxDB $titleVersion using InfluxDB v1.x compatibly endpoints.
The InfluxDB v1 compatibility API provides a programmatic interface for interactions with InfluxDB $titleVersion using InfluxDB v1.x compatibly endpoints.
layout: api
menu:
$menu:
@ -41,17 +41,19 @@ weight: 304
"
# Use Redoc to generate the v2 API html
redoc-cli bundle -t template.hbs \
npx redoc-cli bundle $version/swagger.yml \
-t template.hbs \
--title="InfluxDB $titleVersion API documentation" \
--options.sortPropsAlphabetically \
--options.menuToggle \
--options.hideHostname \
--templateOptions.version="$version" \
--templateOptions.titleVersion="$titleVersion" \
$version/swagger.yml
# Use Redoc to generate the v1 compatibility API html
redoc-cli bundle -t template.hbs \
npx redoc-cli bundle $version/swaggerV1Compat.yml \
-t template.hbs \
--title="InfluxDB $titleVersion v1 compatibility API documentation" \
--options.sortPropsAlphabetically \
--options.menuToggle \
@ -59,7 +61,7 @@ weight: 304
--templateOptions.version="$version" \
--templateOptions.titleVersion="$titleVersion" \
--output=redoc-static-v1-compat.html \
$version/swaggerV1Compat.yml
# Create temp file with frontmatter and Redoc html
echo "$v2frontmatter" >> $version.tmp

0
api-docs/getswagger.sh Normal file → Executable file
View File

10
api-docs/package.json Executable file
View File

@ -0,0 +1,10 @@
{
"private": true,
"name": "api-docs",
"version": "1.0.0",
"description": "InfluxDB API documentation",
"license": "MIT",
"dependencies": {
"redoc-cli": "0.9.13"
}
}

0
api-docs/template.hbs Normal file → Executable file
View File

1799
api-docs/yarn.lock Executable file

File diff suppressed because it is too large Load Diff

13
package.json Normal file
View File

@ -0,0 +1,13 @@
{
"private": true,
"name": "docs-v2",
"version": "1.0.0",
"description": "InfluxDB documentation",
"license": "MIT",
"devDependencies": {
"autoprefixer": "^10.2.5",
"hugo-extended": "^0.83.1",
"postcss": "^8.2.13",
"postcss-cli": "^8.3.1"
}
}

1649
yarn.lock Normal file

File diff suppressed because it is too large Load Diff