Skip to content

Include index.js in the published package and lint it with publint - #107

Merged
nstepien merged 7 commits into
mainfrom
include-index-js
Oct 17, 2026
Merged

nstepien merged 7 commits into
mainfrom
include-index-js

Conversation

@nstepien

@nstepien nstepien commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Removing the main field in #85 also dropped index.js from the tarball, as files only lists dist and index.d.ts. The plugin leaves the ecij import in place, so builds still resolve it. Packing main and installing it in react-data-grid breaks vp build:

Error: [vite+]: Rolldown failed to resolve import "ecij" from ".../website/routes/ColumnSpanning.tsx".

This adds index.js to files and adds publint as node --run lint:package (publint --strict), which checks every file referenced by package.json against the files npm pack would publish. CI and the release workflow run it after the build, so a missing entry point now fails CI and stops a release.

Verification

  • npm pack --dry-run lists index.js again (7 files).
  • Without the files change, publint fails with pkg.exports["."].default is ./index.js but the file is not published. Is it specified in pkg.files?, with both npm 11 and npm 12. With it, publint reports All good!.
  • With the packed tarball installed in react-data-grid (f7d4e272), vp pack and vp build pass, and all of its tests pass (544 passed, 3 skipped).
  • Compared with ecij 0.5.0, the CSS is byte-identical and the class names are the same. The only JS change is the IIFE class names from Resolve tree-shaking issues with inlineConst #87 in the unminified lib/index.js, which minifiers fold back into strings.

🤖 Generated with Claude Code

Removing the `main` field in #85 also dropped `index.js` from the
tarball, as `files` only lists `dist` and `index.d.ts`. The plugin
leaves the `ecij` import in place, so builds still resolve it, and
`vite build` of react-data-grid fails with:

  Rolldown failed to resolve import "ecij"

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7bb96a27-4e35-466d-aa74-c448cd67c24e
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

nstepien and others added 6 commits October 17, 2026 15:58
Snapshot the files `npm pack` would publish, so a missing entry point
fails the tests, which the release workflow runs before publishing.
npm 12 keys the `--json` output by package name while earlier versions
return an array, so read it with `Object.values()`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace the `npm pack` snapshot test with a script that CI and the
release workflow run after the build: it checks that `npm pack`
includes every file referenced by `exports`, so there is no file list
to keep up to date, and the test suite no longer needs `dist`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The runner images include jq, so the workflow step can compare the
`exports` of package.json with the `npm pack` file list directly.
`shell: bash` enables pipefail, so a failing `npm pack` fails the step
instead of feeding jq empty input.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
publint checks every file referenced by package.json against the files
`npm pack` would publish, whatever the shape of `exports`, and reads the
output of every npm version itself. `node --run lint:package` runs it
with `--strict` after the build, in CI and before releases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nstepien nstepien changed the title Include index.js in the published package Include index.js in the published package and lint it with publint Oct 17, 2026
@nstepien
nstepien merged commit 09ed095 into main Oct 17, 2026
8 checks passed
@nstepien
nstepien deleted the include-index-js branch October 17, 2026 15:57
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.

1 participant