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

Command registry #333

Open
insin opened this issue Jun 22, 2017 · 0 comments
Open

Command registry #333

insin opened this issue Jun 22, 2017 · 0 comments

Comments

@insin
Copy link
Owner

insin commented Jun 22, 2017

If there was a way to register commands instead of (or in addition to) scanning the commands/ dir, we could drop most of the existing command modules.

The build-<inferno|preact|react|web>[-app].js, serve-<inferno|preact|react|web>[-app].js and test-<inferno|preact|react>.js commands are now just passing different configs to the same functions - being able to register these dynamically instead would allow us to get rid of 19 modules right off the bat and also be a first step to making nwb's core more plugin-based.

The generic build, clean and serve and test commands are just mapping project types to other existing commands.

The inferno, preact, react and web quick commands are also just mapping to the appropriate build or serve command, and they're mostly duplicates of each other save for differences in the options and defaults in the help output. If we do a 4-way diff of these we might be able to extract the common parts and enable passing just the differences in help output for display.

The build-demo (really should be build-react-demo) and serve-react-demo commands are still hardcoding all the config they need - if we can figure out which changes need to be made to pull that from react/index.js instead we could also look at making it easy to add serve-X-demo, build-X-component and build-X-demo for other libraries too the same was as we've done with appConfig and quickConfig (perhaps this para should be a separate issue?)

@loklaan already has an initial stab at an API for this in #292

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

No branches or pull requests

1 participant