moroshko / react-scanner

Extract React components and props usage from code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"importedFrom" prop path issue

thedeviousdev opened this issue · comments

commented

Hi there, having an issue similar to #61 I'm returning no results. However if I omit the importedFrom prop, I am getting results that use components from that directory (eg. "file": "/Users/.../.../.../.../web/src/mochi/Table/Format/Whom.tsx", I'd like to find out how many times a component has been used that was imported from the mochi directory.

This is my config:

module.exports = {
  crawlFrom: './src',
  // prettier-ignore
  importedFrom: '/mochi/',
  includeSubComponents: true,
  globs: ['**/!(*.test|*.spec).@(js|ts)?(x)'],
  processors: [
    [
      'count-components-and-props',
      { outputTo: 'reports/components-and-props.json' },
    ],
    ['count-components', { outputTo: 'reports/components-count.json' }],
    ['raw-report', { outputTo: 'reports/components-raw.json' }],
  ],
};

Where the folder structure is:

├── src
│   ├── mochi
│   │   ├── ...
│   │   ├── ...
│   │   ├── ...
commented

Solved, the importedFrom folder regex was incorrect