Open maxleiko opened 6 years ago
Work in progress here: https://github.com/maxleiko/jhipster-cli-bot
Out of curiosity, which strategy did you apply? Are you able to reverse engineer the FM statically or do you have to execute some pieces of javascript?
I dropped the static-analysis of the source code. I took another approach which is: static-analysis of the prompt. Jhipster is using Yeoman which uses Inquirer.js (a prompt library).
I tried to formalize that prompt library output in a PEG.js grammar as it's the more common interface that we have.
Now I still have to run down all the possibilities by answering methodically to all the prompted questions in order to create the full feature model of the JHipster generator.
That's really awesome/original the direction you take!
This line kills me ;) https://github.com/maxleiko/jhipster-cli-bot/blob/master/grammar/prompt.pegjs#L104-L105
(PEG is very powerful)
You're already "connected" to JHipster with https://github.com/maxleiko/jhipster-cli-bot/blob/master/index.js#L9-L22 (it is perhaps obvious for you to manage stdin/stdout in JS, but not for me :D)
You're very close to a total success.
Perhaps we need to think what we do at the end of a "full" configuration.
I was thinking about simply retrieving the ".yo-rc.json"
Then we will have thousands (perhaps millions) of .yo-rc.json (it is exactly what we wanted ;))
@manuelleduc a static analysis of the source code is also possible, but hard if you want to be general and complete. Certainly worth doing afterwards ;-)
Good news, the Yeoman API is pretty cool as it allows devs to provide an adapter for the prompts.
So we can get the full power of Inquirer.js DSL without parsing the prompt (and without having any prompt at all)
Work in progress here https://github.com/maxleiko/familiar-yeoman
Donc ma problématique est la suivante: il faut transformer le JavaScript écrit ici https://github.com/jhipster/generator-jhipster/blob/master/generators/server/prompts.js#L45-L467 en un modèle de variabilité (feature model).
Si on prend l'exemple ici: https://github.com/jhipster/generator-jhipster/blob/master/generators/server/prompts.js#L111-L130
il faudrait être capable de dire que authentificationType (qui est une "feature") a pour sous-features "jwt", "session", "oauth2" (et celles-ci sont mutuellement exclusifs)
avec la syntaxe FAMILIAR ça donnerait quelque chose comme authentificationType : (jwt|session|auth2);
syntaxe ici: https://github.com/FAMILIAR-project/familiar-documentation/blob/master/manual/featuremodel.md
Pourquoi ce travail est important?
Guillaume a commencé quelque chose: https://github.com/gbecan/jhipster-fm