• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript chalk.italic函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中chalk.italic函数的典型用法代码示例。如果您正苦于以下问题:TypeScript italic函数的具体用法?TypeScript italic怎么用?TypeScript italic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: switchToPublishBranch

  /** Checks if the user is on an allowed publish branch for the specified version. */
  protected switchToPublishBranch(newVersion: Version): string {
    const allowedBranches = getAllowedPublishBranches(newVersion);
    const currentBranchName = this.git.getCurrentBranch();

    // If current branch already matches one of the allowed publish branches, just continue
    // by exiting this function and returning the currently used publish branch.
    if (allowedBranches.includes(currentBranchName)) {
      console.log(green(`  ✓   Using the "${italic(currentBranchName)}" branch.`));
      return currentBranchName;
    }

    // In case there are multiple allowed publish branches for this version, we just
    // exit and let the user decide which branch they want to release from.
    if (allowedBranches.length !== 1) {
      console.warn(yellow('  ✘   You are not on an allowed publish branch.'));
      console.warn(yellow(`      Please switch to one of the following branches: ` +
        `${allowedBranches.join(', ')}`));
      process.exit(0);
    }

    // For this version there is only *one* allowed publish branch, so we could
    // automatically switch to that branch in case the user isn't on it yet.
    const defaultPublishBranch = allowedBranches[0];

    if (!this.git.checkoutBranch(defaultPublishBranch)) {
      console.error(red(`  ✘   Could not switch to the "${italic(defaultPublishBranch)}" ` +
        `branch.`));
      console.error(red(`      Please ensure that the branch exists or manually switch to the ` +
        `branch.`));
      process.exit(1);
    }

    console.log(green(`  ✓   Switched to the "${italic(defaultPublishBranch)}" branch.`));
  }
开发者ID:Nodarii,项目名称:material2,代码行数:35,代码来源:base-release-task.ts


示例2: _pushReleaseTag

  /** Pushes the release tag to the remote repository. */
  private _pushReleaseTag(tagName: string, upstreamRemote: string) {
    const remoteTagSha = this.git.getShaOfRemoteTag(tagName);
    const expectedSha = this.git.getLocalCommitSha('HEAD');

    // The remote tag SHA is empty if the tag does not exist in the remote repository.
    if (remoteTagSha) {
      if (remoteTagSha !== expectedSha) {
        console.error(red(`  ✘   Tag "${tagName}" already exists on the remote, but does not ` +
          `refer to the version bump commit.`));
        console.error(red(`      Please delete the tag on the remote if you want to proceed.`));
        process.exit(1);
      }

      console.info(green(`  ✓   Release tag already exists remotely: "${italic(tagName)}"`));
      return;
    }

    if (!this.git.pushTagToRemote(tagName, upstreamRemote)) {
      console.error(red(`  ✘   Could not push the "${tagName}" tag upstream.`));
      console.error(red(`      Please make sure you have permission to push to the ` +
        `"${this.git.remoteGitUrl}" remote.`));
      process.exit(1);
    }

    console.info(green(`  ✓   Pushed release tag upstream.`));
  }
开发者ID:codef0rmer,项目名称:material2,代码行数:27,代码来源:publish-release.ts


示例3: return

  return (host: Tree) => {
    const workspace = getWorkspace(host);
    const project = getProjectFromWorkspace(workspace, options.project);
    const styleFilePath = getProjectStyleFile(project);

    if (!styleFilePath) {
      console.warn(red(`Could not find the default style file for this project.`));
      console.warn(red(`Please consider manually setting up the Roboto font in your CSS.`));
      return;
    }

    const buffer = host.read(styleFilePath);

    if (!buffer) {
      console.warn(red(`Could not read the default style file within the project ` +
        `(${italic(styleFilePath)})`));
      console.warn(red(`Please consider manually setting up the Robot font.`));
      return;
    }

    const htmlContent = buffer.toString();
    const insertion = '\n' +
      `html, body { height: 100%; }\n` +
      `body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }\n`;

    if (htmlContent.includes(insertion)) {
      return;
    }

    const recorder = host.beginUpdate(styleFilePath);

    recorder.insertLeft(htmlContent.length, insertion);
    host.commitUpdate(recorder);
  };
