Skip to content

feat!: convert ember-headlessui to a v2 addon - #218

Open
Tobzzy wants to merge 1 commit into
GavinJoyce:masterfrom
phorest:feat/v2-addon-packaging
Open

Tobzzy wants to merge 1 commit into
GavinJoyce:masterfrom
phorest:feat/v2-addon-packaging

Conversation

@Tobzzy

@Tobzzy Tobzzy commented Nov 19, 2026

Copy link
Copy Markdown

Summary

Converts ember-headlessui to a v2 addon, built with rollup through @embroider/addon-dev. Consumers keep the same import paths. Classic (non-Embroider) apps keep working through addonV1Shim.

This is the first of three PRs for the v2 conversion:

  1. This PR: v2 packaging, plus the CI changes needed to keep master green
  2. Type declarations, lint config, removal of the remaining v1 files, README
  3. ember-try matrix (Ember 5.12 and 6.x, drop 4.4) and the fix for scenarios not installing their ember-source version

⚠️ Please don't release from master until PR 2 is merged. This PR publishes no .d.ts files yet, so TypeScript consumers would lose the types that 0.18.0 ships.

Changes

Packaging

  • addon/ → src/ (renames only, apart from the import fixes below)
  • index.js → addon-main.cjs using addonV1Shim
  • app/ folder deleted; appReexports generates the same 31 re-exports (28 components, tag-name-is-component, headlessui-focus-trap, dialog-stack-provider)
  • package.json: "ember-addon": { "version": 2 }, files: ["addon-main.cjs", "dist"], and an exports map that resolves ember-headlessui/components/dialog and ember-headlessui/components/dialog.js the same way
  • New rollup.config.mjs and babel.config.json (TypeScript, ember-concurrency/async-arrow-task-transform, template colocation, decorator-transforms)

Imports rollup rejects, now fixed

  • Self-referential ember-headlessui/utils/keyboard and ember-headlessui/services/dialog-stack-provider imports are now relative
  • The ../helpers/transition directory import now points to index.js
  • Extensionless relative imports now have file extensions

Dependencies

  • Removed from the addon: ember-auto-import, ember-cli-babel, ember-cli-htmlbars, ember-cli-typescript, ember-set-helper
  • Added: @embroider/addon-shim, decorator-transforms (dependencies); @embroider/addon-dev, rollup, @rollup/plugin-babel, @babel/plugin-transform-typescript, babel-plugin-ember-template-compilation (devDependencies)
  • test-app now depends on ember-set-helper and ember-truth-helpers directly. It used to get them through the addon.

Tooling

  • ESLint: the shared config's addon/ overrides now apply to src/
  • CI: the tests and try-scenarios jobs build the addon before running tests
  • build:docs builds the addon first, so docs.yml works without changes

Testing

  • pnpm --filter ember-headlessui build succeeds
  • test-app suite against the built addon: 407 tests, 0 failures (354 pass, 18 skip, 35 todo)
  • pnpm lint:js passes in ember-headlessui and test-app
  • pnpm build:docs produces a production build of the test-app
  • pnpm pack contains addon-main.cjs plus dist/, with 31 _app_ re-exports

🤖 Generated with Claude Code

Package the addon in the v2 format, built with rollup via @embroider/addon-dev:

- Move addon/ to src/ and fix the imports rollup rejects (self-referential
  `ember-headlessui/...` imports, the `../helpers/transition` directory import
  and extensionless relative imports)
- Replace index.js with addon-main.cjs (addonV1Shim) so classic builds keep working
- Generate the app re-exports with appReexports instead of the app/ folder
  (same 31 modules as before)
- exports map keeps `ember-headlessui/components/*` resolvable with and
  without the .js suffix
- Drop ember-auto-import, ember-cli-babel, ember-cli-htmlbars,
  ember-cli-typescript and ember-set-helper from the addon's dependencies
- test-app now depends on ember-set-helper and ember-truth-helpers directly
- ESLint addon overrides point at src/
- CI and build:docs build the addon before running the test-app

Type declarations, removal of the remaining v1 files and the ember-try
matrix follow in separate PRs.

R20-887

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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