feat(docs): typedoc api reference (#9378)

This commit is contained in:
Janos Hrubos
2021-05-06 16:49:07 +02:00
committed by GitHub
parent 342108c1af
commit 6d91c2a019
4 changed files with 374 additions and 398 deletions

View File

@ -3,7 +3,6 @@ set -e
ENV="${ENV:-dev}"
DIST_DIR="bin/dist"
TARGET_DIR="$DIST_DIR/snippets"
PACKAGE_VERSION="${PACKAGE_VERSION:-0.0.0}"
archive_dist_dir() {
@ -13,44 +12,27 @@ archive_dist_dir() {
npm_install() {
# Don't install modules twice.
MARKER_FILE="./node_modules/installed"
if [ ! -f "$MARKER_FILE" ] ; then
# Fixes perm issue while installing
npm i -g npm@^6.13.6
npm install
npm install @types/handlebars@4.0.33
touch "$MARKER_FILE"
fi
}
extract_snippets() {
BIN="./node_modules/markdown-snippet-injector/extract.js"
npm install markdown-snippet-injector
for SNIPPET_DIR in {tests/app,apps/app,nativescript-core} ; do
echo "Extracting snippets from: $SNIPPET_DIR"
node "$BIN" --root="$SNIPPET_DIR" --target="$TARGET_DIR" \
--sourceext=".js|.ts|.xml|.html|.css"
done
archive_dist_dir "snippets"
}
extract_apiref() {
APIREF_DIR="$DIST_DIR/api-reference"
rm -rf "$APIREF_DIR"
npm_install
npm run typedoc
# npm_install
npx typedoc --tsconfig tools/scripts/tsconfig.typedoc.json
mv "$DIST_DIR/apiref" "$APIREF_DIR"
mv "dist/apiref" "$APIREF_DIR"
archive_dist_dir "api-reference"
}
rm -rf "$TARGET_DIR"
mkdir -p "$TARGET_DIR"
if [ "${BASH_SOURCE[0]}" == "$0" ] ; then
extract_snippets
extract_apiref
fi