Files
wechaty--wechaty/scripts/generate-docs.sh
T
wehub-resource-sync d5f55b5f9c
Coverage / build (push) Waiting to run
Docker / Build (push) Waiting to run
Docker / Publish (push) Blocked by required conditions
Node.js CI / build (16, macos-latest) (push) Waiting to run
Node.js CI / build (16, ubuntu-latest) (push) Waiting to run
Node.js CI / build (16, windows-latest) (push) Waiting to run
NPM / Build (22) (push) Waiting to run
NPM / Pack (push) Blocked by required conditions
NPM / Publish (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 12:40:42 +08:00

48 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
VERSION=$(npx pkg-jq -r .version)
echo "Version $VERSION"
if ! npx --package @chatie/semver semver-is-prod "$VERSION"; then
echo "Current release is a development release, please only update the docs when there's a stable release."
if [ "$1" != "-f" ]; then
echo "Or use -f to force generating."
exit 1
else
echo "-f found. Forcing generating ..."
fi
fi
echo "Generating docs ..."
npm run dist
DOCS_INDEX_MD=docs/index.md
cat <<_EOF_ > "$DOCS_INDEX_MD"
# Wechaty v$(jq -r .version package.json) Documentation
- Website - <https://wechaty.js.org>
- Docs Site - <https://wechaty.js.org/docs/>
- API References - <https://wechaty.github.io/wechaty/>
_EOF_
jsdoc2md \
dist/src/wechaty.js \
dist/src/user/{room,contact,contact-self,friendship,message,room-invitation}.js \
>> "$DOCS_INDEX_MD"
#
# https://sidecar.gitter.im/
#
cat <<_EOF_ >> "$DOCS_INDEX_MD"
<script>
((window.gitter = {}).chat = {}).options = {
room: 'chatie/wechaty'
};
</script>
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>
_EOF_