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

TypeScript chalk.bold函数代码示例

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

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



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

示例1: createHttpServer

/**
 * Create HTTP server
 */
async function createHttpServer(options: ServeOptions): Promise<Application> {
  const express = await import('express');
  const app = express();

  /**
   * http responder for /index.html base entrypoint
   */
  const serveIndex = async (req: Request, res: Response) => {
    // respond with the index.html file
    const indexFileName = path.join(options.wwwDir, 'index.html');
    let indexHtml = await readFile(indexFileName, { encoding: 'utf8' });

    indexHtml = injectDevServerScript(indexHtml);

    if (options.livereload) {
      indexHtml = injectLiveReloadScript(indexHtml, options.livereloadPort);
    }

    res.set('Content-Type', 'text/html');
    res.send(indexHtml);
  };

  const serveCordovaPlatformResource = async (req: Request, res: Response, next: NextFunction) => {
    if (options.engine !== 'cordova' || !options.platform) {
      return next();
    }

    const resourcePath = path.resolve('platforms', options.platform, 'platform_www');

    if (await pathExists(path.join(resourcePath, req.url))) {
      res.sendFile(req.url, { root: resourcePath });
    } else {
      next();
    }
  };

  app.get('/', serveIndex);
  app.use('/', (req, res, next) => {
    res.header('Access-Control-Allow-Origin', '*');
    next();
  });
  app.use('/', express.static(options.wwwDir));

  // Cordova
  app.get('/cordova.js', serveCordovaPlatformResource, serveMockCordovaJS);
  app.get('/cordova_plugins.js', serveCordovaPlatformResource);
  app.get('/plugins/*', serveCordovaPlatformResource);

  const livereloadUrl = `http://localhost:${options.livereloadPort}`;
  const pathPrefix = `/${DEV_SERVER_PREFIX}/tiny-lr`;

  await attachProxy(app, { ...DEFAULT_PROXY_CONFIG, mount: pathPrefix, target: livereloadUrl, pathRewrite: { [pathPrefix]: '' } });

  for (const proxy of options.proxies) {
    await attachProxy(app, { ...DEFAULT_PROXY_CONFIG, ...proxy });
    process.stdout.write(`${timestamp()} Proxy created ${chalk.bold(proxy.mount)} => ${proxy.target ? chalk.bold(proxy.target) : '<no target>'}\n`);
  }

  app.get(`/${DEV_SERVER_PREFIX}/dev-server.js`, await createDevServerHandler(options));

  const wss = await createDevLoggerServer(options.host, options.devPort);

  return new Promise<Application>((resolve, reject) => {
    const httpserv = app.listen(options.port, options.host);

    wss.on('error', err => {
      reject(err);
    });

    httpserv.on('error', err => {
      reject(err);
    });

    httpserv.on('listening', () => {
      resolve(app);
    });
  });
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:81,代码来源:serve.ts


示例2:

export const openedPlaygroundMessage = (projectName: string) => `\
The Playground for project ${chalk.bold(projectName)} was opened in your browser.
`
开发者ID:sadeeqaji,项目名称:graphcool-cli,代码行数:3,代码来源:constants.ts


示例3:

 .map(offset => ({
   start: offset,
   end: offset + 'selected'.length,
   message: `Found deprecated @Input() "${red('selected')}" on` +
       ` "${bold('mat-radio-button-group')}". Use "${green('value')}" instead`
 })));
开发者ID:OkBayat,项目名称:material2,代码行数:6,代码来源:checkTemplateMiscRule.ts


示例4:

  mapCoverage: () => `  Option ${chalk.bold(
    '"mapCoverage"',
  )} has been removed, as it's no longer necessary.

  Please update your configuration.`,
开发者ID:Volune,项目名称:jest,代码行数:5,代码来源:Deprecated.ts


示例5: function

var translateParams = function (params: Array<string>) {
    var filterCollection: FilterCollection;
    var issueType: IssueType = IssueType.All;
    var issueState: IssueState = IssueState.All;
    var issueActivity: IssueActivity = IssueActivity.Updated;
    var negated = false;
    var verifyNegation = function (filter: IssueFilter) {
        if (negated) {
            filter.negated = true;
        }
        
        negated = false;
    }
    
    var i = 0;
    while(i < params.length) {
        params[i] = params[i].trim();
        if (params[i] === '' || 
            params[i] === 'in' || 
            params[i] === 'the' || 
            params[i] === 'all' ||
            params[i] === 'that' ||
            params[i] === 'are' ||
            params[i] === 'were' ||
            params[i] === 'update' ||
            params[i] === 'updated' ||
            params[i] === 'request' ||
            params[i] === 'requests') {
            params.splice(i, 1);
        } else {
            i++;
        }
    }
    
    while(params.length > 0) {
        switch(params[0]) {
            case 'open':
                issueState = IssueState.Open;
                break;
            case 'close':
            case 'closed':
                if (issueState === IssueState.All) {
                    issueState = IssueState.Closed;
                }
                
                if (issueActivity === IssueActivity.Updated) {
                    issueActivity = IssueActivity.Closed;
                }
                
                break;
            case 'issues': 
                issueType = IssueType.Issue;
                break;
            case 'pull':
            case 'prs': 
                issueType = IssueType.PullRequest;
                break;
            case 'opened':
            case 'openned':
            case 'created':
                issueActivity = IssueActivity.Created;
                break;
            case 'assign':
            case 'assigned':
                if (!filterCollection) {
                    filterCollection = new FilterCollection();
                }
                
                if (params[1] === 'to') {
                    if (params[2] === 'me') {
                        params[2] = commander.user;
                    }
                    filterCollection.assignee = new IssueAssigneeFilter(params[2]);
                    params.splice(1, 2);
                } else {
                    filterCollection.assignee = new IssueAssigneeFilter(null);
                    params.splice(1, 1);
                }
                verifyNegation(filterCollection.assignee);
                
                break;
            case 'label':
            case 'labeled':
            case 'labelled':
                if (!filterCollection) {
                    filterCollection = new FilterCollection();
                }
                filterCollection.label = new IssueLabelFilter(params[1]);
                verifyNegation(filterCollection.label);    
                
                params.splice(1, 1);
                break;
            case 'last':
            case 'past':
                var multiplier = parseInt(params[1]);
                if (isNaN(multiplier)) {
                    console.log(chalk.red('invalid duration multiplier: ' + chalk.bold(params[1])));
                    startPrompt();
                    return;
                }
//.........这里部分代码省略.........
开发者ID:pierreca,项目名称:dashboards,代码行数:101,代码来源:ghprompt.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript chalk.color函数代码示例发布时间:2022-05-25
下一篇:
TypeScript chalk.blueBright函数代码示例发布时间: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