File size: 688 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// @ts-ignore internal module
import Runner from 'jscodeshift/src/Runner'

export default function runJscodeshift(
  transformerPath: string,
  flags: { [key: string]: any },
  files: string[]
) {
  // we run jscodeshift in the same process to be able to
  // share state between the main CRA transform and sub-transforms
  return Runner.run(transformerPath, files, {
    ignorePattern: [
      '**/node_modules/**',
      '**/.next/**',
      '**/build/**',
      // test files
      '**/*.test.*',
      '**/*.spec.*',
      '**/__tests__/**',
      '**/__mocks__/**',
    ],
    extensions: 'tsx,ts,jsx,js',
    parser: 'tsx',
    verbose: 2,
    runInBand: true,
    ...flags,
  })
}