Adds a (deprecated) --reset-cache option

Reviewed By: BYK

Differential Revision: D6424553

fbshipit-source-id: f84064f86a985ab19794ea3d94410dceac77a95b
This commit is contained in:
Maël Nison 2017-11-28 08:33:45 -08:00 committed by Facebook Github Bot
parent cf9ef1b30f
commit 9249ebcea7
3 changed files with 13 additions and 1 deletions

View File

@ -48,6 +48,9 @@ exports.builder = (yargs: Yargs) => {
yargs.option('legacy-bundler', {type: 'boolean'});
yargs.option('config', {alias: 'c', type: 'string'});
// Deprecated
yargs.option('reset-cache', {type: 'boolean', describe: null});
};
// eslint-disable-next-line no-unclear-flowtypes

View File

@ -51,6 +51,9 @@ exports.builder = (yargs: Yargs) => {
yargs.option('legacy-bundler', {type: 'boolean'});
yargs.option('config', {alias: 'c', type: 'string'});
// Deprecated
yargs.option('reset-cache', {type: 'boolean', describe: null});
};
// eslint-disable-next-line no-unclear-flowtypes

View File

@ -49,6 +49,8 @@ type PublicMetroOptions = {|
config?: ConfigT,
maxWorkers?: number,
projectRoots: Array<string>,
// deprecated
resetCache?: boolean,
|};
type PrivateMetroOptions = {|
@ -73,6 +75,7 @@ async function asyncRealpath(path): Promise<string> {
async function runMetro({
config,
resetCache = false,
maxWorkers = 1,
projectRoots = [],
watch = false,
@ -114,7 +117,7 @@ async function runMetro({
postProcessModules: normalizedConfig.postProcessModules,
postProcessBundleSourcemap: normalizedConfig.postProcessBundleSourcemap,
providesModuleNodeModules,
resetCache: false,
resetCache,
reporter: new TerminalReporter(new Terminal(process.stdout)),
sourceExts: normalizedConfig.assetTransforms
? sourceExts.concat(assetExts)
@ -146,6 +149,7 @@ exports.createConnectMiddleware = async function(
config: options.config,
maxWorkers: options.maxWorkers,
projectRoots: options.projectRoots,
resetCache: options.resetCache,
watch: true,
});
@ -176,6 +180,7 @@ exports.runServer = async (options: RunServerOptions) => {
config: options.config,
maxWorkers: options.maxWorkers,
projectRoots: options.projectRoots,
resetCache: options.resetCache,
});
serverApp.use(middleware);
@ -230,6 +235,7 @@ exports.runBuild = async (options: RunBuildOptions) => {
config: options.config,
maxWorkers: options.maxWorkers,
projectRoots: options.projectRoots,
resetCache: options.resetCache,
});
const requestOptions: RequestOptions = {