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


TypeScript colors.yellow函数代码示例

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


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

示例1: async

export const execCmd = async (cmd: string, options?: IExecCmdOptions) => new Promise<string>((res, rej) => {
  console.info(colors.yellow(`executing ${cmd}`));
  const stream = exec(cmd, options);
  let outBuffer = '';
  let errBuffer = '';

  stream.stdout.on('data', (chunk) => {
    const str = chunk.toString();
    outBuffer = outBuffer.concat(str);
    console.info(colors.green(str));
  });

  stream.stderr.on('data', (chunk) => {
    const str = chunk.toString();
    errBuffer = errBuffer.concat(str);
    console.error(colors.red(str));
  });

  stream.on('error', (err) => {
    return err
      ? rej(err)
      : res(err);
  });

  stream.on('exit', (code) => {
    return code === 0
      ? res(outBuffer)
      : rej(errBuffer);
  });
});
开发者ID:santech-org,项目名称:ng-on-rest,代码行数:30,代码来源:index.ts

示例2: runTestFile

function runTestFile(file) {
  console.log(colors.yellow('[gulp watch - testFile]') + ' ' + colors.cyan(file));
  gulp.src(file)
    .pipe($.jasmine({ verbose: true }))
    .on('error', swallowError)
    .on('end', addSpaces);
}
开发者ID:DmitryEfimenko,项目名称:docker-cmd-js,代码行数:7,代码来源:gulpfile.ts

示例3: logTest

 /**
  * Logs NN test output
  * @since 0.0.2
  */
 public static logTest(output: string | string[] = '') {
     let colors = require('colors');
     let prefix = colors.yellow('[TEST] ');
     if (typeof output === 'string') {
         console.log(prefix + output);
     } else {
         output.forEach(function (outputString) {
             console.log(prefix + outputString);
         });
     }
 }
开发者ID:TimboKZ,项目名称:js-digit-recognition,代码行数:15,代码来源:Util.ts

示例4: modifyContents

/**
 * Updates the contents of the template files with the library name or user details
 * 
 * @param libraryName 
 * @param username 
 * @param usermail 
 */
function modifyContents(libraryName: string, username: string, usermail: string) {
  console.log(colors.underline.white("Modified"))

  let files = modifyFiles.map(f => path.resolve(__dirname, "..", f))
  try {
    const changes = replace.sync({
      files,
      from: [/--libraryname--/g, /--username--/g, /--usermail--/g],
      to: [libraryName, username, usermail]
    })
    console.log(colors.yellow(modifyFiles.join("\n")))
  } catch (error) {
    console.error("An error occurred modifying the file: ", error)
  }

  console.log("\n")
}
开发者ID:robertrbairdii,项目名称:typescript-library-starter,代码行数:24,代码来源:init.ts

示例5: applyColor

function applyColor(message: string, color: Color): string {
    if (!message) return;
    if (!color) return message;

    switch (color) {
        case Color.black:   return colors.black(message);
        case Color.red:     return colors.red(message);
        case Color.green:   return colors.green(message);
        case Color.yellow:  return colors.yellow(message);
        case Color.blue:    return colors.blue(message);
        case Color.magenta: return colors.magenta(message);
        case Color.cyan:    return colors.cyan(message);
        case Color.white:   return colors.white(message);
        case Color.grey:    return colors.grey(message);
        default:            throw new Error('Invalid Color');
    }
}
开发者ID:herculesinc,项目名称:credo.logger,代码行数:17,代码来源:ConsoleLogger.ts

示例6: compileFile

function compileFile(file: string) {
  console.log(colors.yellow('[gulp watch - compileFile]' + ' ' + colors.cyan(file)));
  const tsProject = $.typescript.createProject('./tsconfig.json', {
    noResolve: false,
    removeComments: true,
    rootDir: path.join(__dirname)
  });

  const tsResult = gulp.src([file, typesPath])
    .pipe(tsProject());

  const sections = file.split('\\');
  sections.pop();
  const dest = sections.join('\\');

  return tsResult.js
    .pipe(gulp.dest(path.join(__dirname, 'dist', dest)));
}
开发者ID:DmitryEfimenko,项目名称:docker-cmd-js,代码行数:18,代码来源:gulpfile.ts

