Modernize tooling: tsdx → tsup, vitest, ESM exports, CI#483
Merged
Conversation
- Replace abandoned tsdx 0.14 with tsup (ESM + CJS + dts, 'use client' banner for React Server Components environments) and vitest - Add proper package.json exports map with per-condition types, sideEffects: false, and engines >= 18 (was >= 10) - Pin @unlayer/types to ^1.448.0 instead of "latest" (#469) - Bump TypeScript 4.9 → 6.0, React dev deps to 19, correct react peer range to >=16.8 (component uses hooks) - Fix unmount cleanup never destroying the editor (stale closure) and the event-listener effect depending on array indices instead of names - Expand tests: editor creation, ref/onLoad, event registration, destroy - Add GitHub Actions CI (Node 20/22/24 × React 18/19), dependabot, and issue templates routing editor questions to Unlayer support - Remove dead husky v4-style config that husky 8 never executed - README: createRoot instead of removed react-dom render, Next.js note, CI badge Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Enforce vitest coverage thresholds (95% stmts/lines, 90% branches/funcs) - Cover loadScript.ts directly (injection dedupe, callback queue, custom URL) - Scope test discovery to test/ and coverage to src/ - Upload lcov to Codecov from CI; add coverage badge to README Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
- unlayer.com/help was a 404; support links now point to unlayer.com/contact - Update docs.unlayer.com URLs to their post-restructure destinations - Use https for the video thumbnail image Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
adeelraza
force-pushed
the
modernize-tooling
branch
from
July 6, 2026 19:33
82d8df2 to
04fef4c
Compare
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The main suite can't run on React <18 (@testing-library/react requires 18+), so these render with the legacy ReactDOM.render API directly and cover mount + createEditor, ref/onLoad, and destroy-on-unmount. CI runs them via npm run test:legacy on react@16 and react@17. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.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.
Why
The repo's toolchain had drifted: tsdx has been abandoned for years, there was no ESM entry point, no CI, and
@unlayer/typesfloated onlatest. This PR is the foundation pass — build, packaging, tests, and repo automation — so follow-ups (demo modernization, release automation) have something solid to build on.What changed
Build & packaging
'use client'banner, so it works out of the box in Next.js App Router / RSC apps (How to Edit custom options on nextjs #458).exportsmap with per-condition types (index.d.mts/index.d.ts),sideEffects: false,modulefield. Verified withpublintand@arethetypeswrong/cli— all green across node10/node16/bundler resolution modes.@unlayer/typespinned to^1.448.0instead oflatest(fixes Pin unlayer-types Dependency to a Fixed Version Instead of latest #469).engines.node>= 18 (was >= 10).>=15to>=16.8— the component uses hooks, so React 15/16.7 never worked.Bug fixes (found while migrating)
editorstate (alwaysnull), soeditor.destroy()was never called on unmount. Now tracked via a ref.Object.keys(methodProps).join(',')— array indices, not prop names — so it re-ran on the count ofon*props rather than their identity. NowmethodProps.join(',').Tests
onLoad,on*event registration,onReadywiring, and destroy-on-unmount (which catches the bug above).Repo automation
README
renderfromreact-dom(removed in React 19) — nowcreateRoot.mainbranch.Release plan
🤖 Generated with Claude Code