开发者ID:Nodarii,项目名称:material2,代码行数:34,代码来源:setup-project.ts


示例4: getUnnamedArg

(async () => {
  const buildablePackages = [...NODE_PACKAGES, ...BROWSER_PACKAGES];
  // TODO: Allow shorthand names (shared => react-cosmos-shared2, etc.)
  const pkgName = getUnnamedArg();

  if (pkgName) {
    if (typeof pkgName !== 'string') {
      stderr.write(
        error(`Invalid package name ${chalk.bold(String(pkgName))}!\n`)
      );
      process.exit(1);
      return;
    }

    if (buildablePackages.indexOf(pkgName) === -1) {
      stderr.write(
        error(
          `${chalk.bold(
            pkgName
          )} doesn't exist!\nPackages: ${getFormattedPackageList(
            buildablePackages
          )}\n`
        )
      );
      process.exit(1);
      return;
    }

    stdout.write(
      `${watch ? 'Build-watching' : 'Building'} ${chalk.bold(pkgName)}...\n`
    );

    await buildPackage(pkgName);
  } else {
    if (watch) {
      // The limitation here is that we need to build browser packages after
      // packages compiled with Babel. This doesn't work out of the box because
      // `buildNodePackage` hangs forever in watch mode.
      stderr.write(
        error(
          `Can't build-watch all packages! Run ${chalk.italic(
            'build PACKAGE --watch'
          )} for one or more packages (in separate terminals)\n`
        )
      );
      process.exit(1);
      return;
    }

    // Packages are built serially because they depend on each other and
    // this way TypeScript ensures their interfaces are compatible
    for (const curPkgName of BUILD_ORDER) {
      await buildPackage(curPkgName);
    }

    stdout.write(`Built ${buildablePackages.length} packages successfully.\n`);
  }
})();
开发者ID:skidding,项目名称:cosmos,代码行数:58,代码来源:build.ts


示例5: async