示例7: writeNpmrcFile

 packages.forEach(async (pckg) => {
   if (!await checkModulePublished(pckg)) {
     console.info(colors.yellow(`Package never published ${pckg.name}`));
     if (currentBranch === releaseBranch) {
       try {
         const packageDistPath = path.join(pckg.path, packageDistDir);
         await writeNpmrcFile(packageDistPath);
         await execCmd(`cd ${packageDistPath} && npm publish`, {
           env: {
             NPM_TOKEN: process.env.NPM_TOKEN,
           },
         });
       } catch (e) {
         console.error(colors.red(`Error : ${e}`));
       }
     } else {
       console.info(colors.green(`Skipping publish as on; ${currentBranch}`));
     }
   } else {
     console.info(colors.green(`${pckg.name} already published`));
   }
 });
开发者ID:santech-org,项目名称:ng-on-rest,代码行数:22,代码来源:publish.ts

示例8: consoleTestResultHandler

export function consoleTestResultHandler(testResult: TestResult): boolean {
    // needed to get colors to show up when passing through Grunt
    (colors as any).enabled = true;

    let didAllTestsPass = true;

    for (const fileName of Object.keys(testResult.results)) {
        const results = testResult.results[fileName];
        process.stdout.write(`${fileName}:`);

        /* tslint:disable:no-console */
        if (results.skipped) {
            console.log(colors.yellow(` Skipped, requires typescript ${results.requirement}`));
        } else {
            const markupDiffResults = diff.diffLines(results.markupFromMarkup, results.markupFromLinter);
            const fixesDiffResults = diff.diffLines(results.fixesFromLinter, results.fixesFromMarkup);
            const didMarkupTestPass = !markupDiffResults.some((hunk) => hunk.added === true || hunk.removed === true);
            const didFixesTestPass = !fixesDiffResults.some((hunk) => hunk.added === true || hunk.removed === true);

            if (didMarkupTestPass && didFixesTestPass) {
                console.log(colors.green(" Passed"));
            } else {
                console.log(colors.red(" Failed!"));
                didAllTestsPass = false;
                if (!didMarkupTestPass) {
                    displayDiffResults(markupDiffResults, MARKUP_FILE_EXTENSION);
                }
                if (!didFixesTestPass) {
                    displayDiffResults(fixesDiffResults, FIXES_FILE_EXTENSION);
                }
            }
        }
        /* tslint:enable:no-console */
    }

    return didAllTestsPass;
}
开发者ID:IllusionMH,项目名称:tslint,代码行数:37,代码来源:test.ts

示例9: format

    public format(failures: RuleFailure[]): string {
        if (typeof failures[0] === "undefined") {
            return "\n";
        }

        const fileName        = failures[0].getFileName();
        const positionMaxSize = this.getPositionMaxSize(failures);
        const ruleMaxSize     = this.getRuleMaxSize(failures);

        const outputLines = [
            fileName,
        ];

        for (const failure of failures) {
            const failureString = failure.getFailure();

            // Rule
            let ruleName = failure.getRuleName();
            ruleName     = this.pad(ruleName, ruleMaxSize);
            ruleName     = colors.yellow(ruleName);

            // Lines
            const lineAndCharacter = failure.getStartPosition().getLineAndCharacter();

            let positionTuple = `${lineAndCharacter.line + 1}:${lineAndCharacter.character + 1}`;
            positionTuple     = this.pad(positionTuple, positionMaxSize);
            positionTuple     = colors.red(positionTuple);

            // Ouput
            const output = `${positionTuple}  ${ruleName}  ${failureString}`;

            outputLines.push(output);
        }

        return outputLines.join("\n") + "\n\n";
    }
开发者ID:DovydasNavickas,项目名称:tslint,代码行数:36,代码来源:stylishFormatter.ts

示例10:

 networks[device].forEach((details: os.NetworkInterfaceInfo) => {
   if (details.family === 'IPv4') {
     console.log(colors.yellow('  https://' + details.address + ':' + httpServerPort));
   }
 });
开发者ID:andrewconnell,项目名称:pres-ng2-officeaddin,代码行数:5,代码来源:server.ts


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