From a3425e776d00020fd27ee27b4601a69aa77c6545 Mon Sep 17 00:00:00 2001 From: Mike Odnis Date: Sun, 10 May 2026 03:30:25 -0400 Subject: [PATCH] fix(ts-docs): move typedoc config heredoc to column 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first multi-package run failed with `syntax error: unexpected end of file`. The heredoc was nested inside a bash subshell with 14-space indentation and the closing `JSON` marker was also indented — bash heredocs only ignore leading TABS via `<<-`, not spaces. Lift the heredoc out of the subshell, write the typedoc config once to a tmp path, and cp it into each package dir before running typedoc. The typedoc options are identical across packages, so emitting once is also a tiny optimization. --- .../api-docs.typescript.yml | 50 +++++++++++-------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/automation/source-repo-templates/api-docs.typescript.yml b/automation/source-repo-templates/api-docs.typescript.yml index 24d9cff1..472db502 100644 --- a/automation/source-repo-templates/api-docs.typescript.yml +++ b/automation/source-repo-templates/api-docs.typescript.yml @@ -111,6 +111,34 @@ jobs: set -euo pipefail mkdir -p "$OUTPUT_DIR" rm -rf "${OUTPUT_DIR:?}"/* + + # The typedoc config is identical across packages; write it + # once to a tmp path and copy into each package dir. + # Heredoc body lives at column 0 so the bash parser doesn't + # trip on the indented closing marker (tabs vs spaces). + tmp_cfg="$(mktemp)" + cat > "$tmp_cfg" <<'JSON' + { + "$schema": "https://typedoc-plugin-markdown.org/schema.json", + "plugin": ["typedoc-plugin-markdown"], + "tsconfig": "tsconfig.json", + "entryPointStrategy": "Expand", + "entryPoints": ["src"], + "exclude": [ + "**/*.cy.ts", + "**/*.test.ts", + "**/*.test.tsx", + "**/*.stories.ts", + "**/*.stories.tsx", + "**/*.spec.ts", + "**/*.spec.tsx" + ], + "out": "generated-docs", + "readme": "none", + "cleanOutputDir": true + } + JSON + generated=0 for pkg in $PUBLIC_PACKAGES; do pkg_dir="packages/$pkg" @@ -119,31 +147,11 @@ jobs: continue fi echo "==> generating $pkg" + cp "$tmp_cfg" "$pkg_dir/typedoc.docs-site.json" ( cd "$pkg_dir" bun add --dev typedoc-plugin-markdown@latest >/dev/null bun add --dev typedoc@latest >/dev/null - cat > typedoc.docs-site.json <<'JSON' - { - "$schema": "https://typedoc-plugin-markdown.org/schema.json", - "plugin": ["typedoc-plugin-markdown"], - "tsconfig": "tsconfig.json", - "entryPointStrategy": "Expand", - "entryPoints": ["src"], - "exclude": [ - "**/*.cy.ts", - "**/*.test.ts", - "**/*.test.tsx", - "**/*.stories.ts", - "**/*.stories.tsx", - "**/*.spec.ts", - "**/*.spec.tsx" - ], - "out": "generated-docs", - "readme": "none", - "cleanOutputDir": true - } - JSON rm -rf generated-docs bunx typedoc --options typedoc.docs-site.json ) || {