Based on discussion started here https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/jhipster-dev/DogpMHZzf3w/rd-Pn1RyAgAJ
Our current module sub generator is used by modules to get jhipster config and API methods. But this was made for our old ES5 code since we are now in ES6 with proper modules, it's much more efficient to use commonJS style require or import to use the API and to get the config. This will also free us from maintaining one more sub generator and also will make building modules easier for end users as they don't have to learn our module system
@jdubois shall we add a deprecation notice for the sub generator so module authors can migrate and we can remove it for the next major version
Related https://github.com/jhipster/generator-jhipster/pull/5986, https://github.com/jhipster/generator-jhipster-module/commit/a6efe65f12bb221dbddc0e5d5c489686573c2a52#commitcomment-22756783, https://github.com/jhipster/jhipster.github.io/pull/450
I am not convinced about removing it, as there are some old modules which can work with module sub generator. This change will break all existing modules.
I'd prefer:
So if the users want to use jhipsterVar and jhipsterFunc, they can but they won't benefit all new functions
@pascalgrimaud No it won't break existing modules unless they update their package.json to use new generator version, in which case they should use commonJs import as well, so I would say its safe to deprecate now and then remove in either next version or the one after that.
Just a mention, please release new version of generator-jhipster-module when you have time. Many existing modules not compatible with new jhipster versions. I tried to fork a modue generator-jhipster-entity-audit and upgrade it, but I'm stuck.
Thanks,
The current master in generator-jhipster-module uses new functions in generator-jhipster which is not released yet.
It will be done after generator-jhipster 4.5.7 or 4.6.0
@jdubois WDYT? should we add a deprecation notice for the module sub generator?
If it's not working at the moment, yes we should warn people!
@jdubois It works but Its not the ideal way to use our API, so we can add a deprecation warning and ask people to use es6 modules.
OK, but then this is still necessary to put the warning
Yes, so that module developers know that there is a better and less brittle way to use our API, also we can remove the module sub generator in the future version.
Anyway I'll add the warning as a PR so that you can take a look
@tientq : as asked, a new version of generator-jhipster-module has been released v2.1.0, few minutes ago
Most helpful comment
@tientq : as asked, a new version of generator-jhipster-module has been released v2.1.0, few minutes ago