Skip to content
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

Hogan.js is unmaintained #435

Open
SydneyUni-Jim opened this issue May 5, 2022 · 12 comments
Open

Hogan.js is unmaintained #435

SydneyUni-Jim opened this issue May 5, 2022 · 12 comments

Comments

@SydneyUni-Jim
Copy link

twitter/hogan.js#272 (2 May 2021)

It's been ~8 years since I seriously worked on this project […] After this work is done, I'll add a note to the README that makes it clear the project is not adding new features, and is in maintenance mode. Serious bugs, such as security issues, will be addressed. New features and performance work can be done in a fork.

The last time a pull request was closed was 8 Jun 2019. The dependencies in hogan.js are becoming deprecated (twitter/hogan.js#270) and security vulnerabilities are being exposed (twitter/hogan.js#276).

@rtfpessoa
Copy link
Owner

👋 I understand that it is not being maintained anymore but it has been very stable and fits very well the use case.

Do you have any alternatives we can use?

Also AFAIK we have no active vulns https://github.com/rtfpessoa/diff2html/security/dependabot

@jgonggrijp
Copy link

@rtfpessoa I'm currently developing Wontache, which can be thought of as a successor of hogan.js (although the code bases are not actually related). I haven't reached the 1.0.0 release yet, but it's fully tested, passes all the official Mustache specs (including the newest) and is even more accurate at whitespace handling than hogan.js. In my own testing, it also seems to be at least as fast as hogan.js, but you might want to try that for yourself on a feature branch.

The API is slightly different, the compiler returns a function that you can then call with the data:

import mustache from 'wontache';

const templateText = 'Interpolate {{variable}} here.';
const compiledTemplate = mustache(templateText);
const renderedOutput = compiledTemplate({variable: 'foo'});
// 'Interpolate foo here.'

While I'm not proud enough yet to draw a lot of attention to Wontache, I would definitely welcome diff2html as a first serious outside user.

@rtfpessoa
Copy link
Owner

👋 @jgonggrijp did a quick test and seems like it works.

For me the most important things missing are:

  • Typescript types support
  • Seems like codegen is not optimal since some functions have unused parameters, for example
  • Would be great to have a script to pre-compile templates into a file that you can bundle in your app like hulk.js did and similar to what I did in this PR

Do you think these are things you will be interested in doing?

@jgonggrijp
Copy link

jgonggrijp commented Aug 13, 2022

@rtfpessoa Yes, the first and the last point are planned. Please clarify the middle point!

@jgonggrijp
Copy link

jgonggrijp commented Aug 13, 2022

Potentially relevant issue tickets, in case you want to track them:

@rtfpessoa
Copy link
Owner

Do you have any ideas for timelines here?

@jgonggrijp
Copy link

As far as order is concerned, the development board conveys best how I prioritize the issues. I want to finish the evaluation release milestone this year if I can help it, and the official launch milestone as soon as possible after that.

As far as calendar time is concerned, unfortunately I can spend at most two days a week on my open source libraries and I have to divide my attention between Wontache, Backbone and Underscore (I took over maintainance of the latter two from the original author). I get to it whenever I get to it, so I cannot promise any particular date.

If you are seriously considering to use Wontache, please let me know which issues are the most important to you. The priorities are somewhat flexible; in fact, I already moved the WebPack plugin up because it seemed relevant to diff2html and I expect it to be quick to implement.

(Also, please consider donating to my Patreon and recruiting other people to do so. Given substantial sponsorship, I might be able to increase my time investment in open source libraries such as Wontache.)

By the way, you mentioned this earlier:

  • Seems like codegen is not optimal since some functions have unused parameters, for example

Please clarify.

@t1m0thyj
Copy link

@rtfpessoa Would it be possible to publish the 3.0.0-beta.1 tag in the "use-wontache" branch to NPM, since all tests are passing? My team would like to use diff2html but we are not allowed to use deprecated/unmaintained packages. Thanks! 🙏

@rtfpessoa
Copy link
Owner

@t1m0thyj I just released version 3.4.20-usewontache.1.60e7a2e with the initial wontache implementation.

@t1m0thyj
Copy link

Thanks for the quick response! So far the beta version seems to be working well for us.

In case anyone else wants to try it out in a TypeScript project, here's what I did to work around wontache not having type definitions yet. I created a file __types__/wontache.d.ts:

// Remove this file once wontache adds type definitions
declare module 'wontache' {
    type CompiledTemplate = any;
    type Partials = any;
}

and added this to tsconfig.json:

  "files": [
    "./__types__/wontache.d.ts"
  ]

@rtfpessoa
Copy link
Owner

I created these more details typings https://github.com/rtfpessoa/diff2html/blob/use-wontache/typings/wontache/wontache.d.ts

@jgonggrijp
Copy link

jgonggrijp commented Oct 16, 2022

@rtfpessoa I just released Wontache version 0.2.0, which has a couple of new features and bugfixes, as well as a breaking change in the way precompiled templates are represented.

Along with this new version, I released the new packages rollup-plugin-wontache and wontache-loader. You can use the latter for bundling your templates with your code directly with webpack, so you (hopefully) don't need the custom logic in scripts/hulk.ts anymore. I also published a new playground where you can try all wontache features from your browser (including partials and parents).

Update: added more links for convenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants