Skip to content

Commit

Permalink
docs(*): add basic docs structure to agent (#2)
Browse files Browse the repository at this point in the history
This is the basic doc structure needed for the elastic docs build. For convenience I added a script that can be executed with `npm run docs` to build the docs locally to see if the doc build passes and how the docs will look like.

As soon as we have Jenkins added as CI we should also add a build step for `npm run docs` to make sure we do not break the doc build.
  • Loading branch information
ruflin authored and watson committed Aug 21, 2017
1 parent 47a6bec commit 850481f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node_modules
build

.DS_Store
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
build
docs
script
test
6 changes: 6 additions & 0 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
= APM Node.js Agent Reference


== APM Node.js Agent

Welcome to the APM Node.js agent docs.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "The official Elastic APM agent for Node.js",
"main": "index.js",
"scripts": {
"docs": "./script/build_docs.sh apm-agent-nodejs ./docs ./build",
"lint": "standard",
"lint-fix": "standard --fix",
"pretest": "test/pretest.sh",
Expand Down
32 changes: 32 additions & 0 deletions script/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

set -e

name=$1
path=$2
build_dir=$3

docs_dir=$build_dir/docs
html_dir=$build_dir/html_docs

# Checks if docs clone already exists
if [ ! -d $docs_dir ]; then
# Only head is cloned
git clone --depth=1 https://github.com/elastic/docs.git $docs_dir
else
echo "$docs_dir already exists. Not cloning."
fi


index="${path}/index.asciidoc"

echo "Building docs for ${name}..."
echo "Index document: ${index}"

dest_dir="$html_dir/${name}"
mkdir -p "$dest_dir"
params=""
if [ "$PREVIEW" = "1" ]; then
params="--chunk=1 -open chunk=1 -open"
fi
$docs_dir/build_docs.pl $params --doc "$index" -out "$dest_dir"

0 comments on commit 850481f

Please sign in to comment.