本文整理汇总了TypeScript中gulp-util.colors.green方法的典型用法代码示例。如果您正苦于以下问题:TypeScript colors.green方法的具体用法?TypeScript colors.green怎么用?TypeScript colors.green使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gulp-util.colors
的用法示例。
在下文中一共展示了colors.green方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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 => {
示例2: 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')}`);
}
示例3: onStart
function onStart(): void {
if (count++ > 0) {
return;
}
startTime = new Date().getTime();
util.log(`Starting ${util.colors.green('compilation')}...`);
}
示例4: 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();
};
示例5:
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`));
}
}
});
示例6: function
}, function () {
if (log) {
if (entry.totalCount === 1) {
util.log(`Stats for '${util.colors.grey(entry.name)}': ${Math.round(entry.totalSize / 1204)}KB`);
} else {
const count = entry.totalCount < 100
? util.colors.green(entry.totalCount.toString())
: util.colors.red(entry.totalCount.toString());
util.log(`Stats for '${util.colors.grey(entry.name)}': ${count} files, ${Math.round(entry.totalSize / 1204)}KB`);
}
}
this.emit('end');
});
示例7: toString
toString(pretty?: boolean): string {
if (!pretty) {
if (this.totalCount === 1) {
return `${this.name}: ${this.totalSize} bytes`;
} else {
return `${this.name}: ${this.totalCount} files with ${this.totalSize} bytes`;
}
} else {
if (this.totalCount === 1) {
return `Stats for '${util.colors.grey(this.name)}': ${Math.round(this.totalSize / 1204)}KB`;
} else {
const count = this.totalCount < 100
? util.colors.green(this.totalCount.toString())
: util.colors.red(this.totalCount.toString());
return `Stats for '${util.colors.grey(this.name)}': ${count} files, ${Math.round(this.totalSize / 1204)}KB`;
}
}
}
示例8: readFile
readFile(bannerPath, (e, content) => {
if (!e) {
console.log(util.colors.green(content.toString()));
}
done();
});
示例9: log
function log(message: any, ...rest: any[]): void {
util.log(util.colors.green('[i18n]'), message, ...rest);
}
示例10: function
var gulpAmodro = function ( options: IOptions, amdOptions?: IAmdOptions ): NodeJS.ReadWriteStream {
gutil.log( gutil.colors.green( PLUGIN_NAME ) );
options = options || defaultOptions;
function bufferContents ( file, enc, cb ) {
// ignore empty files
if ( file.isNull() ) {
cb();
return;
}
// we dont do streams (yet)
if ( file.isStream() ) {
this.emit( 'error', new gutil.PluginError( PLUGIN_NAME, 'Streaming not supported' ) );
cb();
return;
}
var mainFile = path.parse( file.path );
var rootDir = path.relative( options.rootDir, mainFile.dir );
var self = this;
amodroTrace( {
// The root directory, usually the root of the web project, and what the
// AMD baseUrl is relative to. Should be an absolute path.
rootDir: rootDir,
id: mainFile.name,
includeContents: true,
writeTransform: writeTransform,
fileRead: ( defaultRead: DefaultFileRead, id: string, filePath: string ): string => {
if ( options.excludeFiles && options.excludeFiles.indexOf( id ) > -1 ) {
return '';
}
// performance, don't need to read again
if ( id === mainFile.name ) {
return file.contents.toString();
}
return defaultRead( id, filePath );
},
fileExists: ( defaultFileExists: DefaultFileExists, id: string, filePath: string ): boolean => {
if ( options.excludeFiles && options.excludeFiles.indexOf( id ) > -1 ) {
return false;
}
return defaultFileExists( id, filePath );
}
}, amdOptions || {}
).then( ( traceResult ) => {
if ( traceResult.errors && traceResult.errors.length ) {
// throw to Promise.Catch()
var errorMessage = traceResult.errors.map( function ( error ) {
return error.toString();
} ).join( '\n' );
throw new Error( errorMessage );
}
// map each part
return traceResult.traced.map( function ( result ) {
return new gutil.File( {
cwd: "",
base: "",
path: result.path,
contents: new Buffer( result.contents )
} );
} );
} ).then( files => {
files.forEach( f => {
self.push( f );
} );
cb();
} ).catch( error => {
self.emit( 'error', new gutil.PluginError( PLUGIN_NAME, error.toString() ) );
cb();
} );
}
return through.obj( bufferContents );
}