@@ -54,6 +54,7 @@ cat <<EOF >_site/index.html
5454 <p>Build a website from the documentation JSON file generated by <a href="https://github.com/typst/typst/blob/main/docs/Cargo.toml#L2">typst-docs</a>.</p>
5555 <p>This website is for developing typst-docs-web. Its contents might be changed at anytime.</p>
5656 <ul>
57+ <li><a href="./en-US-v0.14.1/">en-US, v0.14.1</a></li>
5758 <li><a href="./en-US-v0.14.0/">en-US, v0.14.0</a></li>
5859 <li><a href="./en-US-v0.13.1/">en-US, v0.13.1</a></li>
5960 <li><a href="./ja-JP/">ja-JP, v0.13.1</a></li>
7273
7374build_en_US () {
7475 local VERSION=" $1 "
75-
76- BASE=" en-US-$VERSION "
77-
78- # Prepare docs.json
79- curl -L https://github.com/typst-community/dev-builds/releases/download/docs-" $VERSION " /docs.json \
80- -o public/docs.json
81- sd ' /DOCS-BASE/' " /$BASE /" public/docs.json
82-
83- # Prepare docs assets
84- curl -LO https://github.com/typst-community/dev-builds/releases/download/docs-" $VERSION " /docs-assets.zip
85- unzip docs-assets.zip && rm docs-assets.zip
86- mv assets public/assets
87-
88- # Configure metadata
89- cat << EOF >public/metadata.json
90- {
91- "\$ schema": "../metadata.schema.json",
92- "language": "en-US",
93- "version": "${VERSION# v} ",
94- "typstOfficialUrl": "https://typst.app",
95- "typstOfficialDocsUrl": "https://typst.app/docs/",
96- "githubOrganizationUrl": "https://github.com/typst-community",
97- "githubRepositoryUrl": "https://github.com/typst-community/typst-docs-web",
98- "discordServerUrl": "https://discord.gg/2uDybryKPe",
99- "originUrl": "${DEPLOY_URL:- https:// example.com} /",
100- "basePath": "/$BASE /",
101- "displayTranslationStatus": false
102- }
103- EOF
104- # $DEPLOY_URL will be set by netlify. Fallback to example.com for local testing.
76+ local BASE=" en-US-${VERSION} "
77+
78+ bash scripts/fetch-docs-assets.sh \
79+ --tag " ${VERSION} " \
80+ --base " /${BASE} /" \
81+ --dest public \
82+ --origin " ${DEPLOY_URL} "
83+ # $DEPLOY_URL will be set by netlify.
10584 # https://docs.netlify.com/build/configure-builds/environment-variables/#deploy-urls-and-metadata
10685
10786 # Build
11291 rm -r public/{docs.json,assets,metadata.json}
11392}
11493
94+ build_en_US v0.14.1
11595build_en_US v0.14.0
11696build_en_US v0.13.1
11797
11898# 3.2. Build ja-JP
11999
100+ # Prepare docs assets
101+ # At present, typst-jp do not translate comments within example code.
102+ # And there is no simple way to download assets from GitHub Actions or the gh-pages branch.
103+ # Therefore, we reuse the assets from the official version.
104+ bash scripts/fetch-docs-assets.sh --tag " v0.13.1" --base " /irrelevant/"
105+ rm public/{docs,metadata}.json
106+
120107# Prepare JSON files
121108mise exec -- bun run fetch-docs-ja-jp
122109sd ' "/docs/' ' "/ja-JP/' public/docs.json
@@ -125,14 +112,6 @@ sd --fixed-strings \
125112 ' "basePath": "/ja-JP/",' \
126113 public/metadata.json
127114
128- # Prepare docs assets
129- # At present, typst-jp do not translate comments within example code.
130- # And there is no simple way to download assets from GitHub Actions or the gh-pages branch.
131- # Therefore, we reuse the assets from the official version.
132- curl -LO https://github.com/typst-community/dev-builds/releases/download/docs-v0.13.1/docs-assets.zip
133- unzip docs-assets.zip && rm docs-assets.zip
134- mv assets public/assets
135-
136115# Build
137116mise exec -- bun run build
138117mv dist _site/ja-JP
0 commit comments