Created
February 15, 2022 22:13
-
-
Save patrickhulce/edd4f97559fccc68e890796c7e5432b0 to your computer and use it in GitHub Desktop.
Automatically generate typedoc markdown on multiple platforms.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
./pnpm exec typedoc \ | |
--treatWarningsAsErrors \ | |
--excludePrivate \ | |
--gitRevision master \ | |
--githubPages false \ | |
--plugin typedoc-plugin-markdown \ | |
--out docs \ | |
src/index.ts | |
# sed's flags differ on linux and macOS | |
SED_FLAGS=("-i" "-r") # GNU sed | |
PLATFORM=$(./node -p 'os.platform()') | |
if [[ $PLATFORM =~ "darwin" ]]; then | |
SED_FLAGS=("-i" "" "-E") # FreeBSD sed | |
fi | |
# Delete the duplicate README.md | |
rm ./docs/README.md | |
# Replace all references to README to the root README. | |
find ./docs -type f | xargs sed "${SED_FLAGS[@]}" 's/README.md/..\/README.md/g' | |
# Replace all line references to limit volatility. | |
find ./docs -type f | xargs sed "${SED_FLAGS[@]}" 's/.ts(:|#L)[0-9]+/.ts/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment