[Feature] Update initializer blueprint for module unification#16489
[Feature] Update initializer blueprint for module unification#16489rwjblue merged 1 commit intoemberjs:masterfrom
Conversation
| ); | ||
|
|
||
| expect(_file('src/init/initializers/foo/bar-test.js')).to.contain( | ||
| "import { initialize } from 'my-app/initializers/foo/bar';" |
There was a problem hiding this comment.
I think this will have to change to point to the new path under src
There was a problem hiding this comment.
I came to this PR looking for how to do that, haha. I'm in the same situation where my tests are passing without updating the import statement and I'm not sure why 🤔 Or where the import statement is generated.
|
Perhaps update the title to be |
|
We'll also need to add tests to initializer-test-test.js to ensure that we're generating co-located tests. I manually tried this in a local MU app and it seems to fail with a LMK if you'd like to pair on this |
For the purpose of making progress in the PR, I think a good assumption is that they should follow the same rules as apps. If we hit any barriers when implementing, we can raise it. |
|
@sduquej ^ that's been resolved, perhaps you could rebase? Also, could you add an in-repo-addon test similar to this? This will ensure that we're not breaking existing functionality. |
93ad120 to
916981f
Compare
|
👍 I've rebased. |
03a4396 to
98c2e32
Compare
| import Application from '@ember/application'; | ||
| import { run } from '@ember/runloop'; | ||
|
|
||
| import { initialize } from 'my-app/init/initializers/foo'; |
There was a problem hiding this comment.
the addition of init/ is the only new thing in these fixture files.
There's a possibility that they can get out of date if changes to the classic fixtures happened. While not ideal the risk seems minimum given how infrequent these type of changes are and duplicating these has the upside of easier clean-up and similarity to what was done in ember-cli
98c2e32 to
f3cd9ff
Compare
blueprints/initializer-test/index.js
Outdated
| if (options.pod) { | ||
| throw 'Pods arenʼt supported within a module unification app'; | ||
| } else if (options.inDummy) { | ||
| return path.join('tests', 'dummy', 'src/init'); |
There was a problem hiding this comment.
return path.join('tests', 'dummy', 'src', 'init'); perhaps?
blueprints/initializer-test/index.js
Outdated
| } else if (options.inDummy) { | ||
| return path.join('tests', 'dummy', 'src/init'); | ||
| } | ||
| return 'src/init'; |
There was a problem hiding this comment.
return path.join('src', 'init'); perhaps?
| import { run } from '@ember/runloop'; | ||
| import Application from '@ember/application'; | ||
| import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>'; | ||
| import { initialize } from '<%= dasherizedModulePrefix %>/<% if (isModuleUnificationProject) { %>init/<% } %>initializers/<%= dasherizedModuleName %>'; |
There was a problem hiding this comment.
perhaps it would be simpler to replace dasherizedModulePrefix with a modulePrefix in locals so that we don't have to litter lots of files with <% if (isModuleUnificationProject) { %>init/<% } %> statements?
f3cd9ff to
a15ca10
Compare
|
@GavinJoyce I think this is ready for review whenever you've some time 👀 |
|
@sduquej 👀. Can you prefix the commit with |
7ecc071 to
fc1014c
Compare
fc1014c to
3661007
Compare
|
Restarted CI |
|
@rwjblue could you give it one more kick please? seems to have timed out |
GavinJoyce
left a comment
There was a problem hiding this comment.
I'm 👍 too, nice one @sduquej
|
Awesome, thank you! |

For ember-cli/ember-cli#7530
TODO: