Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exec(command, (error, stdout, stderr) => {
if(stdout) {
console.log(color.yellow('stdout: ' + stdout));
}
if(stderr) {
return reject('stderr: ' + stderr)
}
if(error !== null) {
return reject('exec error: ' + stderr)
}
resolve(`Extension builded in '${options.release}'`)
})
// Long enought to prevent some unexpected errors
// Error Line/Position
errors.push(colors.yellow(error.message[0].line.toString()) + ',');
errors.push(colors.cyan(error.message[0].start.toString()) + ',');
errors.push(colors.cyan(error.message[0].end.toString()) + ': ');
// Error Message - Split so we can color multiple lines
descr = error.message[0].descr.split('\n');
descr.forEach(function(item) {
errors.push(colors.red(item) + '\n');
});
// Some messages have a second line notifying where the error is
if (error.message.length === 2) {
errors.push(' ' + colors.green(path || error.message[1].path) + ':');
errors.push(colors.yellow(error.message[1].line.toString()) + ',');
errors.push(colors.cyan(error.message[1].start.toString()) + ',');
errors.push(colors.cyan(error.message[1].end.toString()) + ': ');
errors.push(colors.green(error.message[1].descr) + '\n');
}
errors.push('\n');
});
}
}
if (needInstall) {
try {
await install(coreName, coreVersion, {
root: config.coreRoot,
trash: config.trash,
force: argv.force || argv.f,
registry: config.registry,
ENVS: config.ENVS,
});
} catch (error) {
if (error.stack.indexOf('module is locked') >= 0) {
console.error(colors.red('\nThe module is locked, please check if there has another installing process.'))
console.log(`Or you can run the command with ${colors.yellow('`-f`')} or ${colors.yellow('`--force`')} option to skip it.`)
process.exit(0)
}
}
const packageJson = await fse.readJson(path.join(config.coreRoot, 'node_modules', coreName, 'package.json'))
let userConfigs = {}
if (typeof config.telemetry === 'undefined') {
userConfigs = await initGlobalConfig()
}
coreConfigurations = Object.assign({
version: packageJson.version,
name: packageJson.name,
is_next: true,
next_version: '',
local: path.join(config.coreRoot, 'node_modules', coreName),
last_update_time: (new Date()).getTime(),
update_time: 7
{
const title = `${options.title.toUpperCase()}`
if (options.notify) {
notifier.notify({
title,
message: options.message
})
}
const level = options.level || "info"
const message = `==> ${title} -> ${options.message}`
switch (level) {
case "warn":
console.log(colors.yellow(message))
break
case "error":
console.log(colors.bgRed.white(message))
break
case "info":
default:
console.log(colors.green(message))
}
}
log(msg, token) {
const time = colors.blue(moment().format('HH:mm:ss.SSS'));
const addr = colors.gray(this.remoteAddress + ':' + this.remotePort);
const tokenStr = token ? colors.yellow(`tkn=${token} `) : '';
console.log(`${time} ${addr} ${tokenStr}${msg}`);
}
function logQuery(start, end, query, params) {
console.log(
`--- DB-query ${end.getTime() - start.getTime()}ms
${colors.blue(reformatQuery(query))}
${colors.yellow(JSON.stringify(params) || "")}`
);
}
function buildCSS() {
if (_currBuild) return _currBuild;
const START = '🏗 ' + colors.yellow('Building css...');
const END = '👍 ' + colors.green('css built');
console.log('');
console.log(START);
console.time(END);
return _currBuild =
Promise.resolve()
.then(() => doGlob('css/**/*.css'))
.then((files) => doConcat(files, 'dist/iD.css'))
.then(() => {
console.timeEnd(END);
console.log('');
_currBuild = null;
})
.catch((err) => {
function run() {
const inputFilePaths = glob.sync(path.join(PACKAGES_DIR_ABSOLUTE, '**/*.ts'), {
ignore: ['**/node_modules/**', '**/dist/**', '**/*.d.ts', '**/test/*.ts'],
nodir: true,
});
const mdcLinterAnsi = colors.bold(colors.yellow('MDC Linter'));
console.log(`\n${mdcLinterAnsi}: Checking ${inputFilePaths.length.toLocaleString()} TypeScript files...\n`);
lintAllFiles(inputFilePaths);
const plural = violationCount === 1 ? '' : 's';
const violationCountBold = colors.bold(violationCount.toLocaleString());
const violationCountColor = violationCount > 0 ? colors.red(violationCountBold) : colors.green(violationCountBold);
console.log(`${mdcLinterAnsi}: Found ${violationCountColor} error${plural}\n`);
}
logger.write(shellPrefix, input, function(x) { return colors.yellow(x); });
entry => colors.yellow(entry)
),