Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const server = app.listen(3200, () => {
const { port } = server.address();
console.info(`${color.green('Listened at port: ')}${color.cyan(port)}`);
});
server.listen(8000, 'localhost', () => {
console.log(' Server: ' + c.green('http://localhost:8000'))
if (isEditor) {
console.log('URL structure: ' + c.cyan(
'http://localhost:8000/project/translate/' + c.bold('{project}') +
'/v/' + c.bold('{version}') + '/' + c.bold('{path/and/docId}') +
'?lang=' + c.bold('{locale}')))
} else {
console.log(' Valid paths: ' + c.cyan([
'/explore',
'/glossary',
'/glossary/project/' + c.bold('{projectSlug}'),
'/languages',
'/profile/view/' + c.bold('{username}')].join('\n ')))
}
console.log('REST requests: ' + c.blue(
'http://localhost:8080/rest (you need to run zanata server)'))
console.log(c.magenta('Watch browser console for actions and errors.'))
console.log(c.red('If you see errors, please fix them before you commit.'))
console.log(c.yellow(
/**
* Logme - Minimalistic logging.
*
* Author: Veselin Todorov
* Licensed under the MIT License.
*/
var color = require('cli-color');
/**
* Exposing the theme.
*/
module.exports = {
debug: color.magenta('- DEBUG -') + ' :message',
info: color.cyan('- INFO -') + ' :message',
warning: color.yellow('- WARNING -') + ' :message',
error: color.red('- ERROR -') + ' :message',
critical: color.red.bold('- CRITICAL -') + ' :message'
};
function findLocalIP() {
var addrs = require('os').networkInterfaces().en0;
if (! addrs) {
logMsg('cluster', color.red('could not determine local IP, defaulting to 127.0.0.1'));
localIP = '127.0.0.1';
} else {
for (var i = 0; i < addrs.length; i++) {
if (addrs[i].family === 'IPv4') {
localIP = addrs[i].address;
logMsg('cluster', color.cyan('using ') + color.green(localIP) + color.cyan(' to listen'));
return;
}
}
}
logMsg('cluster', color.red('could not find local IP with IPv4 address, defaulting to 127.0.0.1'));
localIP = '127.0.0.1';
}
this.drawScoreboard = function(stats) {
write(' ' + clc.yellow(stats.total) + '\n');
write(' ' + clc.green(stats.success) + '\n');
write(' ' + clc.red(stats.failed) + '\n');
write(' ' + clc.cyan(stats.skipped) + '\n');
this.fillWithNewlines(5);
this.cursorUp(this.numberOfLines);
};
all_languages.forEach(lang => {
process.stdout.write(color.cyan(' -'));
process.stdout.write(` ${lang}.js ${'.'.repeat(15 - lang.length)}`);
Object.keys(map).forEach(app => {
const js_path = path.join(common.root_path, `${target_path}${app !== 'app' ? `${app}/` : ''}${lang}.js`);
const content = `const texts_json = {};\ntexts_json['${lang.toUpperCase()}'] = ${JSON.stringify(map[app][lang])};`;
fs.writeFileSync(js_path, content, 'utf8');
});
process.stdout.write(common.messageEnd());
});
};
function startGossip() {
var completed = [];
logMsg('cluster', color.cyan('starting gossip on all nodes'));
hostsUp().forEach(function (host, pos, list) {
var start = Date.now();
send(host, '/admin/gossip', function onSend() {
var durMs = Date.now() - start;
completed.push(durMs);
if (completed.length === list.length) {
logMsg('cluster', color.cyan('gossip all completed: ') + color.green(completed.join(', ')));
}
});
});
}
var fs = require('fs');
var clc = require('cli-color');
var optimist = require('optimist');
var pkg = require('../package.json');
var api = require('../index');
var doc = [
pkg.description,,
'Usage:',,
' ' + clc.cyan('unity-asset-store-api') + ' [options]',,
'Options:',,
' ' + clc.magenta('-h --help') + ' Show this.',
' ' + clc.magenta('-o , --output ') + ' Write output to file.',
' ' + clc.magenta('-v --version') + ' Show version number.',,
].join('\n');
if (process.argv.length < 3) {
writeDocToStdout();
} else {
var argv = optimist.argv;
if (argv.h || argv.help) {
writeDocToStdout();
} else if (argv.v || argv.version) {
function findLocalIP() {
var addrs = require('os').networkInterfaces().en0;
if (! addrs) {
logMsg('cluster', color.red('could not determine local IP, defaulting to 127.0.0.1'));
localIP = '127.0.0.1';
} else {
for (var i = 0; i < addrs.length; i++) {
if (addrs[i].family === 'IPv4') {
localIP = addrs[i].address;
logMsg('cluster', color.cyan('using ') + color.green(localIP) + color.cyan(' to listen'));
return;
}
}
}
logMsg('cluster', color.red('could not find local IP with IPv4 address, defaulting to 127.0.0.1'));
localIP = '127.0.0.1';
}