Skip to content

Commit c83116a

Browse files
committed
feat: add clean to the script target
1 parent 30e83d0 commit c83116a

File tree

1 file changed

+12
-0
lines changed
  • packages/react-native-builder-bob/src/targets

1 file changed

+12
-0
lines changed

packages/react-native-builder-bob/src/targets/script.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import kleur from 'kleur';
2+
import path from 'path';
23
import type { Input } from '../types';
34
import { spawn } from '../utils/spawn';
45
import dedent from 'dedent';
6+
import del from 'del';
57

68
type Options = Input & {
79
options?: {
810
run?: string;
911
cwd?: string;
12+
clean?: string;
1013
}
1114
};
1215

@@ -35,6 +38,15 @@ export default async function runScript({
3538

3639
const cwd = options?.cwd ?? root
3740

41+
if (options.clean) {
42+
report.info(
43+
`Cleaning up previous script target at ${kleur.blue(path.relative(root, options.clean))}`
44+
);
45+
46+
await del([path.resolve(cwd, options.clean)])
47+
}
48+
49+
3850
report.info(
3951
`Running ${kleur.blue(options.run)} `
4052
);

0 commit comments

Comments
 (0)