Skip to content

Commit edd1fab

Browse files
bshafferpearigee
andauthored
feat(docs): add client library help (#7957)
* feat(docs): add client library help * try to fix broken CI by adding missing test scripts --------- Co-authored-by: Gabe Pearhill <86282859+pearigee@users.noreply.github.com> Co-authored-by: Gabe Pearhill <gabepearhill@google.com>
1 parent b8123ca commit edd1fab

4 files changed

Lines changed: 81 additions & 0 deletions

File tree

core/help/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package-lock.json
2+
docs
3+
.vscode
4+
.coverage
5+
__pycache__

core/help/.repo-metadata.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "help",
3+
"name_pretty": "Client library help",
4+
"language": "nodejs",
5+
"repo": "googleapis/google-cloud-node",
6+
"distribution_name": "",
7+
"product_documentation": "https://cloud.google.com/nodejs/docs/reference/help/latest",
8+
"library_type": "OTHER"
9+
}

core/help/docs-devsite.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
# Usage: ./docs-devsite.sh
4+
5+
set -e
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
DOCS_DIR="$SCRIPT_DIR/docs"
9+
ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
10+
11+
# Copy root README.md to getting-started.md
12+
mkdir -p $DOCS_DIR
13+
echo "Copying root README.md to help/docs/getting-started.md..."
14+
cp "$ROOT_DIR/README.md" "$DOCS_DIR/getting-started.md"
15+
16+
# Generate toc.yaml
17+
echo "Generating toc.yaml in $ABS_DIR..."
18+
TOC_FILE="$DOCS_DIR/toc.yaml"
19+
20+
# Write the top-level structure
21+
echo "-" > "$TOC_FILE"
22+
echo " uid: product-neutral-guides" >> "$TOC_FILE"
23+
echo " name: 'Client library help'" >> "$TOC_FILE"
24+
echo " items:" >> "$TOC_FILE"
25+
echo " -" >> "$TOC_FILE"
26+
echo " name: 'Getting started'" >> "$TOC_FILE"
27+
echo " href: getting-started.md" >> "$TOC_FILE"
28+
29+
# Find .md files and append to TOC
30+
for f in $(ls "$ROOT_DIR"/docs/*.md | sort); do
31+
if [ -f "$f" ]; then
32+
filename=$(basename "$f")
33+
echo "Copying $filename to help/docs/$filename..."
34+
cp $f $DOCS_DIR
35+
case "$filename" in
36+
"authentication.md")
37+
name="Authentication"
38+
;;
39+
"faq.md")
40+
name="FAQ"
41+
;;
42+
"troubleshooting.md")
43+
name="Troubleshooting"
44+
;;
45+
"getting-started.md")
46+
name="Getting Started"
47+
;;
48+
*)
49+
name="${filename%.md}" # Fallback
50+
name="$(echo "$name" | awk '{print toupper(substr($0,1,1))substr($0,2)}')"
51+
;;
52+
esac
53+
echo " -" >> "$TOC_FILE"
54+
echo " name: '$name'" >> "$TOC_FILE"
55+
echo " href: $filename" >> "$TOC_FILE"
56+
fi
57+
done
58+

core/help/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": "1.0.0",
3+
"scripts": {
4+
"docs": "./docs-devsite.sh",
5+
"test": "echo 'no unit tests'",
6+
"system-test": "echo 'no system tests'",
7+
"samples-test": "echo 'no samples test'"
8+
}
9+
}

0 commit comments

Comments
 (0)