perak / kitchen-cli

Meteor Kitchen - Command Line Interface
226 stars 9 forks source link

js2coffee bug #12

Open paulbalomiri opened 8 years ago

paulbalomiri commented 8 years ago

Because of the js2coffee issue #362 the copied code from ~/.meteor-kitchen does not transpile to coffeescript. In particular i have to apply this patch after the trans-compilation in the ~/.meteor-kitchen directory:

--- ./templates/blaze/code/object_utils.js.orig 2016-03-07 10:16:49.000000000 +0200
+++ ./templates/blaze/code/object_utils.js  2016-03-07 10:16:52.000000000 +0200
@@ -65,7 +65,8 @@
            columnSeparator = ",";
        }
        if(fileType == "tsv") {
-           columnSeparator = "\t";
+           // "\t" object literal does not transpile correctly to coffeesctipt
+           columnSeparator = String.fromCharCode(9);
        }

        _.each(exportFields, function(field, i) {
@@ -74,7 +75,8 @@
            }
            str = str + "\"" + field + "\"";
        });
-       str = str + "\r\n";
+       //\r does not transpile correctly
+       str = str + String.fromCharCode(13)+"\n";

        _.each(data, function(doc) {
            _.each(exportFields, function(field, i) {
@@ -89,7 +91,8 @@
                else
                    str = str + "\"" + value + "\"";
            });
-           str = str + "\r\n";
+           //\r does not transpile correctly
+           str = str +String.fromCharCode(13) +"\n";
        });
    }

I would have generated a PR, but i cannot find any public repo to fork from. Cheers & great package

perak commented 8 years ago

@paulbalomiri thank you. I just applied your fix and it will be available in next version (0.9.58).

There is no public repo for this, but plan is to open kitchen-cli source code and it will be available here: https://github.com/perak/kitchen-cli

:+1:

paulbalomiri commented 8 years ago

I understand that you keep the cli closed source until polished, but would you consider putting in this repo the distributed source stuff from .meteor-kitchen? I mean it's already distributed.

paulbalomiri commented 8 years ago

oh, and one other thing: i saw that there are 2 object_utils.js files:

./templates/blaze/code/object_utils.js
./templates/react/code/object_utils.js
perak commented 8 years ago

@paulbalomiri /react/code/object_utils.js is currently changed in latest (not published yet) version and is rewritten to ES6. Next version (0.9.58) of meteor kitchen will be capable of generating both "blaze" and "react".

All code from templates/react/ is written in ES6 and... I didn't have a time to play with it - can ES6 code be converted to coffee in the same manner?

paulbalomiri commented 8 years ago

I just converted /react/code/object_utils.json js2.coffee and aside from the fact that this transpilation error remains it compiles.

That being said i think it makes no sense to keep ES6 code backwards compatible just be be able to use js2coffee (which is not a big help anyways, as you usually don't edit generated code).

Right now, i have read this and looked at decaffeinate. So if i only could predict the future :smile:. At the moment it looks bad for ES6 -> cs. Sad for me as a colon-braces-legasthenic.

perak commented 8 years ago

Hum... "decoffeinate"... I'm decoffeinated too - now I need a coffee! :D