-
Notifications
You must be signed in to change notification settings - Fork 70
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
fix: use the dust context which is passed in arg #146
Conversation
Superb! This is working as expected. This will solve issue linkedin/dustjs#776 |
For compatibility reasons, I would recommend not modifying the tests. It looks like adding node 4, 6, 8 to the travis test the existing tests pass. It seems related to how the the end developer requires
VS
This discussion might also be helpful #72. |
@jimmyhchan yeah, i checked that discussion. It's almost similar i.e issue is similar but this time reason is different. Helper is working fine upto version node6, but not in node 8. That's why i added that fix to support all the version v4/v6/v8. I changed the test version as node 0.x is outdated and doesn't have support |
Please consider a different approach here. To be specific changing the
return type to become a factory that produces a dust instance is a very
large breaking change and will not be pulled in.
Also please consider providing an example (ideally a test case) where this
is failing in node 8. With a failing test case and keeping all existing
tests as is, we can discuss possible options instead of a major breaking
api change.
It’s very possible I don’t have a clear idea what the issue is.
|
@jimmyhchan agree it will be a bigger change.
https://github.com/krakenjs/adaro/blob/v1.x/lib/engine.js#L120 |
@jimmyhchan.. @kumarrishav 's latest suggestion appears to be non-breaking, and keeping with the convention of some other helpers to export a |
@grawk @kumarrishav Agreed this can be added as a undocumented workaround for now. Some blockers:
|
@jimmyhchan added the suggested change. But some weird error is coming in test (test didn't even start running). Not sure how template string is coming here. Seems like part of npm but why test would effect that? also, 0.x doesn't have support for template string |
after searching a bit, i found these npm/npm#18963. It says, because of node 0.x which is not supported anymore. https://stackoverflow.com/questions/46852889/unable-to-change-node-version-using-nvm |
Thanks for all your help here! Hope to push a patch out in the next little bit |
1.7.4 is now published. #147 to track the fix failing tests while also killing 0.10 and 0.12 support |
Thanks @jimmyhchan |
Thanks @jimmyhchan and @kumarrishav !! |
In node 8, when using factory(require('dustjs-linkedin'), it seems it creates a new dust context/object and assign dust.helpers to it, because of which actual dust.helpers was {}. So we were loosing all the dust-helpers.
Ideally it should refer to same cached dustjs-linkedin object, but it's not happening. Also, i didn't understand why we are requiring it separately when it's is already expecting a function and passing
dust
in arg i.e module.exports = function(dust, options) {} // for dust helpers.Solution is: use the dust object coming as arg instead of requiring it again as require won't get it from cache because of cache clean by freshy.