Skip to content

Commit 45cf654

Browse files
committed
chore(deps): upgrade vite-plus to 0.2.1
v0.2.1 consumes upstream Vitest directly; the @voidzero-dev/vite-plus-test wrapper is removed and vitest (4.1.9) now arrives transitively through vite-plus. No source changes needed since all tests already import from the stable vite-plus/test API. Reinstall drops the wrapper from the lockfile and resolves to a single vitest version. Commit pnpm-workspace.yaml with a minimumReleaseAgeExclude for the Vite+ toolchain. vp 0.2.x's lockfile verifier rejects packages published within the last 24h, so installing a brand-new vite-plus release otherwise fails `vp install` (ERR_PNPM_MINIMUM_RELEASE_AGE_VIOLATION); the verifier reads the exclude only from pnpm-workspace.yaml. A glob exclude keeps it release-agnostic. Move the CI fixtures that run vp (test-node-version, test-vp-install-and-exec, test-sfw, test-sfw-alpine, test-sfw-blocks-malicious, test-sfw-with-socketdev-action) out of the repo. With pnpm-workspace.yaml committed, a fixture inside the repo would be treated as part of this repo's workspace and vp run/install would resolve to the repo root. Most jobs use $RUNNER_TEMP; the alpine container job uses /tmp since ${{ runner.temp }} is a host path that does not exist inside the container. The cache-* jobs keep ./test-project (they never run vp in the fixture, and @actions/glob hashFiles only hashes paths under GITHUB_WORKSPACE).
1 parent a268c9c commit 45cf654

5 files changed

Lines changed: 696 additions & 371 deletions

File tree

.github/workflows/test.yml

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,27 @@ jobs:
5050
steps:
5151
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
5252

53+
# Create the throwaway fixture under $RUNNER_TEMP, outside the repo. The
54+
# repo commits a pnpm-workspace.yaml (for the release-age exclude), so a
55+
# fixture inside the repo would be treated as part of this repo's
56+
# workspace and `vp install`/`vp run` would resolve to the repo root.
57+
# ${RUNNER_TEMP//\\//} normalizes Windows backslashes for bash.
5358
- name: Create test project
59+
shell: bash
5460
run: |
55-
mkdir -p test-project
56-
cd test-project
61+
DIR="${RUNNER_TEMP//\\//}/test-project"
62+
mkdir -p "$DIR"
5763
# Pin pnpm to v10. Vite+'s bundled pnpm 11 requires node:sqlite
5864
# (Node >= 22.5) and crashes on Node 20; pnpm 10 still runs on Node 20.
59-
echo '{"name":"test-project","private":true,"packageManager":"pnpm@10.34.3"}' > package.json
65+
echo '{"name":"test-project","private":true,"packageManager":"pnpm@10.34.3"}' > "$DIR/package.json"
6066
6167
# Runs `vp env use <version>` then `vp install` in the test project.
6268
- name: Setup Vite+ with Node.js ${{ matrix.node-version }}
6369
uses: ./
6470
with:
6571
node-version: ${{ matrix.node-version }}
6672
run-install: |
67-
- cwd: test-project
73+
- cwd: ${{ runner.temp }}/test-project
6874
cache: false
6975

7076
- name: Verify installation
@@ -214,26 +220,28 @@ jobs:
214220
steps:
215221
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
216222

223+
# Fixture lives under $RUNNER_TEMP (outside the repo) so the committed
224+
# pnpm-workspace.yaml doesn't make vp resolve it to the repo root.
217225
- name: Create test project
218226
shell: bash
219227
run: |
220-
mkdir -p test-project
221-
cd test-project
222-
echo '{"name":"test-project","private":true,"scripts":{"hello":"node -e \"console.log(1+1)\""}}' > package.json
228+
DIR="${RUNNER_TEMP//\\//}/test-project"
229+
mkdir -p "$DIR"
230+
echo '{"name":"test-project","private":true,"scripts":{"hello":"node -e \"console.log(1+1)\""}}' > "$DIR/package.json"
223231
224232
- name: Setup Vite+ with install
225233
uses: ./
226234
with:
227235
run-install: |
228-
- cwd: test-project
236+
- cwd: ${{ runner.temp }}/test-project
229237
cache: false
230238

