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
Decaffeinate NoFlo #640
Decaffeinate NoFlo #640
Conversation
Generally looks like it is good to go. Test code coverage seems to be broken, so that would be good to fix |
@bergie I'll have a look at the coverage tool. How about that issue with static icon and description? I had to disable a test where it sets |
I guess we can drop it. Just please document in the ChangeLog |
@bergie code coverage is fixed. I also converted the examples, so the code is completely decaffeinated after this PR. |
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.
Great work!
Migration from CoffeeScript to ES6. This PR converts:
examples
spec
src
Background
CoffeeScript served us well in the past and saved us quite some
keystrokestime a while ago, when JavaScript didn't have classes, arrow functions, and other syntactic sugar. And despite the core is written in CoffeeScript, it can be used in ES6, TypeScript, Flow, and other JS flavours without any extra effort.However, the era of CoffeeScript is over, and most of the JavaScript community is happy with the features that ECMAScript provides today. So, we decided to convert NoFlo to ES6 to open it up to a wider developer community and remove dependency on CoffeeScript.
Breaking changes
After conversion, NoFlo API will remain compatible with all the code that is using NoFlo 1.0+ API, and will continue support modules written in ES6, ES7+, and CS. However, we are going to drop support for some of the pre-1.0 features that we planned dropping anyways:
WirePattern
support.WirePattern
has been deprecated since 1.0, and all code using it should be migrated to the latest Process API.The plan
The idea is to start with core library files situated in
src/lib
, moving from smaller files with fewer dependencies, to files which depend on them.After the
lib
is done, it's the time ofspec
. Thenexamples
.With no
.coffee
code left, dependencies should be cleaned up, and maybe Babel setup should be updated.The process
Pre-requisites
References
Conversion instructions
Here is the routine that I follow:
.coffee
file to convertreturn
at the end of functions..coffee
file before conversion. Don't forget to rungrunt test
to make sure nothing is broken by these changes.bulk-decaffeinate convert -f {PATH TO FILE}.coffee
grunt test
again.DSXXX
suggestions at the top of the converted file, fix them. To test intermediate changes quicker, you can run just nodejs suite:grunt test:nodejs
.eslint-disable
at the top of the file. Enable one of the rules, fix the code according to ESLint suggestions, do the same with the next rule.grunt test
orgrunt test:browser
..original.coffee
file and commit changes.Contributing
If you'd like to help porting NoFlo to ES6 faster, here is how you can do it:
decaffeinate
branchdecaffeinate
, select files to work on and post it here in comments, so other people don't do duplicate workThanks a lot for helping to make NoFlo more up-to-date 🙏
Known issues
ComponentName::icon
) doesn't work as expected, because there is no easy way to set static properties in es2015. We should revisit whether we need that functionality at all, and fall back to setting those on constructor level only if possible.es2015
profile in Babel. We are going to migrate from PhantomJS to Karma in follow-up PRs.