Skip to content

Commit

Permalink
Install dependencies as project dependencies from NPM repo (influxdat…
Browse files Browse the repository at this point in the history
…a#2476)

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

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

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

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

* updated api doc generator script to use npx

* Update README.md

Co-authored-by: kelseiv <[email protected]>

* Update README.md

Co-authored-by: kelseiv <[email protected]>

* Update README.md

Co-authored-by: kelseiv <[email protected]>

* Update README.md

Co-authored-by: kelseiv <[email protected]>

* Update README.md

Co-authored-by: Scott Anderson <[email protected]>

* Update package.json

Co-authored-by: Scott Anderson <[email protected]>

* fix: indentation. (influxdata#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 <[email protected]>
Co-authored-by: kelseiv <[email protected]>
Co-authored-by: Scott Anderson <[email protected]>
  • Loading branch information
4 people authored May 24, 2021
1 parent 51ad139 commit f13e34d
Show file tree
Hide file tree
Showing 10 changed files with 3,516 additions and 40 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] [email protected] [email protected]
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
Expand All @@ -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:
Expand Down
44 changes: 21 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected].
Expand All @@ -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 [email protected] [email protected]
```
```sh
cd docs-v2
yarn install
```

4. **Start the Hugo server**
_**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).

Hugo provides a local development server that generates the HTML pages, builds
the static assets, and serves them at `localhost:1313`.
4. **Start the Hugo server**

Start the Hugo server from the repository:
Hugo provides a local development server that generates the HTML pages, builds the static assets, and serves them at `localhost:1313`.

```
$ cd docs-v2/
$ hugo server
```
In your terminal, start the 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 changes: 10 additions & 5 deletions api-docs/README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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 changes: 9 additions & 7 deletions api-docs/generate-api-docs.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand All @@ -41,25 +41,27 @@ 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 \
--options.hideHostname \
--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
Expand Down
Empty file modified api-docs/getswagger.sh
100644 → 100755
Empty file.
10 changes: 10 additions & 0 deletions api-docs/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Empty file modified api-docs/template.hbs
100644 → 100755
Empty file.
Loading

0 comments on commit f13e34d

Please sign in to comment.