本文整理汇总了TypeScript中colors.underline.white方法的典型用法代码示例。如果您正苦于以下问题:TypeScript underline.white方法的具体用法?TypeScript underline.white怎么用?TypeScript underline.white使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类colors.underline
的用法示例。
在下文中一共展示了underline.white方法的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")
}
示例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")
}
示例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")
}
示例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--;
};
示例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")
}