Skip to content

feat: restructure package.json for improved module support and add CI workflow#87

Draft
Kolezhniuk wants to merge 5 commits into
feature/sharedArrayBuffersfrom
feat/esm-migration
Draft

feat: restructure package.json for improved module support and add CI workflow#87
Kolezhniuk wants to merge 5 commits into
feature/sharedArrayBuffersfrom
feat/esm-migration

Conversation

@Kolezhniuk
Copy link
Copy Markdown
Contributor

  • 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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json exports/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.

Comment thread vite.config.js
{
test: {
name: "node-esm",
include: ["test/**/*.js"],
Comment thread build/main.cjs
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 thread test/node.js
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 thread package.json Outdated
Comment thread package.json
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants