mirror of https://github.com/status-im/metro.git
[ReactNative] Dim packager output
This commit is contained in:
parent
ed3aaadc39
commit
f7e2e4114b
|
@ -10,6 +10,7 @@
|
|||
|
||||
var chalk = require('chalk');
|
||||
var exec = require('child_process').exec;
|
||||
var Activity = require('./react-packager/src/Activity');
|
||||
|
||||
var hasWarned = {};
|
||||
|
||||
|
@ -44,20 +45,10 @@ function getFlowTypeCheckMiddleware(options) {
|
|||
|
||||
function doFlowTypecheck(res, flowroot, next) {
|
||||
var flowCmd = 'cd "' + flowroot + '" && flow --json --timeout 20';
|
||||
var start = Date.now();
|
||||
// Log start message if flow is slow to let user know something is happening.
|
||||
var flowSlow = setTimeout(
|
||||
function() {
|
||||
console.log(chalk.gray('flow: Running static typechecks.'));
|
||||
},
|
||||
500
|
||||
);
|
||||
var eventId = Activity.startEvent('flow static typechecks');
|
||||
exec(flowCmd, function(flowError, stdout, stderr) {
|
||||
clearTimeout(flowSlow);
|
||||
Activity.endEvent(eventId);
|
||||
if (!flowError) {
|
||||
console.log(chalk.gray(
|
||||
'flow: Typechecks passed (' + (Date.now() - start) + 'ms).')
|
||||
);
|
||||
return next();
|
||||
} else {
|
||||
try {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
dim: function(s) { return s; },
|
||||
};
|
|
@ -8,6 +8,8 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
var chalk = require('chalk');
|
||||
|
||||
var COLLECTION_PERIOD = 1000;
|
||||
|
||||
var _endedEvents = Object.create(null);
|
||||
|
@ -132,22 +134,22 @@ function _writeAction(action) {
|
|||
|
||||
switch (action.action) {
|
||||
case 'startEvent':
|
||||
console.log(
|
||||
console.log(chalk.dim(
|
||||
'[' + fmtTime + '] ' +
|
||||
'<START> ' + action.eventName +
|
||||
data
|
||||
);
|
||||
));
|
||||
break;
|
||||
|
||||
case 'endEvent':
|
||||
var startAction = _eventStarts[action.eventId];
|
||||
var startData = startAction.data ? ': ' + JSON.stringify(startAction.data) : '';
|
||||
console.log(
|
||||
console.log(chalk.dim(
|
||||
'[' + fmtTime + '] ' +
|
||||
'<END> ' + startAction.eventName +
|
||||
'(' + (action.tstamp - startAction.tstamp) + 'ms)' +
|
||||
' (' + (action.tstamp - startAction.tstamp) + 'ms)' +
|
||||
startData
|
||||
);
|
||||
));
|
||||
delete _eventStarts[action.eventId];
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue