Skip to content

Commit c4dd9af

Browse files
authored
chore: disable vitest interopDefault, remove dotenvx (#587)
* fix: handle @babel/traverse CJS-ESM interop in .mts files @babel/traverse is a CJS package that exports { default: fn }. In Node ESM (.mts), `import traverse from '@babel/traverse'` resolves to the module object, not the function, causing "traverse is not a function" at runtime. Use `_traverse.default ?? _traverse` to unwrap correctly. * chore: remove dotenvx, simplify pre-commit hook Replace dotenvx with plain pnpm test in pre-commit hook. Remove @dotenvx/dotenvx devDependency (unused outside hook). * fix: remove unnecessary CJS interop hack for @babel/traverse * fix: use ssr.external for @babel/traverse instead of CJS interop hack Let Node handle @babel/traverse as native CJS instead of having vite transpile it. This makes the plain default import work correctly. * fix: resolve @babel/traverse CJS interop for both native and vite contexts The ssr.external approach only works for single-file runs, not the full suite with isolate: false. Use runtime typeof check to handle both native CJS resolution and vite's SSR transform. * fix: use .default fallback for @babel/traverse CJS import Vite's SSR transform wraps CJS module.exports as .default, so the traverse function ends up at traverseModule.default. Use a simple fallback pattern that works in both vite and native Node contexts. * chore(ci): simplify CI to use socket-registry reusable workflow (eb53b17d) * fix: use named default import for @babel/traverse, drop interopDefault import { default as traverse } works correctly with vite's SSR transform and has proper types. Remove deps.interopDefault: false from both vitest configs — the default (true) handles CJS interop correctly. * fix: use socket-registry's own pinned SHA for action references Use f9f6e265 (the SHA socket-registry uses internally) instead of eb53b17d which zizmor can't verify via impostor-commit check.
1 parent 0e600f7 commit c4dd9af

7 files changed

Lines changed: 14 additions & 194 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@ on:
1414
permissions:
1515
contents: read
1616

17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
1721
jobs:
1822
ci:
1923
name: Run CI Pipeline
20-
uses: SocketDev/socket-registry/.github/workflows/ci.yml@b86b2cb3fefa4ffa6c1a702476f9785f6c3bb887 # main
24+
uses: SocketDev/socket-registry/.github/workflows/ci.yml@bbe46386c0a2bc6baefd02916234956a38e622d5 # main
2125
with:
22-
fail-fast: false
23-
lint-script: 'pnpm run lint --all'
24-
node-versions: '["24.10.0"]'
25-
os-versions: '["ubuntu-latest", "macos-latest", "windows-latest"]'
2626
test-script: 'pnpm run test --all --skip-build'
27-
test-setup-script: 'pnpm run build'
28-
type-check-script: 'pnpm run type'
29-
type-check-setup-script: 'pnpm run build'

.github/workflows/generate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ jobs:
4545
echo "Sleeping for $delay seconds..."
4646
sleep $delay
4747
48-
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@b86b2cb3fefa4ffa6c1a702476f9785f6c3bb887 # main
48+
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@bbe46386c0a2bc6baefd02916234956a38e622d5 # main
4949

5050
- name: Configure push credentials
5151
env:
5252
GH_TOKEN: ${{ github.token }}
5353
run: git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
5454

55-
- uses: SocketDev/socket-registry/.github/actions/setup-git-signing@b86b2cb3fefa4ffa6c1a702476f9785f6c3bb887 # main
55+
- uses: SocketDev/socket-registry/.github/actions/setup-git-signing@bbe46386c0a2bc6baefd02916234956a38e622d5 # main
5656
with:
5757
gpg-private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
5858

@@ -122,5 +122,5 @@ jobs:
122122
gh pr reopen "$pr_number"
123123
fi
124124
125-
- uses: SocketDev/socket-registry/.github/actions/cleanup-git-signing@b86b2cb3fefa4ffa6c1a702476f9785f6c3bb887 # main
125+
- uses: SocketDev/socket-registry/.github/actions/cleanup-git-signing@bbe46386c0a2bc6baefd02916234956a38e622d5 # main
126126
if: always()

.github/workflows/provenance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
permissions:
3131
contents: write # To create GitHub releases
3232
id-token: write # For npm trusted publishing via OIDC
33-
uses: SocketDev/socket-registry/.github/workflows/provenance.yml@b86b2cb3fefa4ffa6c1a702476f9785f6c3bb887 # main
33+
uses: SocketDev/socket-registry/.github/workflows/provenance.yml@bbe46386c0a2bc6baefd02916234956a38e622d5 # main
3434
with:
3535
debug: ${{ inputs.debug }}
3636
dist-tag: ${{ inputs.dist-tag }}

.github/workflows/weekly-update.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
outputs:
2525
has-updates: ${{ steps.check.outputs.has-updates }}
2626
steps:
27-
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@b86b2cb3fefa4ffa6c1a702476f9785f6c3bb887 # main
27+
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@bbe46386c0a2bc6baefd02916234956a38e622d5 # main
2828

2929
- name: Check for npm updates
3030
id: check
@@ -48,7 +48,7 @@ jobs:
4848
contents: write
4949
pull-requests: write
5050
steps:
51-
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@b86b2cb3fefa4ffa6c1a702476f9785f6c3bb887 # main
51+
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@bbe46386c0a2bc6baefd02916234956a38e622d5 # main
5252

5353
- name: Create update branch
5454
id: branch
@@ -60,7 +60,7 @@ jobs:
6060
git checkout -b "$BRANCH_NAME"
6161
echo "branch=$BRANCH_NAME" >> $GITHUB_OUTPUT
6262
63-
- uses: SocketDev/socket-registry/.github/actions/setup-git-signing@b86b2cb3fefa4ffa6c1a702476f9785f6c3bb887 # main
63+
- uses: SocketDev/socket-registry/.github/actions/setup-git-signing@bbe46386c0a2bc6baefd02916234956a38e622d5 # main
6464
with:
6565
gpg-private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
6666

@@ -306,7 +306,7 @@ jobs:
306306
test-output.log
307307
retention-days: 7
308308

309-
- uses: SocketDev/socket-registry/.github/actions/cleanup-git-signing@b86b2cb3fefa4ffa6c1a702476f9785f6c3bb887 # main
309+
- uses: SocketDev/socket-registry/.github/actions/cleanup-git-signing@bbe46386c0a2bc6baefd02916234956a38e622d5 # main
310310
if: always()
311311

312312
notify:

.husky/pre-commit

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ else
88
fi
99

1010
if [ -z "${DISABLE_PRECOMMIT_TEST}" ]; then
11-
# Use .env.precommit if it exists, otherwise proceed without it
12-
if [ -f ".env.precommit" ]; then
13-
pnpm exec dotenvx -q run -f .env.precommit -- pnpm test --staged
14-
else
15-
pnpm test --staged
16-
fi
11+
pnpm test --staged
1712
else
1813
echo "Skipping testing due to DISABLE_PRECOMMIT_TEST env var"
1914
fi

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"@babel/parser": "7.26.3",
7171
"@babel/traverse": "7.26.4",
7272
"@babel/types": "7.26.3",
73-
"@dotenvx/dotenvx": "1.54.1",
7473
"@oxlint/migrate": "1.52.0",
7574
"@socketsecurity/lib": "5.18.2",
7675
"@sveltejs/acorn-typescript": "1.0.8",

0 commit comments

Comments
 (0)