本文整理汇总了TypeScript中chalk.magenta函数的典型用法代码示例。如果您正苦于以下问题:TypeScript magenta函数的具体用法?TypeScript magenta怎么用?TypeScript magenta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了magenta函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: GetPort
new GetPort().startPortSearch(clOptions.port, (port) => {
/** If the user *did* specify a port and we end up not using it */
if (clOptions.port !== cl.defaultPort
&& port !== clOptions.port) {
console.log(chalk.magenta(`[WEB] WARNING: Desired port is not available so using port ${port}`));
}
// Also setup in clOptions for future use.
clOptions.port = port;
server.listen(port, clOptions.host, function(err) {
if (err) {
console.error(err);
exit(errorCodes.couldNotListen);
}
const host = clOptions.host in {'localhost':true,'127.0.0.1':true,'0.0.0.0': true} ? 'localhost' : clOptions.host;
const url = `http://${host}:${port}`;
console.log(`DASHBOARD:`, chalk.green(url));
if (clOptions.open) {
open(url);
}
listeningAtUrl.emit({ url });
serverStarted.started();
});
});
示例2: magentaReverse
static magentaReverse(tag: any, message: any) {
console.log(`${tag}${chalkMagenta(message)}`)
}
示例3: magenta
static magenta(tag: any, message: any) {
console.log(`${chalkMagenta(tag)}${message}`)
}
示例4: log
public log() {
console.log(chalk.magenta('Writing files'))
console.log('')
}
示例5: async
gulp.watch(settings.scripts, async (done) => {
await taskRunner.run(Typescript);
console.log(magenta("Project reloaded"));
done();
});
示例6: stderr
function stderr(line: string) {
process.stderr.write(chalk.magenta(line) + '\n');
}
示例7: staticCommand
export async function staticCommand(config: Configuration): Promise<Error[]> {
const stats = new StatsCounter()
// step 0: create working dir
if (!config.workspace) {
config.workspace = await createWorkingDir(config.useSystemTempDirectory)
}
// step 1: find files
const filenames = await getFileNames(config)
if (filenames.length === 0) {
console.log(chalk.magenta('no Markdown files found'))
return []
}
// step 2: read and parse files
const ASTs = await Promise.all(filenames.map(readAndParseFile))
// step 3: find link targets
const linkTargets = findLinkTargets(ASTs)
// step 4: extract activities
const activities = extractActivities(ASTs, config.classPrefix)
const links = extractImagesAndLinks(ASTs)
if (activities.length === 0 && links.length === 0) {
console.log(chalk.magenta('no activities found'))
return []
}
// step 5: execute the ActivityList
process.chdir(config.workspace)
const jobs = executeParallel(links, linkTargets, config, stats)
const results = (await Promise.all(jobs)).filter(r => r) as Error[]
// step 6: cleanup
process.chdir(config.sourceDir)
if (results.length === 0 && !config.keepTmp) {
rimraf.sync(config.workspace)
}
// step 7: write stats
let text = '\n'
let color
if (results.length === 0) {
color = chalk.green
text += chalk.green('Success! ')
} else {
color = chalk.red
text += chalk.red(`${results.length} errors, `)
}
text += color(
`${activities.length + links.length} activities in ${
filenames.length
} files`
)
if (stats.warnings() > 0) {
text += color(', ')
text += chalk.magenta(`${stats.warnings()} warnings`)
}
text += color(`, ${stats.duration()}`)
console.log(chalk.bold(text))
return results
}
示例8: logUpdate
.then((result: DownloadResults) => {
options.silent || logUpdate(`${chalk.magenta(result.format.data.videoTitle)} saved as
${chalk.green(result.path)} [${toHumanTime(result.duration / 1000)}]`);
process.exit(0);
}, err => {
示例9: run
export default async function run(reposToConvert: WorkspaceRepo[]) {
console.log(
chalk.dim('[1/5] ') + chalk.magenta(`Setting up push to GitHub...`));
const {commitMessage, branchName, forcePush} = (await inquirer.prompt([
{
type: 'input',
name: 'branchName',
message: 'push to branch:',
default: 'polymer-modulizer-auto-generated',
},
{
type: 'confirm',
name: 'forcePush',
message: (args) => {
return `force push? (WARNING: This will overwrite any existing "${
args.branchName}" branch on GitHub`;
},
default: false,
},
{
type: 'input',
name: 'commitMessage',
message: 'with commit message:',
default: `"auto-generated by polymer-modulizer"`,
}
]));
console.log(chalk.dim('[2/5] ') + chalk.magenta(`Preparing new branches...`));
await startNewBranch(reposToConvert, 'polymer-modulizer-staging');
console.log(chalk.dim('[3/5] ') + chalk.magenta(`Committing changes...`));
await commitChanges(reposToConvert, commitMessage);
console.log('');
console.log('Ready to push:');
for (const repo of reposToConvert) {
console.log(` - ${repo.github.fullName} ${
chalk.dim(repo.github.ref || repo.github.defaultBranch)} -> ${
chalk.cyan(branchName)}`);
}
console.log('');
const {confirmPush} = (await inquirer.prompt([{
type: 'confirm',
name: 'confirmPush',
message: 'start?',
default: true,
}]));
if (!confirmPush) {
return;
}
console.log(chalk.dim('[4/5] ') + chalk.magenta(`Pushing to GitHub...`));
const publishResults =
await pushChangesToGithub(reposToConvert, branchName, forcePush);
publishResults.successes.forEach((_result, repo) => {
console.log(` - ${chalk.cyan(repo.dir)}: success!`);
});
publishResults.failures.forEach(logRepoError);
console.log(chalk.dim('[5/5]') + ' 🎉 ' + chalk.magenta(`Push Complete!`));
}