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

ES6 & Broccoli #65

Closed
pedrokiefer opened this issue Feb 23, 2015 · 12 comments
Closed

ES6 & Broccoli #65

pedrokiefer opened this issue Feb 23, 2015 · 12 comments
Milestone

Comments

@pedrokiefer
Copy link
Contributor

What do you think about migrating to ES6 and using Broccoli as the build chain? As that seems to be the default for all ember related projects.

If that is something you would like to have on the project I can work on a PR for that.

@danielspaniel
Copy link
Collaborator

Only reason I don't jump on that bandwagon is that I hate importing every little thing I want to use in every file. I am dreading moving to ember-cli because I will then have to import everything manually in my codebase ( use ember rails now, where I import stuff with sprockets ... all in one place .. easy ).
The tediousness reminds of my days writing java code. But if you can convince me it would benefit the project I can overlook my pet peeve here and jump on that bandwagon. :)

@Marthyn
Copy link
Contributor

Marthyn commented Feb 23, 2015

I would also love to use this in our new Ember CLI project with ES6 and broccoli (.NET backend :()

@danielspaniel
Copy link
Collaborator

ok .. what the heck .. if you want to do this @pedrokiefer .. I am up for pulling this in.

@pedrokiefer
Copy link
Contributor Author

On the long run ES6 will be standard, so migrating to it is just a matter o time. All the imports can be troublesome, but I think it actually makes you write better JS code, splinting concerns to different files and handling namespace clashes. I think ES6 is a good thing.

Using grunt, broccoli or being an ember-cli addon is another matter. I thinks we should do this in parts, get the code ES6 compliant (still using grunt), if everything is good and working, then choose what build tool works better for the community.

I'll start working on a PR for moving to ES6.

@danielspaniel
Copy link
Collaborator

Agree @pedrokiefer .. and working in stages = good.

@Marthyn
Copy link
Contributor

Marthyn commented Feb 24, 2015

So maybe you can help with a little setup problem i have with Ember cli. I'm getting this error:

 beforeEach failed on Load the subcourses page: 'undefined' is not a function (evaluating 'TestHelper.setup(App)')

my test looks like this:

import Ember from 'ember';
import startApp from 'capp-front/tests/helpers/start-app';
import textMixin from 'factory-guy';

var TestHelper = Ember.Object.createWithMixins(textMixin);
var testHelper, make, store, App;

module('Integration: Show the subcourses index', {
  setup:
   function () {
    App = startApp();
    testHelper = TestHelper.setup(App);
    store = testHelper.getStore();
    make = testHelper.make.bind(testHelper);
  },

  teardown: function () {
    Ember.run(App, 'destroy');
    Ember.run(function () { testHelper.teardown(); });
  },
});

test('Load the subcourses page', function () {
  var course = make('course');
  visit('/courses/' + course.get('id') + '/sub-courses');

  andThen(function () {
    var actual = currentRouteName();
    var expected = 'course.sub-courses';
    equal(actual, expected, 'expected ' + expected + ' but got ' + actual);
  });
});

Is there something i'm forgetting in the setup?

@pedrokiefer
Copy link
Contributor Author

@Marthyn probably a typo, you are importing textMixin and not testMixin ;)

@Marthyn
Copy link
Contributor

Marthyn commented Feb 24, 2015

jup thats it, thanks! Stupid me :)

@danielspaniel
Copy link
Collaborator

@pedrokiefer .. have you started on the ES6 thing?. I was going to add a feature, but don't want to do it in the middle of that change. If you have not started .. I might also take a crack at it myself today.

@pedrokiefer
Copy link
Contributor Author

@danielspaniel I've started, but got busy with some stuff at work and didn't have time to finish it. It's still on my ToDo list.

What I did so far:

  • added grunt-babel (for transpiling from ES6)
  • added imports and export default tags on the source code.

I was trying to figure out how to make grunt spill out AMD, globals and browser versions of the code, got somewhat stuck here.

Still need a solution on how to handle the store.js, which reopens DS.Store for patching its methods.

@danielspaniel
Copy link
Collaborator

Here's are hints at how to get past the things your stuck on:

http://www.thomasboyt.com/2013/06/21/es6-module-transpiler
stefanpenner/ember-app-kit#485

@danielspaniel
Copy link
Collaborator

Might have to do this myself .. since I want to upgrade to es6 and make this an add on ( deprecating of ember-cli-data-factory-guy ) . If you have enough to show .. maybe I will take a look at your fork and see what I can cherry pick?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants