moroshko / react-scanner

Extract React components and props usage from code.
MIT License
563 stars 40 forks source link

Can't make it work with "importedFrom" prop #61

Closed nicolas-c-dev closed 1 year ago

nicolas-c-dev commented 1 year ago

Hi, first of all, sorry if it's not a bug but I didn't find where to ask my question.

I need to count components imported from a package named '@flame-ui/core/[anycomponent]', example: import Button from '@flame-ui/core/button';

This is my config: module.exports = { crawlFrom: "./packages", importedFrom: '@flame-ui/core/*', processors: ["count-components"] };

but it throws empty Scanned 1265 files in 6.988196 seconds {}

If I change to exact path using importedFrom: '@flame-ui/core/button', it finds correctly: Scanned 1265 files in 6.1287643 seconds { "Button": 19 }

Any help will be appreciated :D

moroshko commented 1 year ago

Could you try making it an actual regex?

importedFrom: /@flame-ui\/core\/.*/
nicolas-c-dev commented 1 year ago

@moroshko Thanks!! It worked