-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
CoffeeScript 🔜 JavaScript #1347
Conversation
3295b68
to
21876a9
Compare
27243f9
to
fc32221
Compare
I’ve just tested it with the IRC adapter which is written in CoffeeScript and it seems there is still some problem with inheritance. this.adapter.run() is the empty dummy |
okay, fixed via 9aa5fe7 Tested it with the IRC adapter and it works. Doesn’t mean that it wouldn’t break with something else. This isn’t super elegant, but still our best option right now as we transition to move forward with the new roadmap and revive the project’s community I think :) |
02f2459
to
7853af8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, soooo much ❤️ for doing this. It's a huge effort, so thanks for spearheading it.
A few comments, but I don't see anything that should hold this up from merging and fixing any issues in follow PRs.
@@ -1,12 +1,8 @@ | |||
language: node_js | |||
node_js: | |||
- "node" # latest stable Node.js release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to keep this in so we're always running against the latest release? Or are you concerned it would lead to unexpected failures when new node releases are put out and we should make sure we're being explicit about which versions are supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it would lead to unexpected failures, node major versions are still breaking versions. We are experimenting with Greenkeeper sending PRs to update the these versions, so as soon as version 9 comes out it will send a PR updating the .travis.yml
file. I think that’d be the perfect way
CHANGELOG.md
Outdated
@@ -1,3 +1,16 @@ | |||
## [v2.19.0](https://github.com/github/hubot/tree/v2.19.0) (2017-06-09) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2.19.0
Should this be v3.0?
# we left the `bin/hubot` file to remain in CoffeeScript in order prevent | ||
# breaking existing 3rd party adapters of which some are still written in | ||
# CoffeeScript themselves. We will depracate and eventually remove this file | ||
# in a future version of hubot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand this. As long as it still includes a require('coffee-script')
, shouldn't it be able to load JavaScript?
Also, should we print a deprecation warning that coffee script will not be supported in the major release that follows this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think require('coffee-script')
will be enough, I'll have to investigate it. If you don’t mind I’d make a follow up PR to change it later if it works.
Regarding the deprecation warning I’m not yet sure when we drop CoffeeScript support officially, but we can add a deprecation warning in a patch release, too, so we don’t keep that PR waiting
Really cool to see this. 😄 If you have any feedback about how decaffeinate could be improved, feel free to let me know or file an issue. |
@alangpierce decaffeinate was a great help! I compiled it with babel.js afterwards to target Node@4. It all wasn’t perfect, but I think the tooling is as great as it can be, thanks so much! |
I’ve tested again with all 3: Slack, IRC and HipChat with my latest changes and they all continue to work |
7853af8
to
6150328
Compare
6150328
to
9987f07
Compare
I've ported the matrix adapter to js since this seems to be the evolution and I prefer js anyway, but I discovered an issue. I am getting the same |
@cjdelisle Thanks for checking the PR with the matrix adapter! Do you have your code somewhere I can have a look? I thought I resolved the issue and tested it with both, adapters written in coffeescript as well as javascript. |
Well I think it worked but I screwed it up porting to js. You can test it here https://github.com/xwiki-labs/xbot/blob/master/bot.js#L35 just do a |
I was able to reproduce the issue, I’ll look into it tomorrow |
I'm gonna push a workaround for this and you can continue debugging with https://github.com/xwiki-labs/xbot/tree/c38054d4d6d3311a6232e0f353349d41342c043a |
@cjdelisle it looks like you released a new version of The problem here is that you try to extend an es2015 Could you check that please? The incompatibility between CoffeeScript and es2015 classes is the biggest headache for the upgrade to JavaScript. We don’t want to directly export the native es2015 classes because it would break all the existing apps out there. The |
everything is definitely pushed to github because I deleted |
sorry I looked at a fork: https://github.com/xwiki-labs/hubot-matrix Did you test hubot-matrix with the currently released version of
yes that is true :/ But if you want to be compatible with the current What you can do is a to release a new version of hubot-matrix which would already require the new hubot version. We are coordinating the release of hubot@3 with the default scripts which get installed by the generator ourselves right now |
This is what I tested and it seems to be working ok: https://github.com/xwiki-labs/hubot-test/blob/master/package.json#L15
|
If there's any followup work from this PR, I think it makes sense to track it in a new issue so we can track and 'close' it when it's done. |
The JavaScript proposal for Hubot Evolution is still ongoing, so everything can change. If you have any questions better to discuss there.
But at this point I have the source code working in JavaScript and all existing coffee script tests are passing, so I thought I’d be a good time to start sharing progress.
🛑 this PR is not yet ready for any feedback on the code
Most of it is still generated from
decaffeinate
. I’ll test the current version with some popular adapters / scripts first to makes sure it all still workscloses – eventually – hubotio/evolution#4
Breaking Changes
require('hubot/src/adapter')
does no longer work. It was never officially supported, but now it won’t work at all. Userequire('hubot').Adapter
insteadMiddleware.ticker()
has been removed. Useprocess.nextTick()
insteadFeatures
class
declarations of all Hubot classes atrequire('hubot/es2015')
.Progress
See JavaScript Evolution Proposal for details
see evolution/4/javascript-src branch
see evolution/4/javascript-tests branch,
CHANGELOG.md
All steps will be part of the same PR but split into separate commits so people
can follow more easily.
Convert source files from CoffeeScript to JavaScript
Convert all source files from CoffeeScript to JavaScript with a tool like decaffeinate, see also github/hubot#1138.
Make sure the existing tests (still written in CoffeeScript) run against the new JavaScript.
Now go through each file and improve the code readability by hand as needed. From my experiences with converting Hoodie from CoffeeScript to JavaScript quite a lot of manual work will be required.
Convert test files from CoffeeScript to JavaScript
Same as the previous steps only for the tests files this time.
When finished, create a separate branch with the tests written in JavaScript but the source code still in CoffeeScript to assure integrity.
Update package.json
Remove all CoffeeScript related dependencies and tooling. Update engines
Make sure that Hubot scripts can still be written in CoffeeScript. We want to break as few existing scripts as possible and many of them are written in CoffeeScript. We treat it as legacy support and will drop support for scripts written in CoffeeScript in future.
Add script for JavaScript linting
The only tool I would like to introduce as part of this proposal is a linting tool which will be run as part of
npm test
.I suggest standard. We’ve been using it in all our projects at Hoodie and Neighbourhoodie since 2+ years and never looked back. It's a zero-configuration JavaScript linter.
Test with popular projects depending on Hubot
Instructions to test an existing adapter with this PR:
Check out the
evolution/4/javascript
branch of this pull requestNow link it into your test app using an example adapter
Using the example of slack here:
Now start hubot
replace
<your token here>
with your own bots token from slack