Skip to content

Commit

Permalink
[local-cli] Add support for custom log reporter cli option for packag…
Browse files Browse the repository at this point in the history
…er server
  • Loading branch information
brentvatne committed Mar 28, 2017
1 parent 09fe999 commit 33c5500
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions local-cli/server/runServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

const InspectorProxy = require('./util/inspectorProxy.js');
const ReactPackager = require('../../packager/react-packager');
const TerminalReporter = require('../../packager/src/lib/TerminalReporter');

const attachHMRServer = require('./util/attachHMRServer');
const connect = require('connect');
Expand Down Expand Up @@ -86,6 +85,10 @@ function getPackagerServer(args, config) {
const providesModuleNodeModules =
args.providesModuleNodeModules || defaultProvidesModuleNodeModules;

const LogReporter = args.customLogReporterPath
? require(`../../../../${args.customLogReporterPath}`)
: require('../../packager/src/lib/TerminalReporter');

return ReactPackager.createServer({
assetExts: defaultAssetExts.concat(args.assetExts),
blacklistRE: config.getBlacklistRE(),
Expand All @@ -96,7 +99,7 @@ function getPackagerServer(args, config) {
platforms: defaultPlatforms.concat(args.platforms),
projectRoots: args.projectRoots,
providesModuleNodeModules: providesModuleNodeModules,
reporter: new TerminalReporter(),
reporter: new LogReporter(),
resetCache: args.resetCache,
transformModulePath: transformModulePath,
verbose: args.verbose,
Expand Down
3 changes: 3 additions & 0 deletions local-cli/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ module.exports = {
}, {
command: '--reset-cache, --resetCache',
description: 'Removes cached files',
}, {
command: '--custom-log-reporter-path, --customLogReporterPath [string]',
description: 'Path to a JavaScript file that exports a log reporter as a replacement for TerminalReporter',
}, {
command: '--verbose',
description: 'Enables logging',
Expand Down

0 comments on commit 33c5500

Please sign in to comment.