231239
- name: Verify vp exec in project
232-
working-directory: test-project
240+
working-directory: ${{ runner.temp }}/test-project
233241
run: vp exec node -e "console.log('vp exec in project works')"
234242

235243
- name: Verify vp run in project
236-
working-directory: test-project
244+
working-directory: ${{ runner.temp }}/test-project
237245
run: vp run hello
238246

239247
test-registry-url:
@@ -309,6 +317,8 @@ jobs:
309317
steps:
310318
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
311319

320+
# Fixture lives under $RUNNER_TEMP (outside the repo) so the committed
321+
# pnpm-workspace.yaml doesn't make vp resolve it to the repo root.
312322
- name: Create test project for ${{ matrix.package-manager }}
313323
shell: bash
314324
run: |
@@ -319,10 +329,10 @@ jobs:
319329
bun) LOCKFILE=bun.lock; CONTENTS='' ;;
320330
*) echo "Unsupported package-manager: ${{ matrix.package-manager }}" >&2; exit 1 ;;
321331
esac
322-
mkdir -p test-project
323-
cd test-project
324-
echo '{"name":"test-project","private":true,"dependencies":{"is-odd":"^3.0.1"}}' > package.json
325-
printf '%s' "$CONTENTS" > "$LOCKFILE"
332+
DIR="${RUNNER_TEMP//\\//}/test-project"
333+
mkdir -p "$DIR"
334+
echo '{"name":"test-project","private":true,"dependencies":{"is-odd":"^3.0.1"}}' > "$DIR/package.json"
335+
printf '%s' "$CONTENTS" > "$DIR/$LOCKFILE"
326336
327337
- name: Configure Yarn .yarnrc.yml (Linux + yarn only)
328338
if: matrix.package-manager == 'yarn' && runner.os == 'Linux'
@@ -338,21 +348,21 @@ jobs:
338348
{
339349
echo "nodeLinker: node-modules"
340350
echo "enableImmutableInstalls: false"
341-
} > test-project/.yarnrc.yml
351+
} > "${RUNNER_TEMP//\\//}/test-project/.yarnrc.yml"
342352
343353
- name: Setup Vite+ with sfw + ${{ matrix.package-manager }}
344354
uses: ./
345355
with:
346356
sfw: true
347357
run-install: |
348-
- cwd: test-project
358+
- cwd: ${{ runner.temp }}/test-project
349359
cache: false
350360

351361
- name: Verify sfw is on PATH
352362
run: sfw --version
353363

354364
- name: Verify dependency installed via ${{ matrix.package-manager }}
355-
working-directory: test-project
365+
working-directory: ${{ runner.temp }}/test-project
356366
run: vp exec node -e "console.log(require('is-odd')(3))"
357367

358368
test-sfw-alpine:
@@ -371,25 +381,31 @@ jobs:
371381

372382
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
373383

384+
# Fixture lives outside the repo so the committed pnpm-workspace.yaml
385+
# doesn't make vp resolve it to the repo root. This is a container job:
386+
# ${{ runner.temp }} would expand to the HOST path, but the shell and the
387+
# action both run inside the container (where RUNNER_TEMP maps to /__w/_temp),
388+
# so a host path passed via YAML wouldn't exist in the container. Use a
389+
# literal in-container path (/tmp, outside the /__w workspace mount) that
390+
# needs no host<->container translation.
374391
- name: Create test project with a real dependency
375392
run: |
376-
mkdir -p test-project
377-
cd test-project
378-
echo '{"name":"test-project","private":true,"dependencies":{"is-odd":"^3.0.1"}}' > package.json
393+
mkdir -p /tmp/test-project
394+
echo '{"name":"test-project","private":true,"dependencies":{"is-odd":"^3.0.1"}}' > /tmp/test-project/package.json
379395
380396
- name: Setup Vite+ with sfw (musl)
381397
uses: ./
382398
with:
383399
sfw: true
384400
run-install: |
385-
- cwd: test-project
401+
- cwd: /tmp/test-project
386402
cache: false
387403

