Merge pull request #58 from frontrowed/flow
add an option to add a flow header
This commit is contained in:
commit
5995959d77
|
@ -107,6 +107,10 @@ module.exports = optionator({
|
|||
alias: 'rn',
|
||||
type: 'Boolean',
|
||||
description: 'Renders react native templates.'
|
||||
}, {
|
||||
option: 'flow',
|
||||
type: 'Boolean',
|
||||
description: 'Add /* @flow */ to the top of the generated file'
|
||||
}, {
|
||||
option: 'native-target-version',
|
||||
alias: 'rnv',
|
||||
|
|
|
@ -68,7 +68,8 @@ function getOptions(options) {
|
|||
reactImportPath: options.native ? 'react-native' : 'react/addons',
|
||||
lodashImportPath: 'lodash',
|
||||
native: false,
|
||||
nativeTargetVersion: reactNativeSupport.default
|
||||
nativeTargetVersion: reactNativeSupport.default,
|
||||
flow: options.flow
|
||||
};
|
||||
|
||||
var finalOptions = _.defaults({}, options, defaultOptions);
|
||||
|
@ -589,6 +590,9 @@ function convertRT(html, reportContext, options) {
|
|||
return 'var ' + reqVar + " = require('" + reqPath + "');";
|
||||
}).join('\n');
|
||||
}
|
||||
if (options.flow){
|
||||
vars = '/* @flow */\n' + vars
|
||||
}
|
||||
var data = {body: body, injectedFunctions: '', requireNames: requireVars, requirePaths: requirePaths, vars: vars, name: options.name};
|
||||
data.injectedFunctions = context.injectedFunctions.join('\n');
|
||||
var code = generate(data, options);
|
||||
|
|
Loading…
Reference in New Issue