Open zewa666 opened 7 years ago
ok so what I've come up with now is the following file called demo-cli.js
which I put in the root of the scaffolded app:
const I18NSetup = require("./node_modules/aurelia-i18n/install/import-hooks");
const ui = require("./node_modules/aurelia-cli/lib/ui");
const fakeEngine = { cliBridge: { ui: new ui.ConsoleUI() } };
const fakeOptions = { quiet: false };
const fakeProjectInfo = { projectRoot: "./" };
const instance = new I18NSetup();
instance.register(fakeEngine, fakeOptions, fakeProjectInfo);
instance.executeScripts();
this way I essentially wire up all the necessary parts and can fake whatever is needed to get the thing rolling. All is needed now is node demo-cli.js
. Now this would perhaps make a good basis for a unit-test.
Any ideas on that? Perhaps a helper function to create the fake mocks?
Ok so since the plugin gets more potent over time, its now the question how to properly run the code in dev mode to check it out.
Currently my plugin had somewhere at the end an instantiation of the hooks class and called the executeScripts method:
then I simply called from the root of the scaffolded app:
That was ok until now, but since the inclusion of additional CLI features like the question thingy, there should be an easier way to test all of it out. Any proposal how to do that? Remember that most of the times you cannot push the import-hook to the live environment to check it out, but it should work with local
npm links
.