Skip to content

Commit cc901ec

Browse files
fix(vercel): update vercel scripts to build against latest Node.js release tag (#888)
1 parent 7bf9efc commit cc901ec

2 files changed

Lines changed: 30 additions & 2 deletions

File tree

scripts/vercel-build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
set -e
2+
3+
# Use the tag captured during the prepare step as the docs version, so the
4+
# output reflects the nodejs/node release it was generated from (e.g. v26.0.0)
5+
# rather than the Node.js runtime version running this build (process.version).
6+
NODE_VERSION=$(cat .node-tag)
7+
18
node bin/cli.mjs generate \
29
-t orama-db \
310
-t legacy-json \
@@ -6,10 +13,12 @@ node bin/cli.mjs generate \
613
-i "./node/doc/api/*.md" \
714
-o "./out" \
815
-c "./node/CHANGELOG.md" \
16+
-v "$NODE_VERSION" \
917
--type-map "./node/doc/type-map.json" \
1018
--index "./node/doc/api/index.md" \
1119
--log-level debug
1220

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

1523
rm -rf node/
24+
rm -f .node-tag

scripts/vercel-prepare.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1-
# Clone the repository with no checkout and shallow history
2-
git clone --depth 1 --filter=blob:none --sparse https://github.com/nodejs/node.git
1+
set -e
2+
3+
# Determine the latest stable release tag on nodejs/node (skip pre-releases
4+
# like `-rc`/`-nightly`, taking the highest version-sorted tag).
5+
LATEST_TAG=$(git ls-remote --tags --refs --sort='-v:refname' \
6+
https://github.com/nodejs/node.git 'v*' \
7+
| awk -F/ '$NF !~ /-/ { print $NF; exit }')
8+
9+
if [ -z "$LATEST_TAG" ]; then
10+
echo "Could not determine the latest nodejs/node release tag" >&2
11+
exit 1
12+
fi
13+
14+
# Persist the tag so the build step can use it as the docs version
15+
echo "$LATEST_TAG" > .node-tag
16+
17+
echo "Building docs for nodejs/node $LATEST_TAG"
18+
19+
# Clone the repository at that tag with no checkout and shallow history
20+
git clone --depth 1 --branch "$LATEST_TAG" --filter=blob:none --sparse \
21+
https://github.com/nodejs/node.git
322

423
# Move into the cloned directory
524
cd node

0 commit comments

Comments
 (0)