epub-gen icon indicating copy to clipboard operation
epub-gen copied to clipboard

QUESTION: Move on from CoffeeScript?

Open pedrosanta opened this issue 6 years ago β€’ 9 comments

Hi all,

So something has been crossing my mind over and over... at the time the work on this lib began (2015) the JS ecosystem was quite different from nowadays, and within that context I understand the benefits that CoffeeScript brought, namely, class syntax, arrow functions of sorts, and many others.

But given the latest advances of JS, namely with ES6, Promises and all, and I ponder if it wasn't beneficial from a maintenance standpoint to consider to migrate to ES6 or TypeScript?

I focus on the maintenance standpoint for two main reasons:

  • By using ES6, we would make the development easier, simpler and remove the compilation/build phase.
  • By using TypeScript, we would maintain the compilation/build phase, but would gain type checking.

Personally, I find the usage of CoffeeScript at this point to be more cumbersome (and make the code harder to read) than not, and between the two proposals above I'm still leaning to ES6 at this point, basically for the sake of simplicity. (We can always move on to TypeScript if we strongly feel that need later on.)

Thoughts? @cyrilis?

pedrosanta avatar Mar 23 '18 19:03 pedrosanta

Hi @pedrosanta , I think porting to ES6 or Typescript is becoming more and more necessary. I agree to abandon CoffeeScript too (which is one of top 3 most dreaded language in stackoverflow 2018 survey ).

And porting to ES6 or Typescript is also a good change to refactoring some old/abandoned code, and I'm learning ES6 too. πŸ˜‰

Cheers, let's do this. πŸ€–

cyrilis avatar Mar 26 '18 03:03 cyrilis

Great @cyrilis!

So, if you don't have a strong opinion between those two, I would lean to migrate to ES6 at the moment (which will already allow us to upgrade the code/syntax by a lot) – and if we feel the need later, upgrade to TypeScript.

Sounds fair?

pedrosanta avatar Mar 26 '18 10:03 pedrosanta

Yeah, sounds good! πŸ‘

Pedro Machado Santa [email protected]于2018εΉ΄3月26ζ—₯ ε‘¨δΈ€δΈ‹εˆ6:20ε†™ι“οΌš

Great @cyrilis https://github.com/cyrilis!

So, if you don't have a strong opinion between those two, I would lean to migrate to ES6 at the moment (which will already allow us to upgrade the code/syntax by a lot) – and if we feel the need later, upgrade to TypeScript.

Sounds fair?

β€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cyrilis/epub-gen/issues/56#issuecomment-376118197, or mute the thread https://github.com/notifications/unsubscribe-auth/ABv8zTF5mqPbxH7iVDBGZngqH3yQaPbZks5tiMDsgaJpZM4S5Q2y .

cyrilis avatar Mar 26 '18 23:03 cyrilis

+1 for ES6.

It would also make it easier for people like me to contribute more frequently to the repo.

actuallymentor avatar Apr 04 '18 09:04 actuallymentor

I'll just leave this here in case you hadn't seen it: https://github.com/decaffeinate/decaffeinate

mikecook avatar May 09 '18 23:05 mikecook

@cyrilis i just converted it to typescript, without reading code first. πŸ˜• I did a bad job, but with "strict": true option. forked repo Looks like it works, most likely something broke, but with some understanding of internals i will do some refactoring of my mess πŸ˜‰

Edit: type definitions might be helpfull with current build

Screenshot-20200405020008-732x500

gcoda avatar Apr 04 '20 22:04 gcoda

πŸ‘ for typescript

bmccann36 avatar Dec 19 '20 23:12 bmccann36

On my side, I'm definitely in favor of TypeScript. It will probably be a little more work to add typing, but I think it's worth it, because this will bring a lot more robust codebase for sure!

However moving first to ES6 could be a first step before going on TS.

emagnier avatar Dec 20 '20 21:12 emagnier

@emagnier it took less than hour to convert this to typescript, with help of decaffeinate, and few simple types, since ES6 is still valid TypeScript you can cut some corners and disable some of default checks.

check commits from my fork, gcoda/epub-gen. i will be glad to do it all over again, since i modified a lot of code for my needs without really digging in the logic.

gcoda avatar Dec 21 '20 10:12 gcoda