当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript bold.greenBright方法代码示例

本文整理汇总了TypeScript中chalk.bold.greenBright方法的典型用法代码示例。如果您正苦于以下问题:TypeScript bold.greenBright方法的具体用法?TypeScript bold.greenBright怎么用?TypeScript bold.greenBright使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chalk.bold的用法示例。


在下文中一共展示了bold.greenBright方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: Promise

  return new Promise((resolve, reject) => {
    const vccParam = `-VisualStudioVersion '${BUILD_TOOLS.version.toString()}'`;
    const pathParam = `-BuildToolsInstallerPath '${vccInstaller.directory}'`;

    const buildToolsParam = IS_BUILD_TOOLS_INSTALLED
      ? ``
      : `-InstallBuildTools -ExtraBuildToolsParameters '${getBuildToolsExtraParameters()}'`;

    const pythonParam = IS_PYTHON_INSTALLED
      ? ``
      : `-PythonInstaller '${pythonInstaller.fileName}' -InstallPython`;

    const psArgs = `& {& '${installerScriptPath}' ${pathParam} ${buildToolsParam} ${pythonParam} ${vccParam} }`;
    const args = ['-ExecutionPolicy', 'Bypass', '-NoProfile', '-NoLogo', psArgs];

    debug(`Installer: Launching installer in ${vccInstaller.directory} with parameters ${args}.`);

    let child;

    try {
      child = spawn('powershell.exe', args);
    } catch (error) {
      log(chalk.bold.red('Error: failed while trying to run powershell.exe.'));
      log(chalk.bold.greenBright('Hint: Is "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0" in your system path?'));
      log(`\nTried to execute: "powershell.exe ${args.join(' ')}"\n`);

      return reject(error);
    }

    child.stdout.on('data', (data) => {
      debug(`Installer: Stdout from launch-installer.ps1: ${data.toString()}`);

      if (data.toString().includes('Please restart this script from an administrative PowerShell!')) {
        log(chalk.bold.red('Please restart this script from an administrative PowerShell!'));
        log('The build tools cannot be installed without administrative rights.');
        log('To fix, right-click on PowerShell and run "as Administrator".');

        // Bail out
        process.exit(1);
      }
    });

    child.stderr.on('data', (data) => debug(`Installer: Stderr from launch-installer.ps1: ${data.toString()}`));

    child.on('exit', () => resolve());
    child.stdin.end();
  });
开发者ID:felixrieseberg,项目名称:windows-build-tools,代码行数:47,代码来源:launch.ts


注:本文中的chalk.bold.greenBright方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。