@@ -5,11 +5,8 @@ import { spawnSync } from "node:child_process";
55const IGNORE_DIRS = process . env . ASTGEN_IGNORE_DIRS
66 ? process . env . ASTGEN_IGNORE_DIRS . split ( "," )
77 : [
8- "node_modules" ,
98 "venv" ,
109 "docs" ,
11- "test" ,
12- "tests" ,
1310 "e2e" ,
1411 "e2e-beta" ,
1512 "examples" ,
@@ -19,30 +16,24 @@ const IGNORE_DIRS = process.env.ASTGEN_IGNORE_DIRS
1916 "codemods" ,
2017 "flow-typed" ,
2118 "i18n" ,
22- "vendor" ,
23- "www" ,
24- "dist" ,
25- "build" ,
26- "__tests__"
2719 ] ;
2820
2921const IGNORE_FILE_PATTERN = new RegExp (
3022 process . env . ASTGEN_IGNORE_FILE_PATTERN ||
31- "(test|spec|min| three|\\.d)\\.(js|ts|jsx|tsx)$" ,
23+ "(three|\\.d)\\.(js|ts|jsx|tsx)$" ,
3224 "i"
3325) ;
3426
35- export const getAllFiles = ( dir , extn , files , result , regex ) => {
27+ export const getAllFiles = ( dir , extn , files , result , regex , ignore_node_modules = true ) => {
3628 files = files || readdirSync ( dir ) ;
3729 result = result || [ ] ;
3830 regex = regex || new RegExp ( `\\${ extn } $` ) ;
3931
4032 for ( let i = 0 ; i < files . length ; i ++ ) {
4133 const file = files [ i ] ;
4234 if (
43- file . startsWith ( "." ) ||
44- file . startsWith ( "__" ) ||
45- IGNORE_FILE_PATTERN . test ( file )
35+ file . startsWith ( "." ) ||
36+ IGNORE_FILE_PATTERN . test ( file )
4637 ) {
4738 continue ;
4839 }
@@ -52,8 +43,8 @@ export const getAllFiles = (dir, extn, files, result, regex) => {
5243 const dirName = basename ( fileWithDir ) ;
5344 if (
5445 dirName . startsWith ( "." ) ||
55- dirName . startsWith ( "__" ) ||
56- IGNORE_DIRS . includes ( dirName . toLowerCase ( ) )
46+ IGNORE_DIRS . includes ( dirName . toLowerCase ( ) ) ||
47+ ( ignore_node_modules && dirName . toLowerCase ( ) === "node_modules" )
5748 ) {
5849 continue ;
5950 }
@@ -63,7 +54,8 @@ export const getAllFiles = (dir, extn, files, result, regex) => {
6354 extn ,
6455 readdirSync ( fileWithDir ) ,
6556 result ,
66- regex
57+ regex ,
58+ ignore_node_modules
6759 ) ;
6860 } catch ( error ) {
6961 // ignore
0 commit comments