• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript gulp-util.colors类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中gulp-util.colors的典型用法代码示例。如果您正苦于以下问题:TypeScript colors类的具体用法?TypeScript colors怎么用?TypeScript colors使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了colors类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: flattenDiagnosticsVerbose

		error: (error: TypeScriptError) => {
			if (error.tsFile) {
				console.error('[' + gutil.colors.gray('gulp-typescript') + '] ' + gutil.colors.red(error.fullFilename + '(' + error.startPosition.line + ',' + error.startPosition.character + '): ') + 'error TS' + error.diagnostic.code + ' ' + flattenDiagnosticsVerbose(error.diagnostic.messageText));
			} else {
				console.error(error.message);
			}
		},
开发者ID:billwaddyjr,项目名称:gulp-typescript,代码行数:7,代码来源:reporter.ts


示例2: Buffer

		fileDownload.init().then((files) => {
			if (files === null) {
				gutil.log(gutil.colors.yellow("No files found on the specified startFolder path"));
			} else {
				gutil.log(gutil.colors.green("Retrieved all files from the folder."));

				// Start retrieving the file content
				let proms = [];
				files.forEach(file => {
					proms.push(fileDownload.download(file).then((uFile: IFileDownload) => {
						var vinylFile: any = new gutil.File({
							cwd: "",
							base: "",
							path: uFile.name,
							contents: ((uFile.content instanceof Buffer) ? uFile.content : new Buffer(uFile.content))
						});

						stream.write(vinylFile);
					}));
				});

				Promise.all(proms).then(data => {
					if (options.verbose) {
						gutil.log("And we're done...");
					}
					// End the file stream
					stream.end();
				});
			}
		}).catch(err => {
开发者ID:estruyf,项目名称:gulp-spsync-creds,代码行数:30,代码来源:index.ts


示例3: log

function log(): void {
	const errors = _.flatten(allErrors);
	const seen = new Set<string>();

	errors.map(err => {
		if (!seen.has(err)) {
			seen.add(err);
			util.log(`${util.colors.red('Error')}: ${err}`);
		}
	});

	const regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/;
	const messages = errors
		.map(err => regex.exec(err))
		.filter(match => !!match)
		.map(x => x as string[])
		.map(([, path, line, column, message]) => ({ path, line: parseInt(line), column: parseInt(column), message }));

	try {

		fs.writeFileSync(buildLogPath, JSON.stringify(messages));
	} catch (err) {
		//noop
	}

	util.log(`Finished ${util.colors.green('compilation')} with ${errors.length} errors after ${util.colors.magenta((new Date().getTime() - startTime!) + ' ms')}`);
}
开发者ID:DonJayamanne,项目名称:vscode,代码行数:27,代码来源:reporter.ts


示例4: 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();
        }
开发者ID:i-e-b,项目名称:gulp-npmworkspace,代码行数:28,代码来源:PostInstallTypings.ts


示例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")})`);
}
开发者ID:i-e-b,项目名称:gulp-npmworkspace,代码行数:32,代码来源:InstallPackages.ts


示例6:

		}).catch(err => {
			if (typeof err.message !== "undefined") {
				gutil.log(gutil.colors.red(`ERROR: ${err.message}`));
			} else {
				gutil.log(gutil.colors.red(`ERROR: ${JSON.stringify(err)}`));
			}
		});
开发者ID:estruyf,项目名称:gulp-spsync-creds,代码行数:7,代码来源:index.ts


示例7:

		error: (error: TypeScriptError, typescript: typeof ts) => {
			console.error('[' + gutil.colors.gray('gulp-typescript') + '] '
				+ gutil.colors.bgRed(error.diagnostic.code + '')
				+ ' ' + gutil.colors.red(flattenDiagnosticsVerbose(error.diagnostic.messageText))
			);

			if (error.tsFile) {
				console.error('> ' + gutil.colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + gutil.colors.gray(':'));
				const lines = error.tsFile.text.split(/(\r\n|\r|\n)/);

				const logLine = (lineIndex: number, errorStart: number, errorEnd?: number) => {
					const line = lines[lineIndex];
					if (errorEnd === undefined) errorEnd = line.length;
					console.error('> ' + gutil.colors.gray('[' + lineIndex + '] ')
						+ line.substring(0, errorStart)
						+ gutil.colors.red(line.substring(errorStart, errorEnd))
						+ line.substring(errorEnd)
					);
				}

				for (let i = error.startPosition.line; i <= error.endPosition.line; i++) {
					logLine(i,
						i === error.startPosition.line ? error.startPosition.character - 1 : 0,
						i === error.endPosition.line ? error.endPosition.character - 1 : undefined
					);
				}
			}
		},
开发者ID:billwaddyjr,项目名称:gulp-typescript,代码行数:28,代码来源:reporter.ts


示例8: 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);
        }
    });
开发者ID:i-e-b,项目名称:gulp-npmworkspace,代码行数:26,代码来源:UninstallPackages.ts


示例9:

				}).catch(error => {
					if (typeof error === "string") {
						gutil.log(gutil.colors.red(`ERROR: ${error}`));
					} else {
						gutil.log(gutil.colors.red('ERROR:'), JSON.stringify(error));
					}
					resolve(null);
				});
开发者ID:estruyf,项目名称:gulp-spsync-creds,代码行数:8,代码来源:fileSyncHelper.ts


示例10: done

export = (done: any) => {
  util.log(util.colors.yellow(`
    Warning!
    Please use ${util.colors.green('npm run build.prod')}
    Instead of ${util.colors.red('npm run build.prod.aot')} or ${util.colors.red('npm run build.prod.aot')}
    They will be deleted soon!`));

  done();
};
开发者ID:vyakymenko,项目名称:angular2-seed,代码行数:9,代码来源:deprecate.notification.ts



注:本文中的gulp-util.colors类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript gulp-watch.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript gulp-util.noop函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap