Skip to content

Publish valid ESM types for dual output packages#120

Merged
cuzzlor merged 5 commits intomainfrom
fix-esm-dual-output-typess
Apr 24, 2026
Merged

Publish valid ESM types for dual output packages#120
cuzzlor merged 5 commits intomainfrom
fix-esm-dual-output-typess

Conversation

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 updates ts-toolkit’s packaging workflow to publish valid TypeScript declarations for dual ESM/CJS outputs and adds an arethetypeswrong export/types validation step to generated templates and this repo’s build.

Changes:

  • Emit conditional exports entries with per-condition types for dual-output packages.
  • Add a build step to validate published artifacts with @arethetypeswrong/cli (attw --pack dist), including wiring it into templates and devDependencies.
  • Add utilities + tests to generate .d.mts/.d.cts siblings and rewrite relative specifiers for ESM declaration resolution.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/util/copy-package-json-from-config.ts Builds new exports shapes and emits dual declaration siblings with ESM-specifier rewriting.
src/util/copy-package-json-from-config.spec.ts Adds tests for conditional exports shapes and declaration emission/rewriting.
src/init/check-packages.ts Ensures @arethetypeswrong/cli is installed in initialized Node projects.
src/init/add-scripts.ts Adds build:* script to run attw against the packed dist output in templates.
package.json Bumps version and adds attw build script + devDependency.
package-lock.json Locks new @arethetypeswrong/cli dependency tree and updates version metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/util/copy-package-json-from-config.ts Outdated
Comment thread src/util/copy-package-json-from-config.ts Outdated
Comment thread src/util/copy-package-json-from-config.spec.ts
Comment thread src/util/copy-package-json-from-config.spec.ts Outdated
Comment thread src/util/copy-package-json-from-config.ts
@cuzzlor cuzzlor merged commit 27e4b4c into main Apr 24, 2026
1 check passed
@cuzzlor cuzzlor deleted the fix-esm-dual-output-typess branch April 24, 2026 05:17
@cuzzlor
Copy link
Copy Markdown
Contributor Author

cuzzlor commented Apr 24, 2026

This worked well

image

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