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

Avoid errors when using older Ember versions. #1102

Merged
merged 1 commit into from
Dec 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const options = {
sourceDirs: [
'public/assets/svg'
]
}
},
};

// Firefox requires non-minified assets for review :(
Expand All @@ -56,6 +56,26 @@ module.exports = function(defaults) {
options.vendorFiles = { 'jquery.js': null };
}

// When running ember-try on Ember < 3.13, colocation support is
// disabled in ember-cli-htmlbars and causes a build error. When
// running ember-try, we actually don't care about the "app" side
// at all – all we do is run the ember_debug tests (via a --filter
// option to ember test in the ember-try config). The only reason
// we are even building the app is to get the test harness (qunit
// and friends) to work. In the long run, we should split up the
// build and not run the app build in ember-try, but in the mean
// time, this drops all *.hbs files (but keeping everything else)
// to avoid the problem. The app will of course not work correctly
// at runtime, but it was never meant to work on old ember versions
// in the first place.
if (!emberChecker.gte('3.13.0')) {
options.trees = {
app: new Funnel('app', {
exclude: ['**/*.hbs'],
}),
};
}

let app = new EmberApp(defaults, options);

// Use `app.import` to add additional libraries to the generated
Expand Down
25 changes: 25 additions & 0 deletions lib/ui/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
'use strict';

const VersionChecker = require('ember-cli-version-checker');

module.exports = {
name: require('./package').name,

// When running ember-try on Ember < 3.13, colocation support is
// disabled in ember-cli-htmlbars and causes a build error. When
// running ember-try, we actually don't care about the "app" side
// at all – all we do is run the ember_debug tests (via a --filter
// option to ember test in the ember-try config). The only reason
// we are even building the app is to get the test harness (qunit
// and friends) to work. In the long run, we should split up the
// build and not run the app build in ember-try, but in the mean
// time, this drops all the addon files (since we don't need them)
// to avoid the problem. The app will of course not work correctly
// at runtime, but it was never meant to work on old ember versions
// in the first place.
treeForAddon() {
let checker = new VersionChecker(this.project);
let emberChecker = checker.forEmber();

if (emberChecker.gte('3.13.0') ) {
return this._super.treeForAddon.apply(this, arguments);
} else {
return null;
}
},

isDevelopingAddon() {
return true;
}
Expand Down
1 change: 1 addition & 0 deletions lib/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"ember-cli-babel": "*",
"ember-cli-htmlbars": "*",
"ember-cli-sass": "*",
"ember-cli-version-checker": "*",
"ember-svg-jar": "*"
}
}