Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error: (error: TypeScriptError, typescript: typeof ts) => {
console.log('[' + colors.gray('gulp-typescript') + '] '
+ colors.bgRed(error.diagnostic.code + '')
+ ' ' + colors.red(typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n'))
);
if (error.tsFile) {
console.log('> ' + colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + 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.log('> ' + colors.gray('[' + (lineIndex + 1) + '] ')
+ line.substring(0, errorStart)
+ 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 : 0,
i === error.endPosition.line ? error.endPosition.character : undefined
comments.forEach(function(comment) {
const isTodo = /todo/i.test(comment.tag);
const commentType = isTodo ? colors.cyan(comment.tag) : colors.magenta(comment.tag);
const commentLocation = '@' + colors.gray(comment.file + ':' + comment.line);
fancyLog(commentType, comment.text, commentLocation);
});
}
function outputStyle(str) {
if (str) {
return chalk.gray(" → ") + chalk.underline.bold.gray(str);
}
return '';
}
${colors.gray('default')} Development environment. Working with row src files and file watcher, default:
${colors.gray('')} ${colors.gray('--jsUglify=false --jsSourcemaps=false --cssSourcemaps=false --jsGzip=false --cssGzip=false --jsBrotli=false --cssBrotli=false')}
${colors.gray('production')} Production build. Concat and uglify static resources, default:
${colors.gray('')} ${colors.gray('--jsUglify=true --jsSourcemaps=true --cssSourcemaps=true --jsGzip=true --cssGzip=true --jsBrotli=true --cssBrotli=true')}
${colors.cyan('options:')}
${colors.gray('--tag')} Set build version. ${colors.gray('default: --tag="v1.2.4" -> dest path: public/js/v1.2.4')}
${colors.gray('--jsUglify')} Set js uglification. ${colors.gray('(true || false)')}
${colors.gray('--jsSourcemaps')} Set js sourcemaps generation. ${colors.gray('(true || false)')}
${colors.gray('--jsGzip')} Set js "gzip" compression mode. ${colors.gray('(true || false)')}
${colors.gray('--jsBrotli')} Set js "brotli" compression mode. ${colors.gray('(true || false)')}
${colors.gray('--cssSourcemaps')} Set CSS sourcemaps generation. ${colors.gray('(true || false)')}
${colors.gray('--cssGzip')} Set CSS "gzip" compression mode. ${colors.gray('(true || false)')}
${colors.gray('--cssBrotli')} Set CSS "brotli" compression mode. ${colors.gray('(true || false)')}
${colors.gray('--debug')} Set debug mode (more output). ${colors.gray('(true || false)')}
`);
log(colors.cyan('='.repeat(cliBoxLength)));
log('');
};
getter(log, 'timestamp', () => {
return '[' + colors.gray(timestamp('HH:mm:ss')) + ']';
});
let printHelp = () => {
let cliLineLength = (cliBoxLength - 7);
log('');
log(colors.cyan( '= HELP ' + '='.repeat(cliLineLength)));
log(`
${colors.cyan('documentation:')} ${colors.gray('https://github.com/exodus4d/pathfinder/wiki/GulpJs')}
${colors.cyan('usage:')} ${colors.gray('$ npm run gulp [task] -- [--options] ...')}
${colors.cyan('tasks:')}
${colors.gray('help')} This view
${colors.gray('default')} Development environment. Working with row src files and file watcher, default:
${colors.gray('')} ${colors.gray('--jsUglify=false --jsSourcemaps=false --cssSourcemaps=false --jsGzip=false --cssGzip=false --jsBrotli=false --cssBrotli=false')}
${colors.gray('production')} Production build. Concat and uglify static resources, default:
${colors.gray('')} ${colors.gray('--jsUglify=true --jsSourcemaps=true --cssSourcemaps=true --jsGzip=true --cssGzip=true --jsBrotli=true --cssBrotli=true')}
${colors.cyan('options:')}
${colors.gray('--tag')} Set build version. ${colors.gray('default: --tag="v1.2.4" -> dest path: public/js/v1.2.4')}
${colors.gray('--jsUglify')} Set js uglification. ${colors.gray('(true || false)')}
${colors.gray('--jsSourcemaps')} Set js sourcemaps generation. ${colors.gray('(true || false)')}
${colors.gray('--jsGzip')} Set js "gzip" compression mode. ${colors.gray('(true || false)')}
${colors.gray('--jsBrotli')} Set js "brotli" compression mode. ${colors.gray('(true || false)')}
let printError = (title, example) => {
let cliLineLength = (cliBoxLength - 8);
log('');
log(colors.red( '= ERROR ' + '=' . repeat(cliLineLength)));
log(colors.red(title));
if(example){
log(`
${colors.gray(example)}
`);
}
log(colors.red('='.repeat(cliBoxLength)));
log('');
};
function log(sym, what, size, duration, highlightSize) {
let title = opts.title;
title = title ? titleColor(title) : '';
if (opts.sub) {
sym += chalk.cyanBright(` <${chalk.bold.underline(opts.sub)}>`);
}
size = opts.pretty ? prettyBytes(size) : (size + ' B');
duration = duration ? chalk.gray("[" + prettyTime(duration) + "]") : '';
fancyLog(title , sym , what, chalk.gray('(') + chalk[highlightSize ? 'magentaBright' : 'gray'](size) + chalk.gray(')') + duration);
}
render() {
this.pointer = () => '';
this.hint = this.typed || colors.gray(this.selected && this.selected.value || '');
super.render();
}