Allow custom platforms for the RN Packager on a per-project basis

Reviewed By: cpojer

Differential Revision: D4255979

fbshipit-source-id: bf900b67ee30e2f994e96c9a6103ed2e53a87f88
This commit is contained in:
Andrew Imm
2016-12-02 09:41:28 -08:00
committed by Facebook Github Bot
parent 59dd2133cb
commit 67828a52bd
8 changed files with 51 additions and 1 deletions

View File

@@ -34,6 +34,15 @@ var config = {
return [];
},
/**
* Specify any additional platforms to be used by the packager.
* For example, if you want to add a "custom" platform, and use modules
* ending in .custom.js, you would return ['custom'] here.
*/
getPlatforms() {
return [];
},
/**
* Returns a regular expression for modules that should be ignored by the
* packager on a given platform.

View File

@@ -16,6 +16,7 @@ const connect = require('connect');
const copyToClipBoardMiddleware = require('./middleware/copyToClipBoardMiddleware');
const cpuProfilerMiddleware = require('./middleware/cpuProfilerMiddleware');
const defaultAssetExts = require('../../packager/defaults').assetExts;
const defaultPlatforms = require('../../packager/defaults').platforms;
const getDevToolsMiddleware = require('./middleware/getDevToolsMiddleware');
const heapCaptureMiddleware = require('./middleware/heapCaptureMiddleware.js');
const http = require('http');
@@ -91,6 +92,7 @@ function getPackagerServer(args, config) {
cacheVersion: '3',
extraNodeModules: config.extraNodeModules,
getTransformOptions: config.getTransformOptions,
platforms: defaultPlatforms.concat(args.platforms),
projectRoots: args.projectRoots,
resetCache: args.resetCache,
transformModulePath: transformModulePath,

View File

@@ -96,6 +96,11 @@ module.exports = {
description: 'Specify any additional asset extentions to be used by the packager',
parse: (val) => val.split(','),
default: (config) => config.getAssetExts(),
}, {
command: '--platforms [list]',
description: 'Specify any additional platforms to be used by the packager',
parse: (val) => val.split(','),
default: (config) => config.getPlatforms(),
}, {
command: '--skipflow',
description: 'Disable flow checks'