Emplifi / BakeryJS

Dataprocessing framework for JavaScript 🎂
MIT License
25 stars 6 forks source link

Support glob pattern for components directory #32

Open jnv opened 5 years ago

jnv commented 5 years ago

Instead of specyfing componentsPath as e.g. ../components I could say:

['components/**/*.js', '!components/**/*.test.js']

to register all the components without their tests.

Use package such as fast-glob.

Bonus: Make it async.

jnv commented 5 years ago

Though I wonder whether we could avoid these mappings completely or move them to a different layer? The biggest disadvantage with current solution is that you need to re-scan components directory on every Program instatiation and in the end you are duplicating native require functionality, though with some security measures. Perhaps this could be pulled out to some customisable component name mapper with a separate cache?