janl / mustache.js

Minimal templating with {{mustaches}} in JavaScript
https://mustache.github.io
MIT License
16.5k stars 2.39k forks source link

Sperate mustache.js file into multiple files and use typescript #787

Open AbrahemAlhofe opened 3 years ago

AbrahemAlhofe commented 3 years ago

I noticed that mustache.js file it will be better to separate it into multiple files for each individual class ( e.g. Parse, Scanner ) and using typescript will add a lot of benefits into development process, so I want to do that as a pull request so I came to ask are you agree with that or not before I work on these processes

phillipj commented 3 years ago

Hi there @AbrahemAlhofe!

Appreciate you raising this discussion before jumping ahead and putting work into something that better be agreed upon first.

The thought of migrating to TypeScript has hit me as well from time to time. I'm personally see value of it in big projects of many thousands lines of code.

So why haven't that happened so far? To me, the benefits in a simple project like mustache.js, with well below 1000 lines of code and decent test coverage, is not obvious. TypeScript is definitively cool and often brings value to the table, but there's surely drawbacks and maintenance burden of supporting/following along with TypeScript versions and whatnot, that I honestly question whether or not is really worth the burden for maintainers in the years to come.

Have in mind this project' goal is to be a JavaScript implementation of the mustache specification. It works good in that regard, and have been for many years. I don't see any reason the goal of this package should change. Hence there is limited reasons why the source code of this project should change much going forward.

I do see value in ensuring mustache.js works in TypeScript projects and popular JavaScript runtimes & bundlers tho. And that has evolved over the years, without much changes to the source code.

Bottom line, I'm personally -0 on doing a TypeScript migration. Meaning on the fence, slightly leaning towards keeping it as JavaScript.

AbrahemAlhofe commented 3 years ago

First of all, I appreciate your going throw with me in this conversation but you answered converting to typescript what about split it into multiple files instead of put everything on one file that can make some confusing to others

Second, I want to do something like that to pave the way to do add features like using proxies or async data that will be hard to work on with this kind of codebase

Third, we can use jsdoc instead of typescript and it will give us the benefits from keep things restricted and keep out the mystery from something like Parser class and whatnot