How to use the react-dev-utils/inquirer.prompt 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 OffGridNetworks / fuse-box-create-react-app / packages / fuse-box-react-scripts / scripts / ejectconfig.js View on Github external
*
 * 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, '..');
github wix / stylable / packages / react-scripts / scripts / eject.js View on Github external
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:') +
github pagarme / react-scripts-former-kit-dashboard / scripts / eject.js View on Github external
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(
github qiqiboy / react-formutil / docs / scripts / config / checkMissDependencies.js View on Github external
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();
github assuncaocharles / create-react-app-parcel / packages / react-scripts-parcel / scripts / eject.js View on Github external
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(
github kriasoft / react-app / packages / react-app-tools / scripts / eject.js View on Github external
}).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(
github forestryio / create-static-site / packages / static-scripts / scripts / eject.js View on Github external
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(
github naviapps / create-nw-react-app / packages / nw-react-scripts / scripts / eject.js View on Github external
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(
github facebook / create-react-app / packages / react-scripts / scripts / eject.js View on Github external
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(