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

Add compatibility for Coffeescript 2 (and hubot 3) #565

Merged
merged 8 commits into from
Apr 24, 2020

Conversation

phucnh
Copy link
Contributor

@phucnh phucnh commented May 6, 2019

Summary

This PR continues #528 works.
Make sure the classes in this code work in Coffeescript 2 (and with hubot 3).

A few of the semantic differences between Coffeescript 1 classes and ES2015 classes has introduced some backwards compatibility issues, as follows:
Breaking Changes From CoffeeScript 1.x to 2

Known Issue: This PR doesn't make hubot-slack work with hubot 2 in Coffeescript 2. Because hubot 2 still based on Coffeescript 1.

Refs: #526

Requirements (place an x in each [ ])

@CLAassistant
Copy link

CLAassistant commented May 6, 2019

CLA assistant check
All committers have signed the CLA.

@phucnh phucnh mentioned this pull request May 6, 2019
9 tasks
@phucnh
Copy link
Contributor Author

phucnh commented May 6, 2019

Tests are failed on nodejs <= 5 with envs are HUBOT_VERSION="^3.0" COFFEESCRIPT_VERSION="^2.0".
Seems that because the destructuring assignment syntax: {fork} = child_process;

Test failed detail
> mocha --compilers coffee:coffeescript/register --require coffee-coverage/register-istanbul --reporter spec test
"--compilers" will be removed in a future version of Mocha; see https://git.io/vdcSr for more info
/home/travis/build/slackapi/hubot-slack/node_modules/coffeescript/lib/coffeescript/register.js:61
    ({fork} = child_process);
     ^^^^^^
ReferenceError: Invalid left-hand side in assignment
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/travis/build/slackapi/hubot-slack/node_modules/coffeescript/register.js:1:63)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at /home/travis/build/slackapi/hubot-slack/node_modules/mocha/bin/_mocha:453:3
    at Array.forEach (native)
    at Object.<anonymous> (/home/travis/build/slackapi/hubot-slack/node_modules/mocha/bin/_mocha:445:19)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:148:18)
    at node.js:405:3

@codecov-io
Copy link

codecov-io commented May 7, 2019

Codecov Report

Merging #565 into master will increase coverage by 0.22%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #565      +/-   ##
==========================================
+ Coverage   85.19%   85.42%   +0.22%     
==========================================
  Files           6        6              
  Lines         385      391       +6     
  Branches       84       84              
==========================================
+ Hits          328      334       +6     
  Misses         34       34              
  Partials       23       23              
Impacted Files Coverage Δ
src/bot.coffee 74.75% <100.00%> (+0.24%) ⬆️
src/message.coffee 90.90% <100.00%> (+0.48%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c003c3b...af884f9. Read the comment docs.

@phucnh phucnh force-pushed the feature/upgrade-coffeescript-2 branch from eb09c00 to 46407de Compare May 7, 2019 07:13
@mistydemeo
Copy link
Contributor

@aoberoi Any chance we could get your review here? This would be really useful for me.

@seratch
Copy link
Member

seratch commented Apr 10, 2020

@phucnh
Thank you for taking the time to make this PR. This looks great and is really amazing!

@aoberoi @stevengill @shaydewael
I'll verify the details (just in case) again and merge this next week. Also, I would like to work on the next minor version (v4.8) later. I think enabling developers to use CoffeeScript 2 is quite helpful as the major version supports async/await in the language (it's not available in CoffeeScript 1.x!). Let me know if you have thoughts on this.

@seratch seratch added enhancement M-T: A feature request for new functionality semver:minor labels Apr 20, 2020
@seratch seratch merged commit 150948c into slackapi:master Apr 24, 2020
@seratch seratch added this to the 4.8.0 milestone Apr 24, 2020
@seratch
Copy link
Member

seratch commented Apr 24, 2020

I've reverted this PR as it's not fully compatible with CoffeeScript 2 yet. I'm still positive to support CoffeeScript v2 in future versions but for the next minor version (v4.8.0 - https://github.com/slackapi/hubot-slack/milestone/4), this improvement may be out of scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement M-T: A feature request for new functionality semver:minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants