Allow user to configure transformer through cl argument

Reviewed By: frantic

Differential Revision: D2547435

fb-gh-sync-id: 77016ee5beba854a4cb58e9ac04b91a7dd76cf3e
This commit is contained in:
Martín Bigio 2015-10-16 13:25:14 -07:00 committed by facebook-github-bot-3
parent 01f90054cc
commit 5977f494fc
5 changed files with 13 additions and 11 deletions

View File

@ -14,10 +14,6 @@ var config = {
getBlacklistRE(platform) {
return blacklist(platform);
},
getTransformModulePath() {
return require.resolve('./node_modules/react-native/packager/transformer');
}
};

View File

@ -21,10 +21,6 @@ module.exports = {
return blacklist('');
},
getTransformModulePath() {
return require.resolve('./transformer');
},
_getRoots() {
// match on either path separator
if (__dirname.match(/node_modules[\/\\]react-native[\/\\]packager$/)) {

View File

@ -36,6 +36,11 @@ function _bundle(argv, config, resolve, reject) {
description: 'Either "ios" or "android"',
type: 'string',
required: true,
}, {
command: 'transformer',
description: 'Specify a custom transformer to be used (absolute path)',
type: 'string',
default: require.resolve('../../../packager/transformer'),
}, {
command: 'dev',
description: 'If false, warnings are disabled and the bundle is minified',
@ -64,7 +69,7 @@ function _bundle(argv, config, resolve, reject) {
projectRoots: config.getProjectRoots(),
assetRoots: config.getAssetRoots(),
blacklistRE: config.getBlacklistRE(args.platform),
transformModulePath: config.getTransformModulePath(),
transformModulePath: args.transformer,
};
const requestOpts = {

View File

@ -39,6 +39,11 @@ function _dependencies(argv, config, resolve, reject) {
command: 'platform',
description: 'The platform extension used for selecting modules',
type: 'string',
}, {
command: 'transformer',
type: 'string',
default: require.resolve('../../../packager/transformer'),
description: 'Specify a custom transformer to be used (absolute path)'
}
], argv);
@ -51,7 +56,7 @@ function _dependencies(argv, config, resolve, reject) {
projectRoots: config.getProjectRoots(),
assetRoots: config.getAssetRoots(),
blacklistRE: config.getBlacklistRE(args.platform),
transformModulePath: config.getTransformModulePath(),
transformModulePath: args.transformer,
};
const relativePath = packageOpts.projectRoots.map(root =>

View File

@ -48,7 +48,7 @@ function _server(argv, config, resolve, reject) {
}, {
command: 'transformer',
type: 'string',
default: config.getTransformModulePath(),
default: require.resolve('../../../packager/transformer'),
description: 'Specify a custom transformer to be used (absolute path)'
}, {
command: 'resetCache',