Conversation
|
cross referencing so i can review later: ember-cli-fastboot issue |
| var checker = new VersionChecker(this); | ||
| var emberVersion = checker.for('ember-source', 'npm'); | ||
| treeForApp(defaultTree) { | ||
| let checker = new VersionChecker(this); |
There was a problem hiding this comment.
My PR exposes a process environment process.env.FASTBOOT_NEW_BUILD and addToFastBootTree for these cases. Instead of merging here you can just do this:
Let me know if this doesn't work or you feel this may not be needed but I exposed those hooks in my PR to have this in mind. More than happy to drop code 😄
treeForApp(defaultTree) {
if (!process.env.FASTBOOT_NEW_BUILD) {
var emberVersion = checker.for('ember-source', 'npm');
if (!emberVersion.version) {
emberVersion = checker.for('ember', 'bower');
}
var trees = [defaultTree];
// 2.9.0-beta.1 - 2.9.0-beta.5 used glimmer2 (but 2.9.0 did not)
// 2.10.0-beta.1+ includes glimmer2
if (!(emberVersion.gt('2.9.0-beta') && emberVersion.lt('2.9.0')) && !emberVersion.gt('2.10.0-beta')) {
trees.push(this.treeGenerator(path.resolve(this.root, 'app-lt-2-10')));
}
var tree = mergeTrees(trees, { overwrite: true });
return filterInitializers(tree);
} else {
return defaultTree;
}
}
addToFastBootTree() {
// this hook will be invoked in post fastboot 1.0 (after my PR is merged)
var fastbootBuilder = require('ember-cli-fastboot/lib/build-utilities/fastboot-builder');
let checker = new VersionChecker(this);
let emberVersion = checker.for('ember-source', 'npm');
if (!emberVersion.version) {
emberVersion = checker.for('ember', 'bower');
}
// 2.9.0-beta.1 - 2.9.0-beta.5 used glimmer2 (but 2.9.0 did not)
// 2.10.0-beta.1+ includes glimmer2
if (!(emberVersion.gt('2.9.0-beta') && emberVersion.lt('2.9.0')) && !emberVersion.gt('2.10.0-beta')) {
return fastbootBuilder.addFastBootPath(path.resolve(this.root, 'fastboot-app-lt-2-9'));
}
}When FastBoot 1.0 is released, we can remove treeForApp.
|
Fyi: added additional FastBoot tests, that now run pre and post FB 1.0 scenarios. That should now cover all cases, including pre-Glimmer2. |
|
@kratiahuja Just pushed some changes, is that what you had in mind? The problem here is that tests will be failing. Because |
kratiahuja
left a comment
There was a problem hiding this comment.
Can you try running the tests against ember-cli-fastboot master if possible? It should pass with those. If we can get it to run against master then we can do a release for that (rc.1) and then upgrade here.
index.js
Outdated
| }, | ||
|
|
||
| var trees = [defaultTree]; | ||
| addToFastBootTree() { |
There was a problem hiding this comment.
This is now called treeForFastBoot per the latest.
index.js
Outdated
| var trees = [defaultTree]; | ||
| addToFastBootTree() { | ||
| // this hook will be invoked in post FastBoot 1.0 | ||
| let fastbootBuilder = require('ember-cli-fastboot/lib/build-utilities/fastboot-builder'); |
There was a problem hiding this comment.
You don't need this any longer. treeForFastBoot now takes a treeGenerator. See an example here
|
@kratiahuja Updated this according to your suggestions! |
There was a problem hiding this comment.
Assuming you have tested all the three scenarios listed here: https://gist.github.com/kratiahuja/d22de0fb1660cf0ef58f07a6bcbf1a1c#testing-guidelines, this LGTM
| @@ -15,5 +15,5 @@ export function initialize(instance) { | |||
|
|
|||
| export default { | |||
| name: 'head-fastboot', | |||
| initialize: initialize | |||
There was a problem hiding this comment.
The initialize function needs to be wrapped in a if (typeof FastBoot != 'undefined') {...} check to make sure ember-cli-head works in apps without ember-cli-fastboot.
There was a problem hiding this comment.
Just had a look at it again... I think this is not needed, as this is not part of app
- for apps that are not using the new FastBoot build (beta FastBoot or not FB at all), this is merged into app through
filterInitializers(https://github.com/ronco/ember-cli-head/pull/21/files#diff-168726dbe96b3ce427e7fedce31bb0bcR23), so the browser build should not include this - for apps having the new FastBoot, this is only added to
treeForFastboot
And the ember 2.4 test scenario seems to be ok!
There was a problem hiding this comment.
Sounds good. Missed the filterInitializers again 👍
I'll give this another test drive tomorrow... |
|
|
||
| return filterInitializers(tree); | ||
| } else { | ||
| let trees = [defaultTree]; |
There was a problem hiding this comment.
Can't you do this in treeForFastBoot?
There was a problem hiding this comment.
But that's just for the browser. That's covering the new FastBoot, but with an pre 2.10 ember, where we need to merge the app-lt-2-10 browser initializer!
|
@rwjblue i believe you may have commit/release, mind sharing it? So we can fix/release when this is ready. |
|
Ya, will do once I am back at a computer |
|
I'm seeing an issue with this where instance initializer head-browser is injected twice and throws an error if you're using fastboot but pass Edit: Actually, this is happening all the time. Going to dig into it now. |
|
There were a few things going on in my case that caused the error, mostly interactions between ember-page-title, ember-cli-meta-tags and ember-cli-head. Edit: removing ember-page-title and ember-cli-meta-tags resolved this issue for me. |
|
Ping @rwjblue can we merge and release this? |
| "ember-cli-htmlbars": "^1.3.0", | ||
| "ember-cli-version-checker": "^1.1.6", | ||
| "fastboot-filter-initializers": "0.0.1" | ||
| "fastboot-filter-initializers": "^0.0.2" |
There was a problem hiding this comment.
Caret here does nothing, we should bump to 0.1.0 (upstream) so that we can use caret deps...
|
@kratiahuja / @simonihmig - What should the version bump be? Seems to be a compatible change (lots of effort for backwards compat in this PR), so I would assume 0.2.1 but I want to double check... |
|
@rwjblue yeah, it got a bit more complicated because of trying to be compatible with FastBoot beta-series as well as 1.0 (rc). But this dual compatibility is covered by those separate FastBoot tests, so I'm pretty confident that this should not break anything (hopefully!). So 0.2.1 should be ok! |
|
ember-cli-head 0.2.1 published 🎉 |
This PR adds changes to make the addon compatible with FastBoot pre 1.0 and post 1.0 (no
instance-initializers/(browser|fastboot). Also added FastBoot tests (currently only running with FastBoot pre 1.0)cc @kratiahuja