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

Development workflow (debug) #5

Open
zewa666 opened this issue Nov 8, 2016 · 1 comment
Open

Development workflow (debug) #5

zewa666 opened this issue Nov 8, 2016 · 1 comment
Assignees
Labels

Comments

@zewa666
Copy link
Contributor

zewa666 commented Nov 8, 2016

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:

new I18NImportHooks().executeScripts();

then I simply called from the root of the scaffolded app:

node node_modules/aurelia-i18n/install/import-hooks.js

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.

@martonsagi martonsagi self-assigned this Nov 8, 2016
@zewa666
Copy link
Contributor Author

zewa666 commented Nov 8, 2016

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?

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

No branches or pull requests

2 participants