388404
- name: Verify sfw is on PATH (musl)
389405
run: sfw --version
390406

391407
- name: Verify dependency installed under sfw (musl)
392-
working-directory: test-project
408+
working-directory: /tmp/test-project
393409
run: vp exec node -e "console.log(require('is-odd')(3))"
394410

395411
test-sfw-blocks-malicious:
@@ -415,24 +431,26 @@ jobs:
415431
steps:
416432
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
417433

434+
# Fixture lives under $RUNNER_TEMP (outside the repo) so the committed
435+
# pnpm-workspace.yaml doesn't make vp resolve it to the repo root.
418436
- name: Create test project with a benign dependency
419437
shell: bash
420438
run: |
421-
mkdir -p test-project
422-
cd test-project
423-
echo '{"name":"test-project","private":true,"dependencies":{"is-odd":"^3.0.1"}}' > package.json
439+
DIR="${RUNNER_TEMP//\\//}/test-project"
440+
mkdir -p "$DIR"
441+
echo '{"name":"test-project","private":true,"dependencies":{"is-odd":"^3.0.1"}}' > "$DIR/package.json"
424442
425443
- name: Setup Vite+ with sfw and install benign dep
426444
uses: ./
427445
with:
428446
sfw: true
429447
run-install: |
430-
- cwd: test-project
448+
- cwd: ${{ runner.temp }}/test-project
431449
cache: false
432450

433451
- name: Assert sfw blocks malicious package (lodahs typosquat of lodash)
434452
shell: bash
435-
working-directory: test-project
453+
working-directory: ${{ runner.temp }}/test-project
436454
# Exit code alone isn't sufficient: a non-zero exit from npm 404,
437455
# network blip, or vp crash would also produce a false positive. We
438456
# also require the literal sfw block-line for lodahs in the combined
@@ -473,12 +491,14 @@ jobs:
473491
steps:
474492
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
475493

494+
# Fixture lives under $RUNNER_TEMP (outside the repo) so the committed
495+
# pnpm-workspace.yaml doesn't make vp resolve it to the repo root.
476496
- name: Create test project with a real dependency
477497
shell: bash
478498
run: |
479-
mkdir -p test-project
480-
cd test-project
481-
echo '{"name":"test-project","private":true,"dependencies":{"is-odd":"^3.0.1"}}' > package.json
499+
DIR="${RUNNER_TEMP//\\//}/test-project"
500+
mkdir -p "$DIR"
501+
echo '{"name":"test-project","private":true,"dependencies":{"is-odd":"^3.0.1"}}' > "$DIR/package.json"
482502
483503
- name: Install sfw via socketdev/action
484504
uses: socketdev/action@ba6de6cc0565af1f42295590380973573297e31f
@@ -491,7 +511,7 @@ jobs:
491511
with:
492512
sfw: true
493513
run-install: |
494-
- cwd: test-project
514+
- cwd: ${{ runner.temp }}/test-project
495515
cache: false
496516

497517
- name: Verify setup-vp used the composed sfw (no bundled download)
@@ -509,12 +529,12 @@ jobs:
509529
echo "OK: setup-vp used the pre-installed sfw (no bundled download at \$RUNNER_TEMP/sfw-bin/)"
510530
511531
- name: Verify dependency installed under composed sfw
512-
working-directory: test-project
532+
working-directory: ${{ runner.temp }}/test-project
513533
run: vp exec node -e "console.log(require('is-odd')(3))"
514534

515535
- name: Assert composed sfw blocks malicious package (lodahs)
516536
shell: bash
517-
working-directory: test-project
537+
working-directory: ${{ runner.temp }}/test-project
518538
# Proves the composition path actually enforces, not just that sfw is
519539
# present. socketdev/action exports SFW_JSON_REPORT_PATH into the env,
520540
# which makes sfw write its block report to JSON instead of stdout —

0 commit comments

Comments
 (0)