-
Notifications
You must be signed in to change notification settings - Fork 219
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 CoffeeScript to ES6 #35
Conversation
How much work is left for this to be merged in? Anything I can help out with? |
I'm also happy to help with this. |
I mostly want to review all of the converted files and clean up any formatting things left behind by decaffinate. Sorry I've been slow on this, super busy lately. Will get on it soon. |
Hi Devon, I have a few thoughts on some small structural changes to the upcoming ES6 code so that it plays nice with webpack. I also have some TypeScript annotations if you're interested. |
@jahewson feel free to share your thoughts about webpack. Have a link to the typescript annotations? |
As is the constant case in JS, new bundlers keep popping up - if this is still in the "trying to make it work" stages, it might be worth having a quick look to see if rollup gets the job done. |
As one of the maintainers of rollup and creator of decaffeinate, I support that 😉 |
I've now published my TypeScript definitions to jahewson/fontkit-types. The definition includes a few As far as webpack goes, one hurdle has been that the dependency on Another issue is that the different modules which make up fontkit have interdependencies which cause the entirety of fontkit to be bundled, no matter how few features are used. For example, I don't need subsetting but because each Font exposes a Likewise because I don't need to save files, I don't need the encoding parts of restructure, which get pulled in by webpack too. Probably the biggest issue is that I can't ship support for only certain font formats, I don't need DFont, WOFF, or WOFF2, but because they all get registered, they all get bundled. I think the registering API really needs to be made explicit. Overall, adding a bit more |
You can As for other stuff, rollup might be able to help here with its tree shaking features... |
I use a mix of ES5 and ES6 code, so Rollup isn't an option for me. I have everything working with webpack - it's just that the config is a hand-coded pile of hacks. Requiring |
If users install it, they will get better encoding support.
Merged! Published to npm in v1.4.0. Updated the build process a bit. Now using Babel 6, and Rollup before publishing to npm. Still including the ES6 source in the package though, for custom builds. |
@jahewson are the typescript definitions still available somewhere? |
I started this project over 3 years ago now, as a part of PDFKit which was written in CoffeeScript. At the time, CoffeeScript provided a nice syntax on top of JavaScript, especially with it's class syntax and other features. It served my projects well, but it's time to move on. CoffeeScript hasn't received major updates in quite some time now, and won't be getting a lot of the nice features in ES6. ES6 borrowed many of it's features from CoffeeScript, so why not just move to ES6?
There are several reasons to move, but the biggest for me is encouraging outside contribution. Simply, more people know and are willing to contribute to projects written in JavaScript than CoffeeScript. Also, as I mentioned before, ES6 has many of CoffeeScript's good parts, infused with some other cool stuff. I've been working on other projects with it, and really enjoy it.
I used decaffinate to do the initial port, and then cleaned up the result by hand. Decaffinate isn't perfect, but it was a HUGE help in doing this, so thanks to @eventualbuddha for that project.
Still working on cleaning up some stuff, but tests are passing which is a good sign.