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


TypeScript chalk.bold函数代码示例

本文整理汇总了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;未经允许,请勿转载。