Skip to content

Commit e82c41c

Browse files
committed
Added cli option to reset the cache (—reset-cache)
1 parent 01646de commit e82c41c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ All command-line arguments are optional. By default a production build will be c
3939
| `entry-file` | Entry-file (when omitted tries to auto-resolve it) | `--entry-file ./index.android.js` |
4040
| `bundle-output` | Output bundle-file (default is **tmp**) | `--bundle-output ./myapp.bundle` |
4141
| `verbose` | Dumps additional output to the console (default is **false**) | `--verbose` |
42-
43-
42+
| `reset-cache` | Removes cached react-native files (default is **false**) | `--reset-cache` |
4443

4544

4645
## Usage with older react-native versions and the Haul bundler

src/react-native-bundle-visualizer.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const entryFile = argv['entry-file'] || getEntryPoint();
3434
const platform = argv.platform || 'ios';
3535
const dev = argv.dev || false;
3636
const verbose = argv.verbose || false;
37+
const resetCache = argv['reset-cache'] || false;
3738
const bundleOutput =
3839
argv['bundle-output'] || tmpDir + '/' + platform + '.bundle';
3940
const bundleOutputSourceMap = bundleOutput + '.map';
@@ -52,7 +53,7 @@ if (fs.existsSync(bundleOutput)) {
5253

5354
// Bundle
5455
console.log(chalk.green.bold('Generating bundle...'));
55-
const bundlePromise = execa('./node_modules/.bin/react-native', [
56+
const commands = [
5657
'bundle',
5758
'--platform',
5859
platform,
@@ -64,7 +65,12 @@ const bundlePromise = execa('./node_modules/.bin/react-native', [
6465
bundleOutput,
6566
'--sourcemap-output',
6667
bundleOutputSourceMap
67-
]);
68+
];
69+
if (resetCache) {
70+
commands.push('--reset-cache');
71+
commands.push(resetCache);
72+
}
73+
const bundlePromise = execa('./node_modules/.bin/react-native', commands);
6874
bundlePromise.stdout.pipe(process.stdout);
6975

7076
// Upon bundle completion, run `source-map-explorer`

0 commit comments

Comments
 (0)