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

Port hubot from coffeescript to plain Javascipt (ES2015) #1138

Closed
gasolin opened this Issue Mar 2, 2016 · 20 comments

Comments

Projects
None yet
9 participants
@gasolin
Copy link
Contributor

gasolin commented Mar 2, 2016

.coffee does not look familiar for JS developers.
After es6 is on the table and its easy to make es6 work on modern JS runtime through babel. Developers will have less motivation to learn .coffee and might cause maintenance issue in long term.

We almost complete the porting from hubot coffeescript to es6 (through babel)
including all .coffee and test cases. CI test passed and even passed eslint style check.
All hubot plugins are still workable.

Since the code looks different now, I setup a separate repo:
https://github.com/gasolin/webbybot

@technicalpickles would you consider move hubot to es6 based?

@gasolin

This comment has been minimized.

Copy link
Contributor

gasolin commented Mar 14, 2016

We completed the porting . hubot-generated project just need minor change to use this es6 version. (mainly because I take different naming from hubot to better test the port result and avoid the confusion)

https://github.com/gasolin/webbybot#how-to-replace-hubot-to-webbybot

Still wait for feedback if hubot interesting in moving to es6 based.

@gasolin gasolin changed the title Port hubot from coffeescript to es6 Port hubot from coffeescript to plain Javascipt (ES2015) Mar 24, 2016

@gasolin

This comment has been minimized.

Copy link
Contributor

gasolin commented Mar 24, 2016

Hi, @technicalpickles , do you like the Javascipt version, or I should fork from the Hubot?

@gasolin

This comment has been minimized.

Copy link
Contributor

gasolin commented Mar 28, 2016

Wrote an article to explain the changes from Coffeescript to ES6 http://blog.gasolin.idv.tw/2016/03/how-we-ported-hubot-from-coffeescript.html

@technicalpickles

This comment has been minimized.

Copy link
Contributor

technicalpickles commented Mar 28, 2016

I'd consider moving to ES6, but I'd be worried about it be effectively a rewrite. If there's a way to change individual files over one at a time, that'd be a lot lower risk. The biggest consideration I have is that it continues to work for existing hubot users.

@gasolin

This comment has been minimized.

Copy link
Contributor

gasolin commented Mar 28, 2016

It's totally possible to change individual files over one at a time (that's what we did when porting hubot), hubot providing 77% test coverage, the ported result does fully compatible with current version, all plugins are still working.

I've created yeoman-generator-equivalent template to triage some edge cases, it works well
https://github.com/gasolin/webby_template

If that sounds good, I could start sending some patch to introduce the ES6 (babel) build script and change individual file one by one.

gasolin added a commit to gasolin/hubot that referenced this issue Mar 30, 2016

gasolin added a commit to gasolin/hubot that referenced this issue Mar 30, 2016

gasolin added a commit to gasolin/hubot that referenced this issue May 7, 2016

@enapupe

This comment has been minimized.

Copy link

enapupe commented Jun 7, 2016

@gasolin I'd like to thank you for your effort. You really have a point here. I came to github just to find an issue about this subject (my actual google query was hubot fork es6).
I have no interest in coffescript and that is frustrating.. hubot would definitely be 10x more exciting if it was ES6..
Thanks for putting so much time into something like that, I hope it merges with github interests, it would be a big win for everyone.

@rqc

This comment has been minimized.

Copy link

rqc commented Jun 23, 2016

Hello, what would be the resolution on this? @technicalpickles would like a manual port and it seems to have been done by @gasolin. Are there any other roadblocks to accept a pull request from @gasolin? My organization is very interested in contributing to Hubot, but we are more inclined to use javascript (es5 or es6) rather than coffeescript which doesn't seem to be that useful anymore.

@hpurmann

This comment has been minimized.

Copy link

hpurmann commented Jun 28, 2016

I'd live with CoffeeScript for now if it would at least be published as JS (like any other CoffeeScript module is). This is holding us back from using the hubot-test-helper (mtsmfm/hubot-test-helper#33)

@gasolin

This comment has been minimized.

