feat: restructure package.json for improved module support and add CI workflow#87
Draft
Kolezhniuk wants to merge 5 commits into
Draft
feat: restructure package.json for improved module support and add CI workflow#87Kolezhniuk wants to merge 5 commits into
Kolezhniuk wants to merge 5 commits into
Conversation
Contributor
Kolezhniuk
commented
Apr 2, 2026
- Updated "exports" field in package.json to support both Node and browser environments.
- Added new scripts for linting, cleaning, and building for both Node and browser.
- Removed Rollup configuration file as Vite is now used for building.
- Introduced a GitHub Actions CI workflow for automated testing.
- Added browser and Node test files using Vitest.
- Created a new ESLint configuration file for consistent code style.
- Implemented a new browser build output for the binfileutils library.
… workflow - Updated "exports" field in package.json to support both Node and browser environments. - Added new scripts for linting, cleaning, and building for both Node and browser. - Removed Rollup configuration file as Vite is now used for building. - Introduced a GitHub Actions CI workflow for automated testing. - Added browser and Node test files using Vitest. - Created a new ESLint configuration file for consistent code style. - Implemented a new browser build output for the binfileutils library.
…ate package.json formatting
There was a problem hiding this comment.
Pull request overview
This PR modernizes @iden3/binfileutils packaging and automation by switching to a Vite-based build, adding conditional exports for Node vs browser consumption, and introducing Vitest + GitHub Actions CI to validate both Node and browser-compatible behavior.
Changes:
- Reworked
package.jsonexports/scripts to publish Node (CJS) and browser (ESM) entrypoints and added lint/clean/test/build scripts. - Added Vite config for dual Node/browser builds and a multi-project Vitest setup (Node + Playwright browser tests).
- Added CI workflow, ESLint flat config, and new Node/browser round-trip tests; removed legacy Rollup + ESLint config.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
vite.config.js |
Adds Vite library build config (Node + browser) and Vitest multi-project configuration. |
test/node.js |
Adds a Node filesystem-based round-trip test. |
test/browser.js |
Adds a browser-compatible in-memory round-trip test (Vitest browser + Playwright). |
rollup.cjs.config.js |
Removes legacy Rollup config in favor of Vite. |
package.json |
Updates conditional exports, scripts, and devDependencies; switches deps to GitHub refs. |
package-lock.json |
Updates lockfile to npm lockfileVersion 3 and new dependency graph. |
eslint.config.js |
Introduces ESLint flat config and build output ignore. |
build/main.cjs |
Updates Node build output artifact. |
build/browser/browser.esm.js |
Adds browser build output artifact. |
.github/workflows/ci.yml |
Adds CI workflow to install deps, install Playwright, and run tests. |
.eslintrc.cjs |
Removes legacy ESLint config in favor of flat config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| test: { | ||
| name: "node-esm", | ||
| include: ["test/**/*.js"], |
Comment on lines
+116
to
+123
| console.time("readSection idSection=" + idSection + " offset=" + offset + " length=" + length); | ||
| if (offset + length > sections[idSection][0].size) throw new Error("Reading out of the range of the section"); | ||
| let buff; | ||
| if (length < MAX_BUFFER_SIZE) buff = new Uint8Array(length); | ||
| else buff = new ffjavascript.BigBuffer(length); | ||
| await fd.readToBuffer(buff, 0, length, sections[idSection][0].p + offset); | ||
| console.timeEnd("readSection idSection=" + idSection + " offset=" + offset + " length=" + length); | ||
| return buff; |
Comment on lines
+261
to
+265
| async function P(t, n, r, i, a) { | ||
| if (i = i === void 0 ? 0 : i, a = a === void 0 ? n[r][0].size - i : a, console.time("readSection idSection=" + r + " offset=" + i + " length=" + a), i + a > n[r][0].size) throw Error("Reading out of the range of the section"); | ||
| let o; | ||
| return o = a < w ? new Uint8Array(a) : new e(a), await t.readToBuffer(o, 0, a, n[r][0].p + i), console.timeEnd("readSection idSection=" + r + " offset=" + i + " length=" + a), o; | ||
| } |
Comment on lines
+15
to
+16
| it("writes and reads a section via tmp file", async () => { | ||
| const tmpPath = path.join(os.tmpdir(), `binfileutils_test_${Date.now()}.bin`); |
Comment on lines
+55
to
+56
| "fastfile": "https://github.com/iden3/fastfile.git#feat/esm-migration", | ||
| "ffjavascript": "https://github.com/iden3/ffjavascript.git#feat/esm-migration" |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.