Conversation
Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
|
@copilot new build step actually failed, have a look |
…build Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
Fixed in e42a035. The npm build was failing due to two issues:
The fix removes the CJS build (ESM-only now) and adds |
There was a problem hiding this comment.
Pull request overview
This PR adds an npm build step to CI (so deno task build:dist failures are caught before release) and updates the build/package configuration to make the npm artifact ESM-only and avoid the previous build-time failures.
Changes:
- Added an
npm_buildjob to.github/workflows/test.ymlto rundeno task build:diston PRs/pushes. - Updated
build/build.tsto produce only an ESM Node bundle and to adjust esbuild externals. - Updated
build/package.template.jsonto publish ESM-only exports for the generated npmpackage.json.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/workflows/test.yml |
Adds an npm build job to CI to run deno task build:dist. |
build/build.ts |
Removes CJS + d.ts generation and switches to a single ESM build with updated externals. |
build/package.template.json |
Updates npm package metadata/exports to be ESM-only. |
Comments suppressed due to low confidence (1)
build/build.ts:70
- The
buildcommand path no longer generates type declarations (the dts plugin/CJS build were removed), but the surrounding comment still says “Transpile and generate typings”. Updating this wording will help keep the build script’s guidance accurate.
/* Handle argument `build`: Transpile and generate typings */
} else if (command === "build") {
// Build the ESM JavaScript bundle
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
build/build.ts
Outdated
| // @cross/runtime is a JSR dependency that must be externalized | ||
| external: ["bun:test", "node:test", "@cross/runtime"], |
There was a problem hiding this comment.
@cross/runtime is now marked as an esbuild external, which means the generated dist/mod.js will keep import "@cross/runtime" at runtime. The npm package template currently doesn’t declare any dependency/peerDependency on @cross/runtime, so consumers installing from npm will likely hit a Cannot find package '@cross/runtime' error unless they manually install it. Consider either bundling @cross/runtime (remove it from external) or adding it to the generated package.json (dependencies/peerDependencies) with a version aligned to deno.json.
| // @cross/runtime is a JSR dependency that must be externalized | |
| external: ["bun:test", "node:test", "@cross/runtime"], | |
| external: ["bun:test", "node:test"], |
| with: | ||
| deno-version: v2.x | ||
| - name: Build npm package | ||
| run: deno task build:dist |
There was a problem hiding this comment.
The new npm_build job only checks that deno task build:dist completes. It doesn’t validate that the produced Node artifact can actually be loaded (e.g., a simple node -e "import('./dist/mod.js')" or importing the generated package entry). Adding a minimal runtime smoke-check here would catch externals/dependency mismatches that still allow bundling to succeed.
| run: deno task build:dist | |
| run: deno task build:dist | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| - name: Smoke test Node artifact | |
| run: node -e "import('./dist/mod.js')" |
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: Hexagon <419737+Hexagon@users.noreply.github.com>
Applied both review suggestions in 41563b6:
|
The npm build (
deno task build:dist) was only run during publish, meaning build failures wouldn't be caught until release time.Changes
npm_buildjob to.github/workflows/test.ymlwith a Node.js smoke test to verify the artifact loads correctlypublish.yml(same Deno version, setup action, permissions)@cross/runtimedirectly (instead of externalizing it, which would break npm consumers)npm.tsas a Node.js-only entry point so only the Node.js shim is bundled (avoids includingbun:test/Deno-specific static imports that would fail at load time in Node.js)build/package.template.jsonto ESM-only exports referencingdist/npm.jsnpm.tsfrom JSR publishOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.