Copy link
Contributor

gasolin commented Jun 28, 2016

@hpurmann moving to es6 doesn't mean you can't run coffeescript module anymore (the prototype shows its totally possible).
And this port is not happended in hubot codebase yet, so its an unrelated issue.

@hpurmann

This comment has been minimized.

Copy link

hpurmann commented Jun 28, 2016

No, you got me wrong @gasolin. Usually, modules written in CoffeeScript are transpiled to JavaScript as a prepublish step. This makes them usable for every other JavaScript project.

hubot has taken another approach and publishes the raw CoffeeScript source files which you obviously can't require in a pure JS context. This makes requiring of hubot only possible with CoffeeScript transpiling in place. @technicalpickles, can you elaborate on the reasoning behind this?

@halkeye

This comment has been minimized.

Copy link
Contributor

halkeye commented Dec 30, 2016

Decaffeinate actually works really well in coverting coffeescript to es6

As much as I like it I'm not sure why it matters of the core is coffeescript or not. I write all my modules using es6 and have an index.js that calls robot.loadFile

Do you need to actually require hubot directly in your modules? I'm guessing maybe adapters?

@alangpierce

This comment has been minimized.

Copy link

alangpierce commented Mar 25, 2017

Hi, I'm the main person working on the decaffeinate project recently, and I've been using hubot as one of the test cases. I have a fork of hubot that gets updated daily with the latest decaffeinate result:
https://github.com/decaffeinate-examples/hubot

It was generated completely automatically from this repo, and it's almost 100% JavaScript with all tests passing. (I say "almost" because it doesn't yet convert the file bin/hubot since it doesn't end in .coffee; see decaffeinate/bulk-decaffeinate#90 .)

decaffeinate is working (meaning all files convert and all tests pass) on hubot as well as some other larger projects, so it seems to be pretty safe at this point (although not 100% bug-free):
https://github.com/decaffeinate/decaffeinate#status

Certainly there are some caveats, though, like various lint issues that can't be auto-fixed and a nuance involving constructors in JS classes. Given that this repo has been inactive, a big codebase change like this may not be worth it, but happy to provide any help or advice if you're interested in using decaffeinate!

@technicalpickles

This comment has been minimized.

Copy link
Contributor

technicalpickles commented May 23, 2017

It has been awhile, but there is work to revitalize the hubot project, and porting to ES6 is now on the roadmap

@gasolin

This comment has been minimized.

Copy link
Contributor

gasolin commented May 24, 2017

@technicalpickles good to see there's a roadmap to ES6!
Does the new ES6 hubot still need to back-compatible to node 0.10?

@bkeepers

This comment has been minimized.

Copy link
Contributor

bkeepers commented May 24, 2017

Does the new ES6 hubot still need to back-compatible to node 0.10?

In general, I think we should support LTS versions that are still being maintained (currently 4 & 6), and the latest release (currently 7). So this would mean dropping 0.10 and 0.12 support since they're no longer maintained.

@rqc

This comment has been minimized.

Copy link

rqc commented May 24, 2017

I guess that one important aspect is the backward compatibility of hubot scripts that have been written in coffescript. So, upon loading the scripts, the coffeescript compiler would still be called for those scripts that use it. Right?

@rqc

This comment has been minimized.

Copy link

rqc commented May 24, 2017

Should Coffeescript 2 be considered?

@bkeepers

This comment has been minimized.

Copy link
Contributor

bkeepers commented May 24, 2017

We'll get a proposal started soon that dives into the details of how the port to ES6 will work.

@mose mose referenced this issue May 31, 2017

Open

JavaScript #4

4 of 5 tasks complete

@gr2m gr2m referenced this issue Jun 7, 2017

Merged

CoffeeScript 🔜 JavaScript #1347

12 of 12 tasks complete
@gr2m

This comment has been minimized.

Copy link
Contributor

gr2m commented Jun 8, 2017

The proposal is here: hubotio/evolution#4

@stale stale bot added the stale label Sep 6, 2017

@stale

This comment has been minimized.

Copy link

stale bot commented Sep 6, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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