Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions scripts/vercel-build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
set -e

# Use the tag captured during the prepare step as the docs version, so the
# output reflects the nodejs/node release it was generated from (e.g. v26.0.0)
# rather than the Node.js runtime version running this build (process.version).
NODE_VERSION=$(cat .node-tag)

node bin/cli.mjs generate \
-t orama-db \
-t legacy-json \
Expand All @@ -6,10 +13,12 @@ node bin/cli.mjs generate \
-i "./node/doc/api/*.md" \
-o "./out" \
-c "./node/CHANGELOG.md" \
-v "$NODE_VERSION" \
Comment thread
avivkeller marked this conversation as resolved.
--type-map "./node/doc/type-map.json" \
--index "./node/doc/api/index.md" \
--log-level debug

cp ./node/doc/api/*.md "./out"

rm -rf node/
rm -f .node-tag
23 changes: 21 additions & 2 deletions scripts/vercel-prepare.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Clone the repository with no checkout and shallow history
git clone --depth 1 --filter=blob:none --sparse https://github.com/nodejs/node.git
set -e

# Determine the latest stable release tag on nodejs/node (skip pre-releases
# like `-rc`/`-nightly`, taking the highest version-sorted tag).
LATEST_TAG=$(git ls-remote --tags --refs --sort='-v:refname' \
https://github.com/nodejs/node.git 'v*' \
| awk -F/ '$NF !~ /-/ { print $NF; exit }')

if [ -z "$LATEST_TAG" ]; then
echo "Could not determine the latest nodejs/node release tag" >&2
exit 1
fi

# Persist the tag so the build step can use it as the docs version
echo "$LATEST_TAG" > .node-tag

echo "Building docs for nodejs/node $LATEST_TAG"

# Clone the repository at that tag with no checkout and shallow history
git clone --depth 1 --branch "$LATEST_TAG" --filter=blob:none --sparse \
https://github.com/nodejs/node.git

# Move into the cloned directory
cd node
Expand Down
Loading