-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ts-docs): move typedoc config heredoc to column 0 #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| ) || { | ||
|
Comment on lines
+150
to
157
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The per-package TypeDoc configuration file should be removed after use to keep the workspace clean. Additionally, ensure the configuration includes the relative path to the package directory in the source code link base URL, as required for monorepos to ensure 'View source' links resolve correctly. 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
rm -rf generated-docs
bunx typedoc --options typedoc.docs-site.json
rm -f typedoc.docs-site.json
) || {
rm -f "$pkg_dir/typedoc.docs-site.json"
}References
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The temporary file created by
mktempshould be cleaned up to avoid leaking files in/tmp. While GitHub Action runners are ephemeral, it is good practice to ensure cleanup, especially if this template is used in persistent environments or self-hosted runners.