Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const pattern = /^\.intl\/?\s*$/gm;
if (!(await inGitIgnore(pattern))) {
const ignore = '.intl/';
const header = '# Intl generated schemas (https://intljs.com/docs/schemas)';
await addToGitIgnore(header, ignore);
};
}
const { language, phrase } = greeting();
const time = printDuration(Date.now() - startTime);
console.log(`\n ${bold(phrase)} ${dim(`(that's "Hello world!" in ${italic(language)})`)}
${green('✔')} Project initialized ${dim(time)}
${dim('Next steps:')}
${dim(terminalPrompt())} ${green('intl add ')}
${dim(terminalPrompt())} ${green(`cd ${srcDir}`)}
`)
}
protected printEnabledParsers(): void {
this.out(cyan('Enabled parsers:'));
if (this.parsers.length) {
this.out(cyan(dim(this.parsers.map(parser => `- ${parser.constructor.name}`).join('\n'))));
} else {
this.out(cyan(dim('(none)')));
}
this.out();
}
protected printEnabledPostProcessors(): void {
this.out(cyan('Enabled post processors:'));
if (this.postProcessors.length) {
this.out(cyan(dim(this.postProcessors.map(postProcessor => `- ${postProcessor.constructor.name}`).join('\n'))));
} else {
this.out(cyan(dim('(none)')));
}
this.out();
}
protected printEnabledCompiler(): void {
this.out(cyan('Compiler:'));
this.out(cyan(dim(`- ${this.compiler.constructor.name}`)));
this.out();
}
}
let header = '';
if (d.header && d.header !== 'Build Error') {
header += d.header;
}
if (d.relFilePath) {
if (header.length > 0) {
header += ': ';
}
header += color.cyan(d.relFilePath);
if (typeof d.lineNumber === 'number' && d.lineNumber > -1) {
header += color.dim(`:`);
header += color.yellow(`${d.lineNumber}`);
if (typeof d.columnNumber === 'number' && d.columnNumber > -1) {
header += color.dim(`:`);
header += color.yellow(`${d.columnNumber}`);
}
}
}
if (header.length > 0) {
outputLines.unshift(INDENT + header);
}
outputLines.push('');
if (d.lines && d.lines.length) {
protected printEnabledPostProcessors(): void {
this.out(cyan('Enabled post processors:'));
if (this.postProcessors.length) {
this.out(cyan(dim(this.postProcessors.map(postProcessor => `- ${postProcessor.constructor.name}`).join('\n'))));
} else {
this.out(cyan(dim('(none)')));
}
this.out();
}
this.readDir(dir, this.options.patterns).forEach(filePath => {
this.out(dim('- %s'), filePath);
const contents: string = fs.readFileSync(filePath, 'utf-8');
this.parsers.forEach(parser => {
const extracted = parser.extract(contents, filePath);
if (extracted instanceof TranslationCollection) {
collection = collection.union(extracted);
}
});
});
});
lines.forEach((l) => {
if (!isMeaningfulLine(l.text)) {
return;
}
let msg = `L${l.lineNumber}: `;
while (msg.length < INDENT.length) {
msg = ' ' + msg;
}
let text = l.text as string;
if (l.errorCharStart > -1) {
text = highlightError(text, l.errorCharStart, l.errorLength as number);
}
msg = color.dim(msg);
msg += text;
outputLines.push(msg);
});
fileMoveAction(from, to) {
if (this.options.logLevel < 3) {
return
}
this.info(
`${colors.blue('Moved')} ${colors.green(
path.relative(process.cwd(), from)
)} ${colors.dim('->')} ${colors.green(path.relative(process.cwd(), to))}`
)
}
}