export default async () => {
  // check if this folder contains an already bootstrapped project
  // check if config.json exists
  // validate config.json
  // ask if config should be modified
  // walk config tree and ask questions
  console.log('  - now configuring 👩🏿‍🎓');
  if (
    ![
      checkFile('package.json'),
      checkFile('firebase.json'),
      checkFile('firestore.rules'),
      checkFile('firestore.indexes.json'),
      checkFile('storage.rules'),
      checkFile('.firebaserc'),
    ].every(Boolean)
  ) {
    return;
  }

  try {
    const projectId = await getProjectId();

    const { apiKey } = await prompt<{ apiKey: string }>([
      {
        type: 'input',
        name: 'apiKey',
        message: `Visit this page ${chalk.underline(
          `https://console.firebase.google.com/project/${projectId}/settings/general/`
        )} and paste the variable ${chalk.italic('apiKey')} here:`,
      },
    ]);

    let overwriteEnv = true;
    if (checkFile('.env', false)) {
      overwriteEnv = (await prompt<{ overwriteEnv: boolean }>({
        type: 'confirm',
        name: 'overwriteEnv',
        message: 'File .env already exists. Do you want to overwrite it?',
        initial: false,
      })).overwriteEnv;
    }
    if (overwriteEnv) {
      writeEnvFile(projectId, apiKey);
    }

    // TODO: generate config.json
    // TODO: upload cloud functions config
    // TODO: run npm build to generate editor in public folder

    console.log('Please enable Firestore in the Firebase console');
    console.log('Then, run firebase deploy');
  } catch (error) {
    console.log(error);
  }
};
开发者ID:accosine,项目名称:poltergeist,代码行数:56,代码来源:configure.ts


示例6: verifyPublishBranch

  /** Verifies that the user is on the specified publish branch. */
  private verifyPublishBranch(expectedPublishBranch: string) {
    const currentBranchName = this.git.getCurrentBranch();

    // Check if current branch matches the expected publish branch.
    if (expectedPublishBranch !== currentBranchName) {
      console.error(red(`Cannot stage release from "${italic(currentBranchName)}". Please stage ` +
        `the release from "${bold(expectedPublishBranch)}".`));
      process.exit(1);
    }
  }
开发者ID:shlomiassaf,项目名称:material2,代码行数:11,代码来源:stage-release.ts


示例7: _createReleaseTag

  /** Creates the specified release tag locally. */
  private _createReleaseTag(tagName: string, releaseNotes: string) {
    if (this.git.hasLocalTag(tagName)) {
      const expectedSha = this.git.getLocalCommitSha('HEAD');

      if (this.git.getShaOfLocalTag(tagName) !== expectedSha) {
        console.error(red(`  ✘   Tag "${tagName}" already exists locally, but does not refer ` +
          `to the version bump commit. Please delete the tag if you want to proceed.`));
        process.exit(1);
      }

      console.info(green(`  ✓   Release tag already exists: "${italic(tagName)}"`));
    } else if (this.git.createTag('HEAD', tagName, releaseNotes)) {
      console.info(green(`  ✓   Created release tag: "${italic(tagName)}"`));
    } else {
      console.error(red(`  ✘   Could not create the "${tagName}" tag.`));
      console.error(red(`      Please make sure there is no existing tag with the same name.`));
      process.exit(1);
    }

  }
开发者ID:codef0rmer,项目名称:material2,代码行数:21,代码来源:publish-release.ts


示例8: verifyLocalCommitsMatchUpstream

  /** Verifies that the local branch is up to date with the given publish branch. */
  protected verifyLocalCommitsMatchUpstream(publishBranch: string) {
    const upstreamCommitSha = this.git.getRemoteCommitSha(publishBranch);
    const localCommitSha = this.git.getLocalCommitSha('HEAD');

    // Check if the current branch is in sync with the remote branch.
    if (upstreamCommitSha !== localCommitSha) {
      console.error(red(`  ✘ The current branch is not in sync with the remote branch. Please ` +
        `make sure your local branch "${italic(publishBranch)}" is up to date.`));
      process.exit(1);
    }
  }
开发者ID:Nodarii,项目名称:material2,代码行数:12,代码来源:base-release-task.ts


示例9: constructor

  constructor(public projectDir: string) {
    this.packageJsonPath = join(projectDir, 'package.json');

    console.log(this.projectDir);

    if (!existsSync(this.packageJsonPath)) {
      console.error(red(`The specified directory is not referring to a project directory. ` +
        `There must be a ${italic('package.json')} file in the project directory.`));
      process.exit(1);
    }

    this.packageJson = JSON.parse(readFileSync(this.packageJsonPath, 'utf-8'));
    this.currentVersion = parseVersionName(this.packageJson.version);

    if (!this.currentVersion) {
      console.error(red(`Cannot parse current version in ${italic('package.json')}. Please ` +
        `make sure "${this.packageJson.version}" is a valid Semver version.`));
      process.exit(1);
    }

    this.git = new GitClient(projectDir, this.packageJson.repository.url);
  }
开发者ID:shlomiassaf,项目名称:material2,代码行数:22,代码来源:stage-release.ts


示例10: appStarted

  // Called when express.js app starts on given port w/o errors
  public static appStarted(port: number, tunnelStarted?: string) {
    console.log(`Server started ${chalk.green('✓')}`);

    // If the tunnel started, log that and the URL it's available at
    if (tunnelStarted) {
      console.log(`Tunnel initialised ${chalk.green('✓')}`);
    }

    console.log(`
${chalk.bold('Access URLs:')}${divider}
Localhost: ${chalk.magenta(`http://localhost:${port}`)}
      LAN: ${chalk.magenta(`http://${ip.address()}:${port}`) +
(tunnelStarted ? `\n    Proxy: ${chalk.magenta(tunnelStarted)}` : '')}${divider}
${chalk.blue(`Press ${chalk.italic('CTRL-C')} to stop`)}
    `);
  }
开发者ID:StrikeForceZero,项目名称:react-boilerplate,代码行数:17,代码来源:logger.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript chalk.magenta函数代码示例发布时间:2022-05-25
下一篇:
TypeScript chalk.inverse函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap