本文整理汇总了TypeScript中gulp-util.colors.cyan方法的典型用法代码示例。如果您正苦于以下问题:TypeScript colors.cyan方法的具体用法?TypeScript colors.cyan怎么用?TypeScript colors.cyan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gulp-util.colors
的用法示例。
在下文中一共展示了colors.cyan方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
action: function (packageDescriptor: PackageDescriptor, packagePath: string, callback: (error?: Error) => void): void {
let packageTypingsFilePath = path.join(packagePath, "typings.json");
let packageTypingsPath = path.join(packagePath, targetPath);
if (!fs.existsSync(packageTypingsPath)) {
fs.mkdirSync(packageTypingsPath);
}
else {
rimraf.sync(packageTypingsPath + "/**/*");
}
Logger.verbose(`Linking typings for workspace package '${util.colors.cyan(packageDescriptor.name)}'`);
let typingFilePaths = getTypingFileReferences(require(packageTypingsFilePath));
for (let typingFilePathEntry in typingFilePaths) {
let typingFilePath = path.resolve(packagePath, typingFilePaths[typingFilePathEntry]);
let targetTypingFilePath = path.join(packageTypingsPath, typingFilePathEntry);
fs.mkdirSync(targetTypingFilePath);
fs.symlinkSync(typingFilePath, path.join(targetTypingFilePath, `${typingFilePathEntry}.d.ts`));
Logger.verbose(`Linked typing '${util.colors.cyan(typingFilePathEntry)}' (-> '${util.colors.blue(typingFilePath)}')`);
}
callback();
}
示例2: logEndSubtask
export function logEndSubtask(taskName: string, duration: number, errorMessage?: string) {
let durationString = (duration < 1000) ? (duration + ' ms') : ((Math.round(duration / 10) / 100) + ' s');
if (taskName) {
if (!errorMessage) {
log(`Finished subtask '${ gutil.colors.cyan(taskName)}' after ${ gutil.colors.magenta( durationString )}`);
} else {
log(`[${ gutil.colors.cyan(taskName)}] ${gutil.colors.red('error')} ${ errorMessage }`);
}
}
}
示例3: webpack
webpack(webpackConfig, (err, stats) => {
if (err) {
throw new gutil.PluginError('webpack', err)
}
watch ? null : gutil.log(gutil.colors.cyan('[webpack]', stats.toString()))
callback ? callback(resolve) : resolve()
})
示例4: on_end
function on_end() {
if (error !== undefined) {
gulp_util.log(
`Building '${gulp_util.colors.cyan(
output_relative_filename,
)}' failed\n\n${error.stack}`,
);
} else {
gulp_util.log(
`Building '${gulp_util.colors.cyan(
output_relative_filename,
)}' complete`,
);
}
gulp_util.log('Watching for file changes.');
}
示例5: linkExternalPackage
/**
* Creates a symbolic link between a package and a mapped path where the mapped path is external to the workspace.
*/
function linkExternalPackage(pluginBinding: NpmPluginBinding<NpmInstallOptions & NpmWorkspacePluginOptions>, packageName: string, packagePath: string, mappedPath: string) {
if (pluginBinding.options.registryMap[packageName]) {
Logger.warn(util.colors.yellow(`Package '${packageName}' has an entry in options.registryMap. Ignoring.`));
}
if (!path.isAbsolute(mappedPath)) {
mappedPath = path.normalize(path.join(pluginBinding.options.cwd, mappedPath));
}
if (mappedPath.indexOf(pluginBinding.options.cwd) >= 0) {
Logger.warn(util.colors.yellow(`externalWorkspacePackageMap['${packageName}'] is linking to a path inside the current workspace. Ignoring, but it should be removed.`));
}
let packageDescriptorPath = path.join(mappedPath, "package.json");
if (!fs.existsSync(packageDescriptorPath)) {
throw new Error(`externalWorkspacePackageMap['${packageName}'] is linking to a path that is not a packge. No 'package.json' could be found at '${mappedPath}'.`);
}
let packageDescriptor: PackageDescriptor = require(packageDescriptorPath);
if (packageDescriptor.name !== packageName) {
throw new Error(`externalWorkspacePackageMap['${packageName}'] is linking to a package that is named differently ('${packageDescriptor.name}').`);
}
pluginBinding.createPackageSymLink(packagePath, packageName, mappedPath);
Logger.verbose(`Linked '${util.colors.cyan(packageName)}' (-> '${util.colors.blue(mappedPath)}') - (${util.colors.bold("external")})`);
}
示例6: executeAsynchronousActions
return new Promise<void>((resolve, reject) => {
Logger.info(util.colors.bold(`Uninstalling workspace package '${util.colors.cyan(packageDescriptor.name)}'`));
try {
rimraf.sync(path.resolve(packagePath, "node_modules"));
let postUninstallActions: ConditionableAction<AsyncAction>[]
= _.union(pluginBinding.options.postUninstallActions, file["getWorkspace"]()["postUninstall"]);
if (postUninstallActions) {
Logger.verbose(`Running post-uninstall actions for workspace package '${util.colors.cyan(packageDescriptor.name)}'`);
executeAsynchronousActions(postUninstallActions, packageDescriptor, packagePath)
.then(resolve)
.catch((error) => {
handleError(error, packageDescriptor.name, pluginBinding.options.continueOnError, reject);
});
}
else {
resolve();
}
}
catch (error) {
handleError(error, packageDescriptor.name, pluginBinding.options.continueOnError, reject);
}
});
示例7: linkWorkspacePackage
/**
* Creates a symbolic link between a package and a mapped path where the mapped path is internal to the workspace.
*/
function linkWorkspacePackage(pluginBinding: NpmPluginBinding<NpmInstallOptions & NpmWorkspacePluginOptions>, packageName: string, packagePath: string, mappedPath: string) {
if (pluginBinding.options.registryMap[packageName]) {
Logger.warn(util.colors.yellow(`Workspace package '${packageName}' has an entry in options.registryMap. Using workspace package.`));
}
pluginBinding.createPackageSymLink(packagePath, packageName, mappedPath);
Logger.verbose(`Linked '${util.colors.cyan(packageName)}' (-> '${util.colors.blue(mappedPath)}')`);
}
示例8:
const reporter = es.map((file, cb) => {
if (event !== undefined) {
const failures = JSON.parse(file.tslint.output);
if (failures.length === 0) {
const prefix = `[${gutil.colors.cyan('gulp-tslint')}]`;
const fileName = path.basename(event.path);
gutil.log(prefix, gutil.colors.green(`${fileName} doesn't have errors`));
}
}
});
示例9: switch
gulp.watch(glob_templates, event => {
const input_relative_filename = path.relative(process.cwd(), event.path);
gulp_util.log(
`Detected '${gulp_util.colors.cyan(input_relative_filename)}' ${
event.type
}`,
);
const output_relative_filename = input_relative_filename
.replace(input_relative_dirname, output_relative_sub_dirname)
.replace(/(\.[a-z])?\.ts$/, '.d.ts');
switch (event.type) {
case 'changed':
generate_files(input_relative_filename, on_error, on_end);
generate_es_files(input_relative_filename, on_error, on_end);
break;
case 'added':
case 'deleted':
case 'renamed':
generate_index();
generate_files(input_relative_filename, on_error, on_end);
generate_es_files(input_relative_filename, on_error, on_end);
break;
default:
throw new Error(`Unexpected event type '${event.type}'`);
}
let error: Error | undefined;
function on_error(this: NodeJS.ReadWriteStream, e: Error) {
error = e;
// tslint:disable-next-line:no-invalid-this
this.end();
}
function on_end() {
if (error !== undefined) {
gulp_util.log(
`Building '${gulp_util.colors.cyan(
output_relative_filename,
)}' failed\n\n${error.stack}`,
);
} else {
gulp_util.log(
`Building '${gulp_util.colors.cyan(
output_relative_filename,
)}' complete`,
);
}
gulp_util.log('Watching for file changes.');
}
});
示例10: defaultFinishHandler
function defaultFinishHandler(results: CompilationResult) {
let hasError = false;
const showErrorCount = (count: number, type: string) => {
if (count === 0) return;
gutil.log('TypeScript:', gutil.colors.magenta(count.toString()), type + ' ' + (count === 1 ? 'error' : 'errors'));
hasError = true;
};
showErrorCount(results.syntaxErrors, 'syntax');
showErrorCount(results.globalErrors, 'global');
showErrorCount(results.semanticErrors, 'semantic');
showErrorCount(results.emitErrors, 'emit');
if (results.emitSkipped) {
gutil.log('TypeScript: emit', gutil.colors.red('failed'));
} else if (hasError) {
gutil.log('TypeScript: emit', gutil.colors.cyan('succeeded'), '(with errors)');
}
}