mirror of https://github.com/status-im/metro.git
Moves the maxWorkers default into the API rather than the CLI
Reviewed By: BYK, davidaurelio Differential Revision: D6883200 fbshipit-source-id: 9f5a73f873adc3ac39286c7f32d4f759eb36820d
This commit is contained in:
parent
c2fb238b5d
commit
bc6f188a59
|
@ -15,8 +15,6 @@
|
|||
const MetroApi = require('..');
|
||||
const TerminalReporter = require('../lib/TerminalReporter');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const {makeAsyncCommand} = require('../cli-utils');
|
||||
const {Terminal} = require('metro-core');
|
||||
|
||||
|
@ -35,11 +33,7 @@ exports.builder = (yargs: Yargs) => {
|
|||
yargs.option('platform', {alias: 'p', type: 'string'});
|
||||
yargs.option('output-type', {alias: 't', type: 'string'});
|
||||
|
||||
yargs.option('max-workers', {
|
||||
alias: 'j',
|
||||
type: 'number',
|
||||
default: Math.max(1, Math.floor(os.cpus().length)),
|
||||
});
|
||||
yargs.option('max-workers', {alias: 'j', type: 'number'});
|
||||
|
||||
yargs.option('optimize', {alias: 'z', type: 'boolean'});
|
||||
yargs.option('dev', {alias: 'g', type: 'boolean'});
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
const MetroApi = require('..');
|
||||
|
||||
const os = require('os');
|
||||
|
||||
const {watchFile, makeAsyncCommand} = require('../cli-utils');
|
||||
const {promisify} = require('util');
|
||||
|
||||
|
@ -33,11 +31,7 @@ exports.builder = (yargs: Yargs) => {
|
|||
yargs.option('host', {alias: 'h', type: 'string', default: 'localhost'});
|
||||
yargs.option('port', {alias: 'p', type: 'number', default: 8080});
|
||||
|
||||
yargs.option('max-workers', {
|
||||
alias: 'j',
|
||||
type: 'number',
|
||||
default: Math.max(1, Math.floor(os.cpus().length)),
|
||||
});
|
||||
yargs.option('max-workers', {alias: 'j', type: 'number'});
|
||||
|
||||
yargs.option('secure', {type: 'boolean'});
|
||||
yargs.option('secure-key', {type: 'string'});
|
||||
|
|
|
@ -22,6 +22,7 @@ const TransformCaching = require('./lib/TransformCaching');
|
|||
const attachWebsocketServer = require('./lib/attachWebsocketServer');
|
||||
const defaults = require('./defaults');
|
||||
const fs = require('fs');
|
||||
const getMaxWorkers = require('./lib/getMaxWorkers');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const path = require('path');
|
||||
|
@ -78,7 +79,7 @@ async function asyncRealpath(path): Promise<string> {
|
|||
async function runMetro({
|
||||
config,
|
||||
resetCache = false,
|
||||
maxWorkers = 1,
|
||||
maxWorkers = getMaxWorkers(),
|
||||
// $FlowFixMe TODO t0 https://github.com/facebook/flow/issues/183
|
||||
port = null,
|
||||
reporter = new TerminalReporter(new Terminal(process.stdout)),
|
||||
|
|
Loading…
Reference in New Issue