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

detect extension-less CoffeeScript scripts #90

Closed
eventualbuddha opened this issue Feb 5, 2017 · 3 comments
Closed

detect extension-less CoffeeScript scripts #90

eventualbuddha opened this issue Feb 5, 2017 · 3 comments

Comments

@eventualbuddha
Copy link
Contributor

The decaffeinate-examples fork of hubot still has bin/hubot as CoffeeScript because bulk-decaffeinate doesn't find it. We could pretty easily look in all extension-less files (maybe that are executable?) and look for a shebang line like this: #!/usr/bin/env coffee.

@alangpierce
Copy link
Member

👍 I've got a few of those in my codebase as well, and they all have no extension and #!/usr/bin/env coffee at the top. Another possible option is to just have a list of additional files to process in bulk-decaffeinate.config.js.

One difficulty here is what to do with the git history. Currently the code assumes that all files end in .coffee and I think it assumes that the .coffee and .js files can exist at the same time, and it makes the rename operation its own commit.

Also, I guess it would make sense to modify the shebang line to run node instead? Also maybe we'd need to use babel-register, but I'd also like to avoid making those kinds of assumptions, I think.

This could also be done in more of a one-off way for each case, like renaming the file to .coffee beforehand, then renaming the .js file back and changing the shebang line afterward. For decaffeinate-examples, this could be done with a patch before and a patch after.

@eventualbuddha
Copy link
Contributor Author

decaffeinate already patches it to replace coffee with node, though you're right that sometimes you'll need babel-register.

@alangpierce
Copy link
Member

Ah, neat, I hadn't seen that.

alangpierce added a commit that referenced this issue May 6, 2017
Progress toward #90

We don't auto-discover them yet, but this adds all of the cases in terms of
doing the correct move operations. Also, we now detect shebang lines when
prepending the results comment and put them after the shebang line.
alangpierce added a commit that referenced this issue May 6, 2017
Progress toward #90

We don't auto-discover them yet, but this adds all of the cases in terms of
doing the correct move operations. Also, we now detect shebang lines when
prepending the results comment and put them after the shebang line.
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

No branches or pull requests

2 participants