Skip to content

Commit 14d5f6d

Browse files
committed
fix(ci): align docs formatter with checkout
1 parent 103b30f commit 14d5f6d

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,32 @@ jobs:
8282

8383
- uses: voidzero-dev/setup-vp@13e7afb99c66525824db54e107d667216e795d37 # v1.14.0
8484
with:
85-
# The workspace `vite-plus` version can be ahead of the registry, so
86-
# pin the released build instead of auto-detecting from package.json.
85+
# Install the released package to evaluate `vite.config.ts` without a
86+
# full workspace install. The formatter itself is pinned below to the
87+
# version used by this checkout.
8788
version: latest
8889
run-install: false
8990

90-
- name: Run vp fmt --check
91+
- name: Run oxfmt --check
9192
run: |
92-
# `vp fmt` loads the root vite.config.ts, whose `import ... from 'vite-plus'`
93-
# must resolve at runtime. Link the released package out of the global
94-
# install instead of installing the whole workspace.
95-
mkdir -p node_modules
93+
oxfmt_version="$(awk '$1 == "oxfmt:" { sub(/^=/, "", $2); print $2; exit }' pnpm-workspace.yaml)"
94+
if [[ -z "$oxfmt_version" ]]; then
95+
echo "::error::Could not resolve the workspace oxfmt version"
96+
exit 1
97+
fi
98+
99+
# Keep this job lightweight while using the same formatter version as
100+
# code CI. Oxfmt needs `vite-plus` beside both its CLI and the generated
101+
# config module in order to load the root `fmt` configuration.
102+
oxfmt_dir="$RUNNER_TEMP/docs-fmt-oxfmt"
103+
mkdir -p "$oxfmt_dir" node_modules
104+
pnpm --dir "$oxfmt_dir" add --save-exact "oxfmt@$oxfmt_version"
105+
ln -s "$HOME/.vite-plus/current/node_modules/vite-plus" "$oxfmt_dir/node_modules/vite-plus"
96106
ln -s "$HOME/.vite-plus/current/node_modules/vite-plus" node_modules/vite-plus
97-
vp fmt --check
107+
108+
VP_VERSION="$(node -p "require(process.env.HOME + '/.vite-plus/current/node_modules/vite-plus/package.json').version")" \
109+
VP_RESOLVING_CONFIG_METADATA=1 \
110+
"$oxfmt_dir/node_modules/.bin/oxfmt" --check --disable-nested-config
98111
99112
download-previous-rolldown-binaries:
100113
needs: detect-changes

0 commit comments

Comments
 (0)