Unverified Commit 5276321a authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

codemod: extend ignore pattern list (#70906)

parent 8b347b63
...@@ -9,7 +9,20 @@ export default function runJscodeshift( ...@@ -9,7 +9,20 @@ export default function runJscodeshift(
// we run jscodeshift in the same process to be able to // we run jscodeshift in the same process to be able to
// share state between the main CRA transform and sub-transforms // share state between the main CRA transform and sub-transforms
return Runner.run(transformerPath, files, { return Runner.run(transformerPath, files, {
ignorePattern: ['**/node_modules/**', '**/.next/**', '**/build/**'], ignorePattern: [
'**/node_modules/**',
'**/.next/**',
'**/build/**',
// type files
'**/*.d.ts',
'**/*.d.cts',
'**/*.d.mts',
// test files
'**/*.test.*',
'**/*.spec.*',
'**/__tests__/**',
'**/__mocks__/**',
],
extensions: 'tsx,ts,jsx,js', extensions: 'tsx,ts,jsx,js',
parser: 'tsx', parser: 'tsx',
verbose: 2, verbose: 2,
......
...@@ -3,11 +3,6 @@ import { transformDynamicProps } from './next-async-dynamic-prop' ...@@ -3,11 +3,6 @@ import { transformDynamicProps } from './next-async-dynamic-prop'
import { transformDynamicAPI } from './next-async-dynamic-api' import { transformDynamicAPI } from './next-async-dynamic-api'
export default function transform(file: FileInfo, api: API) { export default function transform(file: FileInfo, api: API) {
const filePath = file.path
// if it's node_modules or types file, skip
if (/node_modules/.test(filePath) || /\.d\.(m|c)?ts$/.test(filePath)) {
return file.source
}
const transforms = [transformDynamicProps, transformDynamicAPI] const transforms = [transformDynamicProps, transformDynamicAPI]
return transforms.reduce<string>((source, transformFn) => { return transforms.reduce<string>((source, transformFn) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment