Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should log to console', () => {
const helper = new MigrationUtils(
EDirection.up,
null as any,
loggerMock as any,
);
// tslint:disable-next-line: no-string-literal
helper['loggerHelper'](loggerMock)('test');
expect(loggerMock.log).toBeCalledTimes(1);
expect(loggerMock.log).toBeCalledWith(
' '.repeat(8),
chalk.inverse(' LOGGER '),
'test',
);
});
});
lines[1].replace('Cannot resolve \'file\' or \'directory\' ', '').replace('Cannot resolve module ', '').replace('Error: ', '').replace('[CaseSensitivePathsPlugin] ', '')];
}
// Cleans up syntax error messages.
if (lines[1].indexOf('Module build failed: ') === 0) {
lines[1] = lines[1].replace('Module build failed: SyntaxError:', friendlySyntaxErrorLabel);
}
// Clean up export errors.
// TODO: we should really send a PR to Webpack for this.
var exportError = /\s*(.+?)\s*(")?export '(.+?)' was not found in '(.+?)'/;
if (lines[1].match(exportError)) {
lines[1] = lines[1].replace(exportError, '$1 \'$4\' does not contain an export named \'$3\'.');
}
lines[0] = chalk.inverse(lines[0]);
// Reassemble the message.
message = lines.join('\n');
// Internal stacks are generally useless so we strip them... with the
// exception of stacks containing `webpack:` because they're normally
// from user code generated by WebPack. For more information see
// https://github.com/facebookincubator/create-react-app/pull/1050
message = message.replace(/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, ''); // at ... ...:x:y
return message.trim();
}
function lintCompiledSource(source) {
let linter = new Linter();
let errors = linter.verify(source, lintConfig);
if (errors.length > 0) {
console.log(`\n${chalk.inverse(`=== Validation Failed ===`)}\n`);
for (let error of errors) {
console.log(`${chalk.red(error.message)} ${chalk.gray(`(${error.line}:${error.column})`)}`);
}
process.exit(1);
}
}
const listNotes = () => {
const notes = loadNotes()
console.log(chalk.inverse('Your notes'))
notes.forEach((note) => {
console.log(note.title)
})
}
export function helpMessage() {
_logoSuccessMessage();
console.log(chalk.green(' - - - - - - - - - how about a little help? - - - - - - - - - \n'));
console.log(' to add a new instance of css-burrito into your project, run: \n');
console.log(` ${chalk.inverse(' burrito -n [folder name] ')} or ${chalk.inverse(' burrito --new [folder name] ')}\n`);
console.log(' to create files in the modules directory,\n');
console.log(` and add them to the ${chalk.underline(config().moduleImportPath())} file, run: \n`);
console.log(` ${chalk.inverse(' burrito -m (module name[s]) ')} or ${chalk.inverse(' burrito --module (folder name[s]) ')}\n`);
console.log(' to list the files in the module directory, run:\n');
console.log(` ${chalk.inverse(' burrito -l ')} or ${chalk.inverse(' burrito --list ')}\n`);
console.log(' to delete files from the modules directory,\n');
console.log(` and remove them from the ${chalk.underline(config().moduleImportPath())} file, run: \n`);
console.log(` ${chalk.inverse(' burrito -r (module name[s]) ')} or ${chalk.inverse(' burrito --remove (folder name[s]) ')}\n`);
console.log(` want to override defaults with a ${chalk.underline('.cssburritorc')} file?\n`);
console.log(' check out the readme: https://github.com/jasonreece/css-burrito\n');
}
}).on('disconnected', function () {
console.log(chalk.inverse('DISCONNECTED'));
}).on('received', function (tokens) {
console.info('%s %s', chalk.cyan('<<< RECV <<<'), JSON.stringify(tokens));
setupInfo() {
const table = this.table,
advice = this.result.advice;
table.push([
{
colSpan: 3,
hAlign: 'center',
content: chalk.inverse('INFORMATION')
}
]);
Object.keys(advice.info).forEach(key => {
table.push([
key,
{
colSpan: 2,
content: getValue(advice.info[key])
}
]);
});
}
module.exports = function (path = '', local, theme) {
const msg =
'\n' +
chalk.green('Initialization succeeded!') +
' Please run ' +
chalk.inverse(`docsify serve ${path}`) +
'\n'
path = cwd(path || '.')
const target = file => resolve(path, file)
const readme = exists(cwd('README.md')) || pwd('template/README.md')
let main = pwd('template/index.html')
if (local) {
main = pwd('template/index.local.html')
const vendor =
exists(cwd('node_modules/docsify')) || pwd('../node_modules/docsify')
cp(resolve(vendor, 'lib/docsify.min.js'), target('vendor/docsify.js'))
cp(
resolve(vendor, `lib/themes/${theme}.css`),
function renderBanner(label) {
let str = '';
str += chalk.inverse(` ${label} ${' '.repeat(35 - label.length - 1)}`);
str += '\n';
str += chalk.dim(symbols.hr.repeat(35));
str += '\n';
return str;
}
const getTime = () => {
return chalk.inverse(new Date().toLocaleTimeString());
};