本文整理汇总了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);
}
开发者ID:itslenny,项目名称:angular-cli,代码行数:61,代码来源:lint.ts
示例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)
}
开发者ID:elentok,项目名称:dotfiles,代码行数:5,代码来源:utils.ts
示例3:
schematicNames.forEach(schematicName => {
this.ui.writeLine(yellow(` ${schematicName}`));
});
开发者ID:dzonatan,项目名称:angular-cli,代码行数:3,代码来源:generate.ts
示例4: del
del(DEV_DEST).then((paths) => {
util.log('Deleted', chalk.yellow(paths && paths.join(', ') || '-'));
done();
});
开发者ID:Aelphy,项目名称:receipts,代码行数:4,代码来源:clean.ts
示例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', () => {
//.........这里部分代码省略.........
开发者ID:3L4CKD4RK,项目名称:angular-cli,代码行数:101,代码来源:serve.ts
示例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));
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:6,代码来源:encode_decode_round_trip_test.ts
示例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;
}
开发者ID:arnellebalane,项目名称:devcomic,代码行数:5,代码来源:cli.ts
示例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}/`)
}
开发者ID:seffalabdelaziz,项目名称:botpress,代码行数:79,代码来源:bootstrap.ts
示例9:
server.listen(port, this.configuration.host, () => {
logger.info(chalk.yellow(`Mozaïk server started on port ${port}`))
})
开发者ID:plouc,项目名称:mozaik,代码行数:3,代码来源:mozaik.ts
示例10:
db.on("disconnecting", () => {
console.info(chalk.yellow("Disconnected from MongoDB."));
})
开发者ID:cm0s,项目名称:mea2n,代码行数:3,代码来源:mongoose_conf.ts
注:本文中的chalk.yellow函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论