jdecked / twemoji-parser

A simple library for identifying emoji entities within a string in order to render them as Twemoji.
MIT License
16 stars 6 forks source link

Migrate to TypeScript? #2

Open valadaptive opened 1 year ago

valadaptive commented 1 year ago

Currently, twemoji-parser is written in JS + Flow, with the regex generator / build step written in Scala and using the Pants build system. While this may have fit in well with other Twitter projects (Twitter seems to do a lot in Scala; not sure about Flow), twemoji is no longer a Twitter project. It may make more sense to migrate twemoji-parser and the regex-generation build step completely to TypeScript, which the Node ecosystem seems to be coalescing around.

Currently, building twemoji-parser (or at least regenerating the regex) requires installing the JVM, Scala, and Python, despite this being a Node package. I believe it would be more friendly to new contributors to rewrite the regex generator in JavaScript or TypeScript, so that developers more used to the Node ecosystem would have an easier time contributing and wouldn't have to worry about so many non-Node language setups.

I believe that migrating the parser from Flow to TypeScript would also be beneficial. There's a lot more tooling built up around TypeScript than Flow, easing the development process, and the unofficial definitely-typed TS definitions could be replaced with official type definitions.

I would be more than willing to take on this work, provided that you think it'd be beneficial.

jdecked commented 7 months ago

tl;dr: Rewriting the regex generator from Scala to JS+Flow is on our wish list as maintainers and we'll get there eventually (after we catch up with Unicode versions).

Rewriting the Scala regex generator into JavaScript of some kind has long been on our wish list. Ironically, the regex generator was originally written in JS many, many years ago until some enterprising software engineer rewrote it into Scala because many things at the time were being rewritten into Scala! The current build system (Scala+JS+blahblah) is a massive pain; at Twitter, I was waiting for the next internal hackathon week (because this was none of our actual full-time jobs), but of course everyone knows how that story ended instead.

That said, I don't personally maintain (m)any TS projects and would prefer to stick with Flow for now, just because it'd be my responsibility to maintain (regardless of whoever else offers to pitch in in the moment) – and to ensure correctness for. There's many a debate to be had about Flow vs TS and IMO that's an entirely different issue (regrettably, Flow moved too slowly vs TS in the beginning of them both, so, yes, the JS community has largely moved on from Flow... which is sad, for reasons I won't get into here because this is already a long enough comment).