Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function copyDep() {
var r = spawn.sync('node',
[path.resolve(__dirname, '..', 'scripts', 'copy-dep.js'), isDev, outputPath],
// { stdio: 'inherit' }
);
var stdout = r.stdout && r.stdout.toString()
if(stdout){
console.log(chalk.yellow(stdout))
if(readlineSync.keyInYN('Exists warning, Continue?')) {
}
else{
process.exit(0)
}
}
}
}
}
console.log(cyan('Running yarn...'));
spawnSync('yarnpkg', ['--cwd', process.cwd()], { stdio: 'inherit' });
if (windowsCmdFileContent && !fs.existsSync(windowsCmdFilePath)) {
try {
fs.writeFileSync(windowsCmdFilePath, windowsCmdFileContent);
} catch (err) {
// If this fails we're not worse off than if we didn't try to fix it.
}
}
} else {
console.log(cyan('Running npm install...'));
spawnSync('npm', ['install', '--loglevel', 'error'], {
stdio: 'inherit',
});
}
console.log(green('Ejected successfully!'));
console.log();
console.log(
green('Please consider sharing why you ejected in this survey:')
);
console.log(green(' http://goo.gl/forms/Bi6CZjk1EqsdelXk1'));
console.log();
});
}
}
console.log(cyan('Running yarn...'));
spawnSync('yarnpkg', ['--cwd', process.cwd()], { stdio: 'inherit' });
if (windowsCmdFileContent && !fs.existsSync(windowsCmdFilePath)) {
try {
fs.writeFileSync(windowsCmdFilePath, windowsCmdFileContent);
} catch (err) {
// If this fails we're not worse off than if we didn't try to fix it.
}
}
} else {
console.log(cyan('Running npm install...'));
spawnSync('npm', ['install', '--loglevel', 'error'], {
stdio: 'inherit'
});
}
console.log(green('Ejected successfully!'));
console.log();
console.log(green('Please consider sharing why you ejected in this survey:'));
console.log(green(' http://goo.gl/forms/Bi6CZjk1EqsdelXk1'));
console.log();
});
);
let windowsCmdFileContent;
if (process.platform === 'win32') {
// https://github.com/offgridnetworks/fuse-box-create-react-app/pull/3806#issuecomment-357781035
// Yarn is diligent about cleaning up after itself, but this causes the react-scripts.cmd file
// to be deleted while it is running. This trips Windows up after the eject completes.
// We'll read the batch file and later "write it back" to match npm behavior.
try {
windowsCmdFileContent = fs.readFileSync(windowsCmdFilePath);
} catch (err) {
// If this fails we're not worse off than if we didn't try to fix it.
}
}
console.log(cyan('Running yarn...'));
spawnSync('yarnpkg', ['--cwd', process.cwd()], { stdio: 'inherit' });
if (windowsCmdFileContent && !fs.existsSync(windowsCmdFilePath)) {
try {
fs.writeFileSync(windowsCmdFilePath, windowsCmdFileContent);
} catch (err) {
// If this fails we're not worse off than if we didn't try to fix it.
}
}
} else {
console.log(cyan('Running npm install...'));
spawnSync('npm', ['install', '--loglevel', 'error'], {
stdio: 'inherit',
});
}
console.log(green('Ejected successfully!'));
console.log();
} else {
command = 'npm';
args = ['install', '--save', verbose && '--verbose']
.filter(e => e)
.concat(templateDependencies);
devArgs = ['install', '--save-dev', verbose && '--verbose']
.filter(e => e)
.concat(templateDevDependencies);
}
console.log(`Installing dependencies and dev dependencies using ${displayedCommand}...`);
console.log();
if (templateDependencies.length) {
// install dependencies
const depsInstall = spawn.sync(command, args, { stdio: 'inherit' });
if (depsInstall.status !== 0) {
console.error(`\`${command} ${args.join(' ')}\` failed`);
return;
}
}
if (templateDevDependencies) {
// install dev dependencies
const devDepsInstall = spawn.sync(command, devArgs, { stdio: 'inherit' });
if (devDepsInstall.status !== 0) {
console.error(`\`${command} ${devArgs.join(' ')}\` failed`);
return;
}
}
// copy tsconfig.json
)
let windowsCmdFileContent
if (process.platform === "win32") {
// https://github.com/facebook/create-react-app/pull/3806#issuecomment-357781035
// Yarn is diligent about cleaning up after itself, but this causes the react-scripts.cmd file
// to be deleted while it is running. This trips Windows up after the eject completes.
// We'll read the batch file and later "write it back" to match npm behavior.
try {
windowsCmdFileContent = fs.readFileSync(windowsCmdFilePath)
} catch (err) {
// If this fails we're not worse off than if we didn't try to fix it.
}
}
console.log(cyan("Running yarn..."))
spawnSync("yarnpkg", ["--cwd", process.cwd()], { stdio: "inherit" })
if (windowsCmdFileContent && !fs.existsSync(windowsCmdFilePath)) {
try {
fs.writeFileSync(windowsCmdFilePath, windowsCmdFileContent)
} catch (err) {
// If this fails we're not worse off than if we didn't try to fix it.
}
}
} else {
console.log(cyan("Running npm install..."))
spawnSync("npm", ["install", "--loglevel", "error"], {
stdio: "inherit",
})
}
console.log(green("Ejected successfully!"))
console.log()
compile-html Compiles index.html.template into index.html, with all the related runtime configuration applied as well as the properly security headers (requires "mc-scripts build" to run before)
extract-intl Extracts intl messages into JSON files
start Starts the application using webpack dev server
`);
process.exit(0);
}
const command = commands[0];
switch (command) {
case 'build':
case 'compile-html':
case 'extract-intl':
case 'start': {
const commandArgs = process.argv.slice(2).filter(arg => command !== arg);
const result = spawn.sync(
'node',
[require.resolve(`../${command}`)].concat(commandArgs),
{
stdio: 'inherit',
}
);
if (result.signal) {
if (result.signal === 'SIGKILL') {
console.log(
'The build failed because the process exited too early. ' +
'This probably means the system ran out of memory or someone called ' +
'`kill -9` on the process.'
);
} else if (result.signal === 'SIGTERM') {
console.log(
'The build failed because the process exited too early. ' +
#!/usr/bin/env node
'use strict';
const spawn = require('react-dev-utils/crossSpawn');
const script = process.argv[2];
const args = process.argv.slice(3);
switch (script) {
case 'build':
case 'start':
case 'test': {
const result = spawn.sync(
'node',
[require.resolve('../scripts/' + script)].concat(args),
{ stdio: 'inherit' }
);
if (result.signal) {
if (result.signal === 'SIGKILL') {
console.log(
'The build failed because the process exited too early. ' +
'This probably means the system ran out of memory or someone called ' +
'`kill -9` on the process.'
);
} else if (result.signal === 'SIGTERM') {
console.log(
'The build failed because the process exited too early. ' +
'Someone might have called `kill` or `killall`, or the system could ' +
'be shutting down.'
async function npm (args, root){
let command;
let isOnline = await checkIfOnline()
command = 'npm';
if (!isOnline) {
args.push('--offline');
}
args.push('--cwd');
if (!isOnline) {
console.log(chalk.yellow('Please connect to the network.'));
console.log();
}
spawn.sync(command, args, { stdio: 'inherit' });
}