Commit 8c96654
authored
Fix ESM compatibility in resolveBinary and add CI smoke test (#743)
Replace bare require.resolve() with createRequire(import.meta.url) to
fix
ReferenceError when running as an ES module (package.json has "type":
"module").
Add an npm test script that imports the built output and calls
resolveBinary()
to catch ESM/CJS incompatibilities before publish.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Low Risk**
> Low risk: small, targeted change to module resolution plus a new CI
test step; main risk is potential path-resolution differences across
Node environments.
>
> **Overview**
> Fixes ESM compatibility in the TypeScript `dbmate` package by
switching `resolveBinary()` to use `createRequire(import.meta.url)` for
`require.resolve()`.
>
> Adds a lightweight `npm test` smoke test (and runs it in the GitHub
Actions NPM job) that imports the built `dist` output and verifies
`resolveBinary()` can resolve the platform binary before `publish`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
538facd. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 0e1e83a commit 8c96654
File tree
3 files changed
+7
-0
lines changed- .github/workflows
- typescript
- packages/dbmate/src
3 files changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
214 | 217 | | |
215 | 218 | | |
216 | 219 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| |||
0 commit comments