fix: Use moduleName()
to determine addon's referenced name.
#1476
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.
In later versions of
ember-cli
, it's an error for the package's name (inpackage.json
) and the addon name (inindex.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 declaremoduleName()
.This PR updates the
ts:precompile
step so that it references themoduleName()
if defined and falls back toaddon.name
otherwise. This ensures that addons that declaremoduleName()
and set theirpaths
intsconfig.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
andpackage.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.