Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use moduleName() to determine addon's referenced name. #1476

Merged
merged 4 commits into from Feb 4, 2022

Conversation

timlindvall
Copy link
Contributor

In later versions of ember-cli, it's an error for the package's name (in package.json) and the addon name (in index.js) to mismatch. If an addon wants the addon's module name to differ from the NPM package name (for cases where the @namespace/ in the NPM package name could cause issues in Ember), it can declare moduleName().

This PR updates the ts:precompile step so that it references the moduleName() if defined and falls back to addon.name otherwise. This ensures that addons that declare moduleName() and set their paths in tsconfig.json accordingly can emit definition files.

Testing Note

There's some (admittedly hacky) code in the test suite to work around an issue where the test suite wasn't looking up the latest index.js and package.json due to caching in the same process. Without this, the new test passes even if it should fail because its state doesn't reflect what's on disk. @chriskrycho and I paired on this issue and this is the eventual solution we came to as a workaround for now.

This change ensures that the precompile tests that exercise package
naming properly read package.json and index.js from disk. This makes it
so the test fails without the moduleName() fix in the prior commit.
@chriskrycho chriskrycho added the bug label Feb 3, 2022
@chriskrycho chriskrycho merged commit ecc515f into typed-ember:master Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants