Skip to content

Support coffeescript 2 #144

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

Open
toovy opened this issue Apr 20, 2017 · 6 comments
Open

Support coffeescript 2 #144

toovy opened this issue Apr 20, 2017 · 6 comments

Comments

@toovy
Copy link

toovy commented Apr 20, 2017

Hi there,

Coffeescript 2 is getting real: http://coffeescript.org/v2/ (coffeescript6/discuss#80).

It supports many ES2015 features. The reason why I would love to see it in ember is the async/await and generator support. The most important reason though is that the nasty import/export hacks using backticks to write plain JS is not needed any more:

export default Ember.Route.extend

  model: ->
    @foo()

  foo: ->
    a = await @bar()
    b = await @biz()
    "#{a}-#{b}"

  bar: ->
    new Ember.RSVP.Promise (resolve) ->
      setTimeout ->
        resolve("baz")
      , 2000

  biz: ->
    new Ember.RSVP.Promise (resolve) ->
      setTimeout ->
        resolve("biz")
      , 2000

I've made a quick test and it is simple to get it running by altering only a few lines of ember-cli-coffeescript and broccoli-coffee:

  • update the package.json, remove coffee-script, add coffeescript
  • update every require('coffee-script') to require('coffeescript')

But I think this needs more discussion on a meta level, as Coffeescript 1 runs in every browser, but Coffeescript 2 needs transpilation. Thankfully Ember includes Babel, so that is also pretty easy to accomplish:

var app = new EmberApp(defaults, {
    'ember-cli-babel': {
      includePolyfill: true
    }
  });

That's the reason why I did not just create pull requests. Maybe new repos should be created, called ember-cli-coffeescript-2 and babel-coffee-2? That would ensure that there is a clear distinction between old Coffeescript (1) and ES2015 Coffeescript (2).

Looking forward to hear your opinions.

BR, toovy

@boris-petrov
Copy link

+1 I would also love to see that - I want async/await!

@toovy - btw, you can drop the backticks even now - with CoffeeScript 1.12.5. :)

@auvipy
Copy link

auvipy commented May 4, 2017

can we test it in another branch?

@auvipy
Copy link

auvipy commented May 18, 2017

1.12.6 released

@boris-petrov
Copy link

@kimroen - can you help on this one? We all would like to use CoffeeScript 2!

@nikdojo
Copy link

nikdojo commented Nov 15, 2017

Guys, do you have any updates?

@kosmonaffft
Copy link

Is this project still alive?

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

Successfully merging a pull request may close this issue.

5 participants