guardian / scribe

DEPRECATED: A rich text editor framework for the web platform
http://guardian.github.io/scribe/
Apache License 2.0
3.51k stars 245 forks source link

Any interest in a Typescript port? #474

Closed mindplay-dk closed 8 years ago

mindplay-dk commented 8 years ago

For the past week or so, I've been porting Scribe to idiomatic Typescript.

https://bitbucket.org/mindplaydk/scribe-ts

By "idiomatic", I mean all "classes" and manual calls to parent prototypes have been ported to e.g. class and extends and super calls. Also, all dependencies on immutable.js and lodash have been factored away - which makes the net footprint of the compiled codebase quite a lot smaller.

I have a bunch of your plugins (and some third-party plugins with lots of modifications, plus a handful of original plugins, 15-20 plugins in total) already ported to idiomatic Typescript as well, though these are not visible to the public right now.

This is why I've been opening issues these past few days - porting JS to TS always reveals all the invisible/silent/harmless bugs and quirks. I've been reporting the concerning ones only, loads of stuff I simply fixed and moved on because of time constraints.

This is obviously too big of a change for a simple PR, since there's just about zero correlation between my version of the source and yours - basically every line has changed, and there's still quite a bit more I'd like to do, if time allows.

Anyways, let me know if you'd like to own this?

If so, I will continue working to retain backwards compatibility.

If not, well, I will probably start breaking things very soon, and you can let me know if you'd like me to change the name of the project or not? Since I've already taken ownership of every single plugin, there's nothing stopping me from simplifying and cleaning up a few more things, all except backwards compatibility.

PS: yes, I could have just written .ts.d files for your project - and for a while, that's how I got along writing the plugins, but I wanted to fully understand the whole project, as I'm going to be working deeply with this, probably for at least the next year.

Anyways, take a look and let me know what you think...

rrees commented 8 years ago

I was wondering how you were discovering all these issues. I'll take a look. My first reaction is the change is so great it would probably be best as a fork.

mindplay-dk commented 8 years ago

Up to you.

You really should try opening the codebase in VS Code or ATOM with the proper plug-ins installed though - it's a joy to work with inspections and intelligent auto-complete. Makes it much easier to make changes without trial-and-error or fear.

Also consider the fact that Typescript is not some strange and exotic language anymore - it's basically modern ECMA JS with type-annotations. (If you were planning on transitioning to modern JS at some point anyhow...)

As for getting rid of Immutable.js and underscore - this should lessen the learning curve and lower the barrier for others to contribute. I'd never used either. You weren't doing much with them anyway ;-)

Anyhow, those were the main motivators for me to do this. YMMV.

Note that, if you decide not to adopt this, I will not maintain this as a fork - it wouldn't make any sense, since nothing can be automatically merged anyway, neither to or from the original project, as every line of code has already been touched. If so, I will proceed with some breaking changes and assembling a more "complete" (for my purposes) editor with more plug-ins. (I have already looked at/forked every available scribe plug-in on GitHub, so there is nothing very interesting for me about remaining plugin-compatible. I have other priorities.)

mindplay-dk commented 8 years ago

Okay, it looks like I already broke BC on a couple of minor points, heh.

Most importantly, existing plugins access prototypes through the classes exposed via scribe.api to simulate inheritance - I tried to factor away dynamic class creation (in favor of composition) in all of those classes.

It's easy to change that back and restore API compatibility. On the other hand, porting e.g. Command plugins to idiomatic class and extends makes for more simple/readable/modern code.

Let me know soon-ish, if you can, whether you guys have interest in collaborating on this? If not, I will continue in my own direction and break everything ;-)

mindplay-dk commented 8 years ago

Okay, turns out I need to sidetrack and prioritize a different project, probably until early next week - so take your time to review this and make a decision. Just let me know by monday next week, if you can - at that point I need to resume and make progress, in one direction or the other :-)

rrees commented 8 years ago

@mindplay-dk we've had an internal discussion and we think that we don't have the skills or the time to support a TypeScript version of Scribe. We would probably just get in the way. The best thing would be for you to create a separate project and we'll link to as an alternative to Scribe.

mindplay-dk commented 8 years ago

No problem, we'll continue in our own direction :-)