Skip to content

Commit

Permalink
refactor: pass exclude as a top level param
Browse files Browse the repository at this point in the history
  • Loading branch information
atlj committed Sep 15, 2023
1 parent 876a19a commit 950cc59
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
9 changes: 7 additions & 2 deletions packages/react-native-builder-bob/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ yargs
);
}

const exclude =
options.exclude ?? '**/{__tests__,__fixtures__,__mocks__}/**';

const report = {
info: logger.info,
warn: logger.warn,
Expand Down Expand Up @@ -418,7 +421,8 @@ yargs
root,
source: path.resolve(root, source as string),
output: path.resolve(root, output as string, 'commonjs'),
options: { ...targetOptions, exclude: options.exclude },
exclude,
options: targetOptions,
report,
});
break;
Expand All @@ -427,7 +431,8 @@ yargs
root,
source: path.resolve(root, source as string),
output: path.resolve(root, output as string, 'module'),
options: { ...targetOptions, exclude: options.exclude },
exclude,
options: targetOptions,
report,
});
break;
Expand Down
4 changes: 3 additions & 1 deletion packages/react-native-builder-bob/src/targets/commonjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ type Options = Input & {
configFile?: string | false | null;
sourceMaps?: boolean;
copyFlow?: boolean;
exclude?: string;
};
exclude: string;
};

export default async function build({
root,
source,
output,
exclude,
options,
report,
}: Options) {
Expand All @@ -32,6 +33,7 @@ export default async function build({
root,
source,
output,
exclude,
modules: 'commonjs',
report,
field: 'main',
Expand Down
4 changes: 3 additions & 1 deletion packages/react-native-builder-bob/src/targets/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ type Options = Input & {
configFile?: string | false | null;
sourceMaps?: boolean;
copyFlow?: boolean;
exclude?: string;
};
exclude: string;
};

export default async function build({
root,
source,
output,
exclude,
options,
report,
}: Options) {
Expand All @@ -32,6 +33,7 @@ export default async function build({
root,
source,
output,
exclude,
modules: false,
report,
field: 'module',
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-builder-bob/src/utils/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ type Options = Input & {
configFile?: string | false | null;
sourceMaps?: boolean;
copyFlow?: boolean;
exclude?: string;
modules: 'commonjs' | false;
field: 'main' | 'module';
exclude: string;
};

export default async function compile({
Expand All @@ -22,7 +22,7 @@ export default async function compile({
output,
babelrc = false,
configFile = false,
exclude = '**/{__tests__,__fixtures__,__mocks__}/**',
exclude,
modules,
copyFlow,
sourceMaps = true,
Expand Down

0 comments on commit 950cc59

Please sign in to comment.