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

TypeScript colors.underline类代码示例

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

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



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

示例1: finalize

/**
 * Calls any external programs to finish setting up the library
 */
function finalize() {
  console.log(colors.underline.white("Finalizing"))

  // Recreate Git folder
  let gitInitOutput = exec('git init "' + path.resolve(__dirname, "..") + '"', {
    silent: true
  }).stdout
  console.log(colors.green(gitInitOutput.replace(/(\n|\r)+/g, "")))

  // Remove post-install command
  let jsonPackage = path.resolve(__dirname, "..", "package.json")
  const pkg = JSON.parse(readFileSync(jsonPackage) as any)

  // Note: Add items to remove from the package file here
  delete pkg.scripts.postinstall

  writeFileSync(jsonPackage, JSON.stringify(pkg, null, 2))
  console.log(colors.green("Postinstall script has been removed"))

  // Initialize Husky
  fork(
    path.resolve(__dirname, "..", "node_modules", "husky", "bin", "install"),
    { silent: true }
  );
  console.log(colors.green("Git hooks set up"))

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


示例2: removeItems

/**
 * Removes items from the project that aren't needed after the initial setup
 */
function removeItems() {
  console.log(colors.underline.white("Removed"))

  // The directories and files are combined here, to simplify the function,
  // as the 'rm' command checks the item type before attempting to remove it
  let rmItems = rmDirs.concat(rmFiles)
  rm("-rf", rmItems.map(f => path.resolve(__dirname, "..", f)))
  console.log(colors.red(rmItems.join("\n")))

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


示例3: renameItems

/**
 * Renames any template files to the new library name
 * 
 * @param libraryName 
 */
function renameItems(libraryName: string) {
  console.log(colors.underline.white("Renamed"))

  renameFiles.forEach(function(files) {
    // Files[0] is the current filename
    // Files[1] is the new name
    let newFilename = files[1].replace(/--libraryname--/g, libraryName)
    mv(
      path.resolve(__dirname, "..", files[0]),
      path.resolve(__dirname, "..", newFilename)
    )
    console.log(colors.cyan(files[0] + " => " + newFilename))
  })

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


示例4: leftLog

let check = (resultSet, subKey) => {
  depth++;
  // If there's no _meta, we need to recurse further
  if (!resultSet._meta) {
    leftLog(depth, '-', colors.underline.white(`${subKey}`));
    Object.keys(resultSet).forEach(key => check(resultSet[key], key));
    depth--;
    return;
  }
  // If there's no reference property, this was the first time we saw this key
  // So we need to check with the user to ensure that this is the right value
  if (!resultSet.hasOwnProperty('reference')) {
    leftLog(depth, colors.red(`X ${subKey}: No reference value found`));
    // Not using template functions here so we're not calling .toString on objects
    leftLog(depth + 1, colors.grey('Latest result:'), resultSet.current);
    if (keyInYNStrict('Use this value?')) {
      resultSet.reference = resultSet.current;
    }
  }

  // If there is a reference property (checked above) and no current, then the test passed
  // Move along, nothing to see here
  if (!resultSet.hasOwnProperty('current')) {
    leftLog(depth, `${greenCheckmark} ${subKey}`);
    depth--;
    return;
  }


  // If there are both current & reference properties, we need to ensure they match
  // If not, a test failed and the user probably wants to update the value there
  try {
    deepStrictEqual(resultSet.reference, resultSet.current);

    leftLog(depth, `${greenCheckmark} ${subKey}`);
  } catch (e) {
    leftLog(depth, colors.red(`X ${subKey}: Values don't match`));
    // Not using template functions here so we're not calling .toString on objects
    leftLog(depth + 1, colors.grey('Reference value:'), resultSet.reference);
    leftLog(depth + 1, colors.grey('Latest result:'), resultSet.current);
    if (keyInYNStrict('Should I replace this?')) {
      resultSet.reference = resultSet.current;
      delete resultSet.current;
    }
  }
  depth--;
};
开发者ID:SomeKittens,项目名称:baddsert,代码行数:47,代码来源:cli.ts


示例5: 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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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