Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var fs = require('fs-extra');
var path = require('path');
var paths = require('../config/paths');
const inquirer = require('react-dev-utils/inquirer');
var spawnSync = require('cross-spawn').sync;
var chalk = require('chalk');
var green = chalk.green;
var cyan = chalk.cyan;
const os = require('os');
inquirer
.prompt({
type: 'confirm',
name: 'shouldEject',
message:
'Are you sure you want to eject the FuseBox configuration? This action is permanent (unless you delete the ejected files).',
default: false,
})
.then(shouldEject => {
if (!shouldEject) {
console.log(cyan('Close one! Eject aborted.'));
process.exit(1);
}
console.log('Ejecting Configuration...');
var ownPath = path.join(__dirname, '..');
const green = chalk.green;
const cyan = chalk.cyan;
function getGitStatus() {
try {
let stdout = execSync(`git status --porcelain`, {
stdio: ['pipe', 'pipe', 'ignore']
}).toString();
return stdout.trim();
} catch (e) {
return '';
}
}
inquirer
.prompt({
type: 'confirm',
name: 'shouldEject',
message: 'Are you sure you want to eject? This action is permanent.',
default: false
})
.then(answer => {
if (!answer.shouldEject) {
console.log(cyan('Close one! Eject aborted.'));
return;
}
const gitStatus = getGitStatus();
if (gitStatus) {
console.error(
chalk.red('This git repository has untracked files or uncommitted changes:') +
const green = chalk.green
const cyan = chalk.cyan
function getGitStatus() {
try {
let stdout = execSync(`git status --porcelain`, {
stdio: ['pipe', 'pipe', 'ignore'],
}).toString()
return stdout.trim()
} catch (e) {
return ''
}
}
inquirer
.prompt({
type: 'confirm',
name: 'shouldEject',
message: 'Are you sure you want to eject? This action is permanent.',
default: false,
})
.then(answer => {
if (!answer.shouldEject) {
console.log(cyan('Close one! Eject aborted.'))
return
}
const gitStatus = getGitStatus()
if (gitStatus) {
console.error(
chalk.red(
checkDependencies({}, function(result) {
if (result.status) {
spinner.stop();
result.error.forEach(function(err) {
console.log(err);
});
console.log();
inquirer
.prompt([
{
name: 'reInstall',
type: 'confirm',
message:
'你当前安装的依赖版本和要求的不一致,是否要重新安装所有依赖?\n' +
chalk.dim('重新运行 npm install 安装所有依赖项.'),
default: true
}
])
.then(function(answers) {
if (answers.reInstall) {
install(function(code, command, args) {
if (code !== 0) {
console.error('`' + command + ' ' + args.join(' ') + '` 运行失败');
return reject();
const green = chalk.green;
const cyan = chalk.cyan;
function getGitStatus() {
try {
let stdout = execSync(`git status --porcelain`, {
stdio: ['pipe', 'pipe', 'ignore'],
}).toString();
return stdout.trim();
} catch (e) {
return '';
}
}
inquirer
.prompt({
type: 'confirm',
name: 'shouldEject',
message: 'Are you sure you want to eject? This action is permanent.',
default: false,
})
.then(answer => {
if (!answer.shouldEject) {
console.log(cyan('Close one! Eject aborted.'));
return;
}
const gitStatus = getGitStatus();
if (gitStatus) {
console.error(
chalk.red(
}).toString();
return stdout.trim();
} catch (e) {
return '';
}
}
console.log(
chalk.cyan.bold(
'NOTE: Create React App 2 supports TypeScript, Sass, CSS Modules and more without ejecting: ' +
'https://reactjs.org/blog/2018/10/01/create-react-app-v2.html'
)
);
console.log();
inquirer
.prompt({
type: 'confirm',
name: 'shouldEject',
message: 'Are you sure you want to eject? This action is permanent.',
default: false,
})
.then(answer => {
if (!answer.shouldEject) {
console.log(cyan('Close one! Eject aborted.'));
return;
}
const gitStatus = getGitStatus();
if (gitStatus) {
console.error(
chalk.red(
const green = chalk.green
const cyan = chalk.cyan
function getGitStatus() {
try {
let stdout = execSync(`git status --porcelain`, {
stdio: ["pipe", "pipe", "ignore"],
}).toString()
return stdout.trim()
} catch (e) {
return ""
}
}
inquirer
.prompt({
type: "confirm",
name: "shouldEject",
message: "Are you sure you want to eject? This action is permanent.",
default: false,
})
.then(answer => {
if (!answer.shouldEject) {
console.log(cyan("Close one! Eject aborted."))
return
}
const gitStatus = getGitStatus()
if (gitStatus) {
console.error(
chalk.red(
return true;
} catch (e) {
return false;
}
}
console.log(
chalk.cyan.bold(
'NOTE: Create React App 2+ supports TypeScript, Sass, CSS Modules and more without ejecting: ' +
'https://reactjs.org/blog/2018/10/01/create-react-app-v2.html'
)
);
console.log();
inquirer
.prompt({
type: 'confirm',
name: 'shouldEject',
message: 'Are you sure you want to eject? This action is permanent.',
default: false,
})
.then(answer => {
if (!answer.shouldEject) {
console.log(cyan('Close one! Eject aborted.'));
return;
}
const gitStatus = getGitStatus();
if (gitStatus) {
console.error(
chalk.red(
return true;
} catch (e) {
return false;
}
}
console.log(
chalk.cyan.bold(
'NOTE: Create React App 2+ supports TypeScript, Sass, CSS Modules and more without ejecting: ' +
'https://reactjs.org/blog/2018/10/01/create-react-app-v2.html'
)
);
console.log();
inquirer
.prompt({
type: 'confirm',
name: 'shouldEject',
message: 'Are you sure you want to eject? This action is permanent.',
default: false,
})
.then(answer => {
if (!answer.shouldEject) {
console.log(cyan('Close one! Eject aborted.'));
return;
}
const gitStatus = getGitStatus();
if (gitStatus) {
console.error(
chalk.red(