Break out defaults, add flow for Config

Summary: In order to make `Config` and defaults available to our new code, I’ve added flow types and put default values into one shared modile

Reviewed By: cpojer

Differential Revision: D4044600

fbshipit-source-id: 875ed3ade69c5b22bb3c1b177e7bad732834d476
This commit is contained in:
David Aurelio
2016-10-22 06:07:01 -07:00
committed by Facebook Github Bot
parent 254b1ec6b3
commit d7aa297762
12 changed files with 121 additions and 76 deletions

View File

@@ -10,19 +10,20 @@
*/
'use strict';
const Config = require('./util/Config');
const getUserCommands = require('./core/getCommands');
import type {ConfigT} from './util/Config';
export type Command = {
name: string,
description?: string,
usage?: string,
func: (argv: Array<string>, config: Config, args: Object) => ?Promise<void>,
func: (argv: Array<string>, config: ConfigT, args: Object) => ?Promise<void>,
options?: Array<{
command: string,
description?: string,
parse?: (val: string) => any,
default?: (config: Config) => any | any,
default?: (config: ConfigT) => any | any,
}>,
examples?: Array<{
desc: string,
@@ -60,7 +61,7 @@ const undocumentedCommands = [
func: () => {
console.log([
'Looks like React Native project already exists in the current',
'folder. Run this command from a different folder or remove node_modules/react-native'
'folder. Run this command from a different folder or remove node_modules/react-native',
].join('\n'));
},
},