Monkey-patch `fs` with graceful-fs before anything else runs
Reviewed By: matryoshcow, kentaromiura Differential Revision: D4020645 fbshipit-source-id: a7985109476b78b588c3e2a75ae6f25ea8f09237
This commit is contained in:
parent
46a3bea350
commit
d26af5811d
|
@ -8,6 +8,9 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
// gracefulify() has to be called before anything else runs
|
||||
require('graceful-fs').gracefulify(require('fs'));
|
||||
|
||||
// This file must be able to run in node 0.12 without babel so we can show that
|
||||
// it is not supported. This is why the rest of the cli code is in `cliEntry.js`.
|
||||
require('./server/checkNodeVersion')();
|
||||
|
@ -15,7 +18,7 @@ require('./server/checkNodeVersion')();
|
|||
require('../packager/babelRegisterOnly')([
|
||||
/private-cli\/src/,
|
||||
/local-cli/,
|
||||
/react-packager\/src/
|
||||
/react-packager\/src/,
|
||||
]);
|
||||
|
||||
var cliEntry = require('./cliEntry');
|
||||
|
|
|
@ -10,29 +10,22 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
const commander = require('commander');
|
||||
|
||||
const Config = require('./util/Config');
|
||||
const childProcess = require('child_process');
|
||||
const Promise = require('promise');
|
||||
|
||||
const assertRequiredOptions = require('./util/assertRequiredOptions');
|
||||
const chalk = require('chalk');
|
||||
const childProcess = require('child_process');
|
||||
const commander = require('commander');
|
||||
const commands = require('./commands');
|
||||
const defaultConfig = require('./default.config');
|
||||
const init = require('./init/init');
|
||||
const minimist = require('minimist');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const gracefulFs = require('graceful-fs');
|
||||
|
||||
const init = require('./init/init');
|
||||
const commands = require('./commands');
|
||||
const assertRequiredOptions = require('./util/assertRequiredOptions');
|
||||
const pkg = require('../package.json');
|
||||
const defaultConfig = require('./default.config');
|
||||
|
||||
import type { Command } from './commands';
|
||||
|
||||
// graceful-fs helps on getting an error when we run out of file
|
||||
// descriptors. When that happens it will enqueue the operation and retry it.
|
||||
gracefulFs.gracefulify(fs);
|
||||
|
||||
commander.version(pkg.version);
|
||||
|
||||
const defaultOptParser = (val) => val;
|
||||
|
@ -140,7 +133,7 @@ const addCommand = (command: Command, config: Config) => {
|
|||
function getCliConfig() {
|
||||
// Use a lightweight option parser to look up the CLI configuration file,
|
||||
// which we need to set up the parser for the other args and options
|
||||
let cliArgs = minimist(process.argv.slice(2));
|
||||
const cliArgs = minimist(process.argv.slice(2));
|
||||
|
||||
let cwd;
|
||||
let configPath;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
require('../babelRegisterOnly')([/react-packager\/src/]);
|
||||
|
||||
require('./src/node-haste/fastpath').replace();
|
||||
useGracefulFs();
|
||||
|
||||
var debug = require('debug');
|
||||
var Activity = require('./src/Activity');
|
||||
|
@ -73,12 +72,6 @@ exports.getOrderedDependencyPaths = function(options, bundleOptions) {
|
|||
});
|
||||
};
|
||||
|
||||
function useGracefulFs() {
|
||||
var fs = require('fs');
|
||||
var gracefulFs = require('graceful-fs');
|
||||
gracefulFs.gracefulify(fs);
|
||||
}
|
||||
|
||||
function enableDebug() {
|
||||
// react-packager logs debug messages using the 'debug' npm package, and uses
|
||||
// the following prefix throughout.
|
||||
|
|
Loading…
Reference in New Issue