Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Does decaf have a cli? #8

Closed
systeminsightsbuild opened this issue Jan 29, 2016 · 6 comments
Closed

Does decaf have a cli? #8

systeminsightsbuild opened this issue Jan 29, 2016 · 6 comments

Comments

@systeminsightsbuild
Copy link

I don't want a runtime transform, but rather fully convert the coffeescript (even if that means some post manually work).

Does decaf support that mode?

@karlhorky
Copy link
Contributor

I would like to see this documented too.

@juliankrispel
Copy link
Contributor

A cli feature is on the short-term roadmap, @systeminsightsbuild @karlhorky how do you expect using a tool like that? Should it transform your files or create new ones?

I know it seems simple enough but I'd like to hear use-cases to design this well :)

@eventualbuddha
Copy link
Contributor

This is exactly why I created decaffeinate. The intent is to completely replace your .coffee files with .js files written in ES6. I also created esnext in part to further modernize the source, for example translating var foo = require('foo'); to import foo from 'foo';.

My suggestion would be that a CLI for decaf should write .js files next to the .coffee files it processes, and having a "process everything in this directory" mode would be great (decaffeinate doesn't have that yet). I'd like to be able to convert a whole project at once, preserving as much of the original formatting/comments/etc as possible, which obviously necessitates #1 but also means preserving things like this:

$('.form')
  .find('.button')
    .attr('enabled', false)
  .end()
  .find('.input')
    .addClass('invalid');

That problem is the original reason I took the approach I did with decaffeinate (string edits based on AST). Using recast as a printer is a good approach in that you'll always end up with valid JS (not something decaffeinate always does) and the transformation is more straightforward (I'm not very proud of how messy decaffeinate's source is), but it makes the above into a harder problem. Trade-offs are a bummer 👎

@backspaces
Copy link

Yup, I'd like to be able to translate my coffee to es6, and leave the coffee behind .. es6 along with the JS Standard Style has made JS good enough. I realize this is not the goal of decaf but...

Yes, I'll miss several features, but at this point, I think Babel will be in our code for ever, modules for example, and may be all we need for some missing features.

A question: does decaf plan to translate CS Classes to es6 Classes? There are some differences, but I'm fine giving up some corner cases for convergence with the rest of the JS world!

-- Owen

@juliankrispel
Copy link
Contributor

@backspaces that is exactly the (original) goal of decaf.

Classes are supported right now yes!

please have a look at the test suite for more info of what exactly is supported.

@juliankrispel juliankrispel changed the title How use to create ES6 source to replace the coffeescript? Does decaf have a cli? Feb 2, 2016
@juliankrispel
Copy link
Contributor

decaf now has a cli :)

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

No branches or pull requests

5 participants