add reset-cache command to bundle

Summary:
Currently the `react-native bundle` has no option to reset the file cache. For example changing the .babelrc has no effect on the bundling process. `react-native start` has it already implemented, so this is just a small addition.

**Test plan (required)**

the issue:

- `react-native init` a new project
- run `react-native bundle` (should work as expected)
- create `.babelrc` with empty object ```{}```
- rerun `react-native bundle`
- should fail now with `Unexptected token` (no babel plugins configured)
 - if not failing, your cache already hit (clear $TMPDIR to get the error)
- delete .babelrc and rerun `bundle`
- still failing, but it should went back to normal
- delete your $TMPDIR contents
- works again

The option `--reset-cache` should fix that
Closes https://github.com/facebook/react-native/pull/7297

Differential Revision: D3241259

Pulled By: davidaurelio

fb-gh-sync-id: 0ed5b58aa1f021d72021f4c80fbc57d2e7e8181f
fbshipit-source-id: 0ed5b58aa1f021d72021f4c80fbc57d2e7e8181f
This commit is contained in:
Mark Oswald 2016-04-29 10:37:30 -07:00 committed by Facebook Github Bot 3
parent cccb8db175
commit 90f9f48498
2 changed files with 5 additions and 0 deletions

View File

@ -34,6 +34,7 @@ function buildBundle(args, config, output = outputBundle, packagerInstance) {
transformModulePath: args.transformer,
extraNodeModules: config.extraNodeModules,
nonPersistent: true,
resetCache: args['reset-cache'],
};
const requestOpts = {

View File

@ -57,5 +57,9 @@ module.exports = [
command: 'verbose',
description: 'Enables logging',
default: false,
}, {
command: 'reset-cache',
description: 'Removes cached files',
default: false
}
];