diff --git a/.gitignore b/.gitignore index 3c3629e647..4c687f7368 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ node_modules +build + +.DS_Store diff --git a/.npmignore b/.npmignore index 9daeafb986..dba3eef025 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,4 @@ +build +docs +script test diff --git a/docs/index.asciidoc b/docs/index.asciidoc new file mode 100644 index 0000000000..d8e7b62aca --- /dev/null +++ b/docs/index.asciidoc @@ -0,0 +1,6 @@ += APM Node.js Agent Reference + + +== APM Node.js Agent + +Welcome to the APM Node.js agent docs. diff --git a/package.json b/package.json index 8829b8c929..2468486ef8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/script/build_docs.sh b/script/build_docs.sh new file mode 100755 index 0000000000..d94efb98b8 --- /dev/null +++ b/script/build_docs.sh @@ -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"