Publish dual ESM and CommonJS outputs#128
Open
Fryuni wants to merge 8 commits into
Open
Conversation
|
👋 @Fryuni Thanks for your contribution! The approval and merge process is almost fully automated 🧙 Here's how it works:
☝️ Lastly, the title for the commit will come from the pull request title. So please provide a descriptive title that summarizes the changes in 50 characters or less using the imperative mood. Happy coding! 🎉 |
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.
What Changed
type: "module",tsupbuilds, and dual import/require entry points for ESM and CommonJS consumers.Risk Assessment
Testing
The first Jest baseline run failed because the ESM test environment did not expose the global
jest; after adding a test-only setup file, the full Jest suite passed, the package build/export contract passed, and a manual consumer-style ESM/CJS import check produced evidence showing the expected cache exports and methods are usable.Evidence: ESM and CJS package consumer import transcript
{ "esm": { "inMemory": {"exportType": "function", "hasGet": true, "hasSet": true, "hasDelete": true}, "noop": {"exportType": "function", "hasGet": true, "hasSet": true, "hasDelete": true} }, "cjs": { "inMemory": {"exportType": "function", "hasGet": true, "hasSet": true, "hasDelete": true}, "noop": {"exportType": "function", "hasGet": true, "hasSet": true, "hasDelete": true} } }Pipeline
Updates from git push no-mistakes
⏭️ **intent** - skipped
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed ✅
tsup.config.ts:19- The old build usedtsc -p tsconfig.build.jsonto emit declarations, but the newtsupconfig only builds JS and never enables declaration output whilepackage.jsonpointstypes/export type conditions atbuild/index.d.tsandbuild/index.d.cts; published TypeScript consumers will resolve to files that are not produced.package.json:26- Adding anexportsmap with only"."removes previously publishable subpath entry points such as@croct/cache/inMemorythat existed because the oldtscbuild emitted every source module and published without an exports map; existing deep-import consumers will now fail with package subpath export errors unless this is an intentional breaking release.README.md:223- The README now tells maintainers to runnpm run test:package, butpackage.jsondoes not define that script, so the documented package-contract verification command fails immediately.🔧 Fix: Restore package contract exports
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm test -- --runInBand(initial run exposed ESM Jest global setup failure)Addedtest/setup-jest.mjsand referenced it fromjest.config.mjsso existing tests can usejest.fn/jest.spyOnin ESM modenpm test -- --runInBandnpm run test:packagenode --input-type=module -e "import {createRequire} from 'node:module'; import {InMemoryCache as EsmInMemoryCache} from '@croct/cache/inMemory'; import {NoopCache as EsmNoopCache} from '@croct/cache'; const require = createRequire(import.meta.url); const {InMemoryCache: CjsInMemoryCache} = require('@croct/cache/inMemory'); const {NoopCache: CjsNoopCache} = require('@croct/cache'); const describeCache = Cache => ({exportType: typeof Cache, hasGet: typeof new Cache().get === 'function', hasSet: typeof new Cache().set === 'function', hasDelete: typeof new Cache().delete === 'function'}); console.log(JSON.stringify({esm:{inMemory:describeCache(EsmInMemoryCache), noop:describeCache(EsmNoopCache)}, cjs:{inMemory:describeCache(CjsInMemoryCache), noop:describeCache(CjsNoopCache)}}, null, 2));" > /tmp/no-mistakes-evidence/01KWFDTZK94WTS2XEYQ8S5JR56/package-consumer-transcript.jsonRemoved generatedbuild/andcoverage/directories after verification✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.