How to use the react-dev-utils/crossSpawn.sync function in react-dev-utils

To help you get started, we’ve selected a few react-dev-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github makajs / maka / packages / maka-cli / scripts / start.js View on Github external
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)
      }
  }
}
github assuncaocharles / create-react-app-parcel / packages / react-scripts-parcel / scripts / eject.js View on Github external
}
      }

      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();
  });
github wix / stylable / packages / react-scripts / scripts / eject.js View on Github external
}
            }

            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();
    });
github OffGridNetworks / fuse-box-create-react-app / packages / fuse-box-react-scripts / scripts / eject.js View on Github external
);
      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();
github wix / stylable / packages / react-scripts / scripts / init.js View on Github external
} 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
github forestryio / create-static-site / packages / static-scripts / scripts / eject.js View on Github external
)
      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()
github commercetools / merchant-center-application-kit / packages / mc-scripts / bin / mc-scripts.js View on Github external
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. ' +
github jaredpalmer / razzle / packages / razzle / bin / razzle.js View on Github external
#!/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.'
github makajs / maka / packages / maka-cli / scripts / utils.js View on Github external
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' });
}