How to use colors-cli - 10 common examples

To help you get started, we’ve selected a few colors-cli 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 kktjs / kkt-ssr / conf / jest.config.js View on Github external
'transformIgnorePatterns',
    'reporters',
  ];
  if (overrides) {
    supportedKeys.forEach((key) => {
      // eslint-disable-next-line
      if (overrides.hasOwnProperty(key)) {
        config[key] = overrides[key];
        delete overrides[key];
      }
    });
    const unsupportedKeys = Object.keys(overrides);
    if (unsupportedKeys.length) {
      /* eslint-disable */
      console.error(
        color.red(
          'Out of the box, kkt-ssr only supports overriding ' +
          'these Jest options:\n\n' +
          supportedKeys.map(key => color.bold('  \u2022 ' + key)).join('\n') +
          '.\n\n' +
          'These options in your package.json Jest configuration ' +
          'are not currently supported by kkt-ssr:\n\n' +
          unsupportedKeys.map(key => color.bold('  \u2022 ' + key)).join('\n')
        )
      );
      /* eslint-enable */
      process.exit(1);
    }
  }
  return config;
};
github kktjs / kkt / conf / jest.config.js View on Github external
'transformIgnorePatterns',
    'reporters',
  ];
  if (overrides) {
    supportedKeys.forEach((key) => {
      // eslint-disable-next-line
      if (overrides.hasOwnProperty(key)) {
        config[key] = overrides[key];
        delete overrides[key];
      }
    });
    const unsupportedKeys = Object.keys(overrides);
    if (unsupportedKeys.length) {
      /* eslint-disable */
      console.error(
        color.red(
          'Out of the box, kkt only supports overriding ' +
          'these Jest options:\n\n' +
          supportedKeys.map(key => color.bold('  \u2022 ' + key)).join('\n') +
          '.\n\n' +
          'These options in your package.json Jest configuration ' +
          'are not currently supported by kkt:\n\n' +
          unsupportedKeys.map(key => color.bold('  \u2022 ' + key)).join('\n')
        )
      );
      /* eslint-enable */
      process.exit(1);
    }
  }
  return config;
};
github kktjs / kkt-ssr / packages / create-kkt-app / lib / loadExample.js View on Github external
if (appPkg) {
        if (appPkg.dependencies && appPkg.dependencies[dependName]) {
          appPkg.dependencies[dependName] = `^${pkg.data.version}`;
        }
        if (appPkg.devDependencies && appPkg.devDependencies[dependName]) {
          appPkg.devDependencies[dependName] = `^${pkg.data.version}`;
        }
        fs.writeFileSync(appPkgPath, JSON.stringify(appPkg, null, 2));
      }
      output.success(
        `Dependent on ${output.cmd(dependName)} version has been set.`
      );
    }
    await installDeps(projectPath, 'npm');
    // eslint-disable-next-line
    console.log(`🎉  ${color.green('✔')} successfully installed ${color.cyan(projectName)} dependencies..`);
    // eslint-disable-next-line
    console.log(
      '👉  Get started with the following commands:\n\n' +
      `${projectPath === process.cwd() ? '' : color.cyan(`   ${color.white('$')} cd ${projectName}\n`)}` +
      `   ${color.cyan(`${color.white('$')} npm run start\n\n`)}`
    );
  }).catch((err) => {
    stopExampleSpinner();
github jaywcjlove / mocker-api / src / index.js View on Github external
watcher.on('all', (event, path) => {
    if (event === 'change' || event === 'add') {
      try {
        // 当监听的可能是多个配置文件时,需要清理掉更新文件以及入口文件的缓存,重新获取
        cleanCache(path);
        watchFiles.forEach(file => cleanCache(file));
        mocker = getConfig();
        console.log(`${color.green_b.black(' Done: ')} Hot Mocker ${color.green(path.replace(process.cwd(), ''))} file replacement success!`);
      } catch (ex) {
        console.error(`${color.red_b.black(' Failed: ')} Hot Mocker ${color.red(path.replace(process.cwd(), ''))} file replacement failed!!`);
      }
    }
  })
  // 监听文件修改重新加载代码
github kktjs / kkt / script / create / loadExample.js View on Github external
if (appPkg) {
        if (appPkg.dependencies && appPkg.dependencies[dependName]) {
          appPkg.dependencies[dependName] = `^${pkg.data.version}`;
        }
        if (appPkg.devDependencies && appPkg.devDependencies[dependName]) {
          appPkg.devDependencies[dependName] = `^${pkg.data.version}`;
        }
        fs.writeFileSync(appPkgPath, JSON.stringify(appPkg, null, 2));
      }
      output.success(
        `Dependent on ${output.cmd(dependName)} version has been set.`
      );
    }
    await installDeps(projectPath, 'npm');
    // eslint-disable-next-line
    console.log(`🎉  ${color.green('✔')} successfully installed ${color.cyan(projectName)} dependencies..`);
    // eslint-disable-next-line
    console.log(
      '👉  Get started with the following commands:\n\n' +
      `${projectPath === process.cwd() ? '' : color.cyan(`   ${color.white('$')} cd ${projectName}\n`)}` +
      `   ${color.cyan(`${color.white('$')} npm run start\n\n`)}`
    );
  }).catch((err) => {
    stopExampleSpinner();
github jaywcjlove / mocker-api / src / index.js View on Github external
watcher.on('all', (event, path) => {
    if (event === 'change' || event === 'add') {
      try {
        // 当监听的可能是多个配置文件时,需要清理掉更新文件以及入口文件的缓存,重新获取
        cleanCache(path);
        watchFiles.forEach(file => cleanCache(file));
        mocker = getConfig();
        console.log(`${color.green_b.black(' Done: ')} Hot Mocker ${color.green(path.replace(process.cwd(), ''))} file replacement success!`);
      } catch (ex) {
        console.error(`${color.red_b.black(' Failed: ')} Hot Mocker ${color.red(path.replace(process.cwd(), ''))} file replacement failed!!`);
      }
    }
  })
  // 监听文件修改重新加载代码
github kktjs / kkt / script / create / loadExample.js View on Github external
if (appPkg.devDependencies && appPkg.devDependencies[dependName]) {
          appPkg.devDependencies[dependName] = `^${pkg.data.version}`;
        }
        fs.writeFileSync(appPkgPath, JSON.stringify(appPkg, null, 2));
      }
      output.success(
        `Dependent on ${output.cmd(dependName)} version has been set.`
      );
    }
    await installDeps(projectPath, 'npm');
    // eslint-disable-next-line
    console.log(`🎉  ${color.green('✔')} successfully installed ${color.cyan(projectName)} dependencies..`);
    // eslint-disable-next-line
    console.log(
      '👉  Get started with the following commands:\n\n' +
      `${projectPath === process.cwd() ? '' : color.cyan(`   ${color.white('$')} cd ${projectName}\n`)}` +
      `   ${color.cyan(`${color.white('$')} npm run start\n\n`)}`
    );
  }).catch((err) => {
    stopExampleSpinner();
github kktjs / kkt-ssr / packages / create-kkt-app / lib / loadExample.js View on Github external
if (appPkg.devDependencies && appPkg.devDependencies[dependName]) {
          appPkg.devDependencies[dependName] = `^${pkg.data.version}`;
        }
        fs.writeFileSync(appPkgPath, JSON.stringify(appPkg, null, 2));
      }
      output.success(
        `Dependent on ${output.cmd(dependName)} version has been set.`
      );
    }
    await installDeps(projectPath, 'npm');
    // eslint-disable-next-line
    console.log(`🎉  ${color.green('✔')} successfully installed ${color.cyan(projectName)} dependencies..`);
    // eslint-disable-next-line
    console.log(
      '👉  Get started with the following commands:\n\n' +
      `${projectPath === process.cwd() ? '' : color.cyan(`   ${color.white('$')} cd ${projectName}\n`)}` +
      `   ${color.cyan(`${color.white('$')} npm run start\n\n`)}`
    );
  }).catch((err) => {
    stopExampleSpinner();
github kktjs / kkt-ssr / utils / loadConfig.js View on Github external
module.exports = (conf, { kktrc, ...optionConf }, webpack) => {
  if (kktrc && kktrc.config && typeof kktrc.config === 'function') {
    conf = kktrc.config(conf, optionConf, webpack) || conf;
  } else if (kktrc && kktrc.config) {
    console.log(color.yellow('Check for .kkt.conf.js file, kktrc.config is not a function.')); // eslint-disable-line
  }
  if (kktrc && kktrc.plugins && kktrc.plugins.length > 0) {
    kktrc.plugins.forEach((item) => {
      const plugin = require(item); // eslint-disable-line
      conf = plugin(conf, optionConf, webpack) || conf;
    });
  }
  return conf;
};
github jaywcjlove / wcj / lib / resume.js View on Github external
function preview_itskill(){
    var its = itskill.data;
    log()
    log(" "+color.x46(itskill.title))
    log()
    for (var i = 0; i < its.length; i++) {

        var txt = ''

        for(var a in its[i]){
            if(its[i][a]) {
                txt += a + ':' + its[i][a] + ' | ';
                // log("   ■ " + (its[i][a]? a + ':' + its[i][a]:"") )
            }
        }
        log("   " + color.x161('■ ') + txt)
        // log("   ----------------------------");
    };
    log()
}