本文整理汇总了TypeScript中chalk.yellow函数的典型用法代码示例。如果您正苦于以下问题:TypeScript yellow函数的具体用法?TypeScript yellow怎么用?TypeScript yellow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yellow函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
run: function (commandOptions: LintCommandOptions) {
const ui = this.ui;
const projectRoot = this.project.root;
const lintConfigs: CliLintConfig[] = CliConfig.fromProject().config.lint || [];
if (lintConfigs.length === 0) {
ui.writeLine(chalk.yellow(oneLine`
No lint config(s) found.
If this is not intended, run "ng update".
`));
return Promise.resolve(0);
}
const tslint = requireProjectModule(projectRoot, 'tslint');
const Linter = tslint.Linter;
const Configuration = tslint.Configuration;
let errors = 0;
let results = '';
lintConfigs
.forEach((config) => {
const program: ts.Program = Linter.createProgram(config.project);
const files = getFilesToLint(program, config, Linter);
const linter = new Linter({
fix: commandOptions.fix,
formatter: commandOptions.format
}, program);
files.forEach((file) => {
const sourceFile = program.getSourceFile(file);
if (!sourceFile) {
return;
}
const fileContents = sourceFile.getFullText();
const configLoad = Configuration.findConfiguration(config.tslintConfig, file);
linter.lint(file, fileContents, configLoad.results);
});
const result = linter.getResult();
errors += result.failureCount;
results = results.concat(result.output.trim().concat('\n'));
});
// print formatter output directly for non human-readable formats
if (['prose', 'verbose', 'stylish'].indexOf(commandOptions.format) == -1) {
ui.writeLine(results.trim());
return (errors == 0 || commandOptions.force) ? Promise.resolve(0) : Promise.resolve(2);
}
if (errors > 0) {
ui.writeLine(results.trim());
ui.writeLine(chalk.red('Lint errors found in the listed files.'));
return commandOptions.force ? Promise.resolve(0) : Promise.resolve(2);
}
ui.writeLine(chalk.green('All files pass linting.'));
return Promise.resolve(0);
}
示例2: confirm
export async function confirm(question: string): Promise<boolean> {
const prettyQuestion = chalk.yellow(`${question} [y/N]? `)
const answer = await ask(prettyQuestion)
return /^[yY](es)?/.test(answer)
}
示例3:
schematicNames.forEach(schematicName => {
this.ui.writeLine(yellow(` ${schematicName}`));
});
示例4: del
del(DEV_DEST).then((paths) => {
util.log('Deleted', chalk.yellow(paths && paths.join(', ') || '-'));
done();
});
示例5: function
run: function (serveTaskOptions: ServeTaskOptions, rebuildDoneCb: any) {
const ui = this.ui;
let webpackCompiler: any;
const projectConfig = CliConfig.fromProject().config;
const appConfig = getAppFromConfig(serveTaskOptions.app);
const outputPath = serveTaskOptions.outputPath || appConfig.outDir;
if (this.project.root === path.resolve(outputPath)) {
throw new SilentError('Output path MUST not be project root directory!');
}
if (projectConfig.project && projectConfig.project.ejected) {
throw new SilentError('An ejected project cannot use the build command anymore.');
}
if (appConfig.platform === 'server') {
throw new SilentError('ng serve for platform server applications is coming soon!');
}
if (serveTaskOptions.deleteOutputPath) {
fs.removeSync(path.resolve(this.project.root, outputPath));
}
const serveDefaults = {
// default deployUrl to '' on serve to prevent the default from .angular-cli.json
deployUrl: ''
};
serveTaskOptions = Object.assign({}, serveDefaults, serveTaskOptions);
let webpackConfig = new NgCliWebpackConfig(serveTaskOptions, appConfig).buildConfig();
const serverAddress = url.format({
protocol: serveTaskOptions.ssl ? 'https' : 'http',
hostname: serveTaskOptions.host === '0.0.0.0' ? 'localhost' : serveTaskOptions.host,
port: serveTaskOptions.port.toString()
});
if (serveTaskOptions.disableHostCheck) {
ui.writeLine(oneLine`
${yellow('WARNING')} Running a server with --disable-host-check is a security risk.
See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a
for more information.
`);
}
let clientAddress = `${serveTaskOptions.ssl ? 'https' : 'http'}://0.0.0.0:0`;
if (serveTaskOptions.publicHost) {
let publicHost = serveTaskOptions.publicHost;
if (!/^\w+:\/\//.test(publicHost)) {
publicHost = `${serveTaskOptions.ssl ? 'https' : 'http'}://${publicHost}`;
}
const clientUrl = url.parse(publicHost);
serveTaskOptions.publicHost = clientUrl.host;
clientAddress = url.format(clientUrl);
}
if (serveTaskOptions.liveReload) {
// This allows for live reload of page when changes are made to repo.
// https://webpack.github.io/docs/webpack-dev-server.html#inline-mode
let entryPoints = [
`webpack-dev-server/client?${clientAddress}`
];
if (serveTaskOptions.hmr) {
const webpackHmrLink = 'https://webpack.github.io/docs/hot-module-replacement.html';
ui.writeLine(oneLine`
${yellow('NOTICE')} Hot Module Replacement (HMR) is enabled for the dev server.
`);
const showWarning = CliConfig.fromGlobal().get('warnings.hmrWarning');
if (showWarning) {
ui.writeLine(' The project will still live reload when HMR is enabled,');
ui.writeLine(' but to take advantage of HMR additional application code is required');
ui.writeLine(' (not included in an Angular CLI project by default).');
ui.writeLine(` See ${chalk.blue(webpackHmrLink)}`);
ui.writeLine(' for information on working with HMR for Webpack.');
ui.writeLine(oneLine`
${yellow('To disable this warning use "ng set --global warnings.hmrWarning=false"')}
`);
}
entryPoints.push('webpack/hot/dev-server');
webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
if (serveTaskOptions.extractCss) {
ui.writeLine(oneLine`
${yellow('NOTICE')} (HMR) does not allow for CSS hot reload when used
together with '--extract-css'.
`);
}
}
if (!webpackConfig.entry.main) { webpackConfig.entry.main = []; }
webpackConfig.entry.main.unshift(...entryPoints);
} else if (serveTaskOptions.hmr) {
ui.writeLine(yellow('Live reload is disabled. HMR option ignored.'));
}
if (!serveTaskOptions.watch) {
// There's no option to turn off file watching in webpack-dev-server, but
// we can override the file watcher instead.
webpackConfig.plugins.unshift({
apply: (compiler: any) => {
compiler.plugin('after-environment', () => {
//.........这里部分代码省略.........
示例6: displayError
function displayError(p: string, expected: any, actual: any) {
console.log(chalk.yellow(" ---------------------------------- error in encode_decode_round_trip_test"));
console.log(chalk.red(" key "), p);
console.log(chalk.red(" expected "), JSON.stringify(expected));
console.log(chalk.cyan(" actual "), JSON.stringify(actual));
}
示例7: async
task: async (context, task) => {
const [comic] = await devComic({sources: [source]});
task.title = `${chalk.yellow(source)}\t${chalk.green(comic.image)}`;
context[source] = comic.image;
}
示例8: start
async function start() {
let currentEdition = BotpressEditions[process.BOTPRESS_EDITION] + ' Edition'
if (process.BOTPRESS_EDITION === 'ce') {
currentEdition = chalk.cyan(currentEdition)
} else {
currentEdition = chalk.yellow(currentEdition)
}
const logger = await Logger('Launcher')
logger.info(chalk`========================================
{bold ${center(`Botpress Server - ${currentEdition}`, 40)}}
{dim ${center(`Version ${sdk.version}`, 40)}}
========================================`)
global.printErrorDefault = err => {
logger.attachError(err).error('Unhandled Rejection')
}
const modules: sdk.ModuleEntryPoint[] = []
const globalConfig = await Config.getBotpressConfig()
const loadingErrors: Error[] = []
let modulesLog = ''
const resolver = new ModuleResolver(logger)
for (const entry of globalConfig.modules) {
let originalRequirePaths: string[] = []
try {
if (!entry.enabled) {
modulesLog += os.EOL + `${chalk.dim('⊝')} ${entry.location} ${chalk.gray('(disabled)')}`
continue
}
const moduleLocation = await resolver.resolve(entry.location)
// We bump temporarily bump the module's node_modules in priority
// So that it loads the local versions of its own dependencies
originalRequirePaths = global.require.getPaths()
global.require.overwritePaths([
path.join(moduleLocation, 'node_production_modules'),
path.join(moduleLocation, 'node_modules'),
...originalRequirePaths
])
const req = require(moduleLocation)
global.require.overwritePaths(originalRequirePaths)
originalRequirePaths = []
const rawEntry = (req.default ? req.default : req) as sdk.ModuleEntryPoint
const entryPoint = ModuleLoader.processModuleEntryPoint(rawEntry, entry.location)
modules.push(entryPoint)
process.LOADED_MODULES[entryPoint.definition.name] = moduleLocation
modulesLog += os.EOL + `${chalk.greenBright('⦿')} ${entry.location}`
} catch (err) {
modulesLog += os.EOL + `${chalk.redBright('⊗')} ${entry.location} ${chalk.gray('(error)')}`
loadingErrors.push(new FatalError(err, `Fatal error loading module "${entry.location}"`))
} finally {
if (originalRequirePaths.length) {
global.require.overwritePaths(originalRequirePaths)
}
}
}
logger.info(`Using ${chalk.bold(modules.length.toString())} modules` + modulesLog)
for (const err of loadingErrors) {
logger.attachError(err).error('Error starting Botpress')
}
if (loadingErrors.length) {
process.exit(1)
}
await Botpress.start({ modules })
logger.info(`Botpress is ready at http://${process.HOST}:${process.PORT}/`)
}
示例9:
server.listen(port, this.configuration.host, () => {
logger.info(chalk.yellow(`Mozaïk server started on port ${port}`))
})
示例10:
db.on("disconnecting", () => {
console.info(chalk.yellow("Disconnected from MongoDB."));
})