From 045fc10cd813b58e4d0356ee3ceeba62722acde8 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Sat, 4 Apr 2026 00:05:54 +0000 Subject: [PATCH] feat(docs): add client library help --- core/help/.gitignore | 5 +++ core/help/.repo-metadata.json | 9 ++++++ core/help/docs-devsite.sh | 58 +++++++++++++++++++++++++++++++++++ core/help/package.json | 6 ++++ 4 files changed, 78 insertions(+) create mode 100644 core/help/.gitignore create mode 100644 core/help/.repo-metadata.json create mode 100755 core/help/docs-devsite.sh create mode 100644 core/help/package.json diff --git a/core/help/.gitignore b/core/help/.gitignore new file mode 100644 index 00000000000..6f19777dc48 --- /dev/null +++ b/core/help/.gitignore @@ -0,0 +1,5 @@ +package-lock.json +docs +.vscode +.coverage +__pycache__ diff --git a/core/help/.repo-metadata.json b/core/help/.repo-metadata.json new file mode 100644 index 00000000000..1bfa198ef8b --- /dev/null +++ b/core/help/.repo-metadata.json @@ -0,0 +1,9 @@ +{ + "name": "help", + "name_pretty": "Client library help", + "language": "nodejs", + "repo": "googleapis/google-cloud-node", + "distribution_name": "", + "product_documentation": "https://cloud.google.com/nodejs/docs/reference/help/latest", + "library_type": "OTHER" +} diff --git a/core/help/docs-devsite.sh b/core/help/docs-devsite.sh new file mode 100755 index 00000000000..f9d19a1b312 --- /dev/null +++ b/core/help/docs-devsite.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Usage: ./docs-devsite.sh + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +DOCS_DIR="$SCRIPT_DIR/docs" +ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)" + +# Copy root README.md to getting-started.md +mkdir -p $DOCS_DIR +echo "Copying root README.md to help/docs/getting-started.md..." +cp "$ROOT_DIR/README.md" "$DOCS_DIR/getting-started.md" + +# Generate toc.yaml +echo "Generating toc.yaml in $ABS_DIR..." +TOC_FILE="$DOCS_DIR/toc.yaml" + +# Write the top-level structure +echo "-" > "$TOC_FILE" +echo " uid: product-neutral-guides" >> "$TOC_FILE" +echo " name: 'Client library help'" >> "$TOC_FILE" +echo " items:" >> "$TOC_FILE" +echo " -" >> "$TOC_FILE" +echo " name: 'Getting started'" >> "$TOC_FILE" +echo " href: getting-started.md" >> "$TOC_FILE" + +# Find .md files and append to TOC +for f in $(ls "$ROOT_DIR"/docs/*.md | sort); do + if [ -f "$f" ]; then + filename=$(basename "$f") + echo "Copying $filename to help/docs/$filename..." + cp $f $DOCS_DIR + case "$filename" in + "authentication.md") + name="Authentication" + ;; + "faq.md") + name="FAQ" + ;; + "troubleshooting.md") + name="Troubleshooting" + ;; + "getting-started.md") + name="Getting Started" + ;; + *) + name="${filename%.md}" # Fallback + name="$(echo "$name" | awk '{print toupper(substr($0,1,1))substr($0,2)}')" + ;; + esac + echo " -" >> "$TOC_FILE" + echo " name: '$name'" >> "$TOC_FILE" + echo " href: $filename" >> "$TOC_FILE" + fi +done + diff --git a/core/help/package.json b/core/help/package.json new file mode 100644 index 00000000000..a8d7d43c9eb --- /dev/null +++ b/core/help/package.json @@ -0,0 +1,6 @@ +{ + "version": "1.0.0", + "scripts": { + "docs": "./docs-devsite.sh" + } +}