Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var _loop_1 = function (dependency) {
var dependencyString = chalk.bold(dependency);
// Check if types are already installed
if (alreadyInstalledTypes.includes('@types/' + dependency)) {
console.log(chalk.yellow(figures.play, "Types for " + dependencyString + " already installed. Skipping..."));
return "continue";
}
// Check for included types
var pkgPath = path.join(cwd, 'node_modules', dependency, 'package.json');
if (fs.existsSync(pkgPath)) {
var pkg_1 = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
if (pkg_1.types || pkg_1.typings) {
console.log(chalk.yellow(figures.warning, "Module " + dependencyString + " includes own types. Skipping..."));
return "continue";
}
}
// Check if types are available
(function (dependency) {
request('https://www.npmjs.com/package/@types/' + dependency, function (err, res, body) {
if (res.statusCode == 200) {
child_process_1.exec(tool.command + " @types/" + dependency, function (err, stdout, stderr) {
const webapi = require('./webapi')
const approveDomains = require('./lets-encrypt').approveDomains
const vhostMethods = {
dat: require('./vhosts/dat'),
proxy: require('./vhosts/proxy'),
redirect: require('./vhosts/redirect')
}
const packageJson = require('../package.json')
// constants
// =
const IS_DEBUG = (['debug', 'staging', 'test'].indexOf(process.env.NODE_ENV) !== -1)
const ENABLED = chalk.green(figures.tick + ' enabled')
const DISABLED = chalk.red(figures.cross + ' disabled')
const BULLET = chalk.dim(figures.play)
// globals
// =
var app
var activeRouter
var metricsServer
// exported api
// =
exports.start = function (config, cb) {
var server
var plainServer
// ensure the data dirs exist
exports.migrateAsNeeded = async function (cloud, dataPath) {
var dbPath = path.join(dataPath, 'db')
if (fs.existsSync(dbPath)) {
console.log('')
console.log(figures.star, 'A database migration is required!')
console.log(figures.heart, 'Don\'t worry, this will be easy.')
var sqlFilePath = path.join(dataPath, 'legacy-leveldb-to-sqlite-dump.sql')
var archivedDbPath = path.join(dataPath, 'legacy-leveldb')
var newDbPath = path.join(dataPath, 'main.db')
await generateMigrationDump(dbPath, sqlFilePath)
await generateSqliteDb(cloud)
console.log(figures.info, 'SQL File:', sqlFilePath)
console.log(figures.info, 'The old database will be archived at', archivedDbPath)
console.log(figures.info, 'The new database is at', newDbPath)
if (!(await ask(figures.play + ' Are you ready to run the migration? (Y/n)', 'y'))) {
console.log('Okay.')
console.log('We need to run this migration to start, so Hashbase is now going to close.')
console.log(figures.pointerSmall, 'Shutting down.')
process.exit(0)
}
archiveOldDb(dbPath, archivedDbPath)
console.log(figures.star, 'A database migration complete!')
console.log('')
}
}
var runValidator = function(rootUrl){
crawledUrls.push(rootUrl);
totalLinkschecked++;
urlQueue.splice(0,1);
var urlinfo = url.parse(rootUrl);
var _link = urlinfo.href;
var _base = path.basename(urlinfo.pathname);
console.log('\n');
console.log(chalk.rgb(0,200,200).bold(chalk.yellow(figures.play) +' '+ chalk.underline(_link)) + '\n');
console.log('BASE\t' + (_base=='' ? '/' : _base));
var startTime = new Date().getTime();
request(rootUrl, function (error, response, body) {
var runtime = ((new Date().getTime() - startTime) / 1000).toFixed(2);
if(!error) {
if(response.statusCode == 200){
console.log('STATUS\t' + chalk.green('200 OK'));
}
else {
console.log('STATUS\t' + chalk.rgb(200,0,0)(response.statusCode + ' ' + http.STATUS_CODES[response.statusCode]));
totalDeadLinks++;
}
console.log('ELAPSED\t' + runtime + ' secs');
mutations.map(mutation => console.log(chalk.grey(` ${figures.play} ${mutation}`)));
return console.log();
import figures from 'figures';
const options = {
types: {
verbose: {
badge: figures.info,
label: 'verbose',
color: 'gray',
},
axon: {
badge: figures.star,
label: 'axon',
color: 'magenta',
},
init: {
badge: figures.play,
label: 'init',
color: 'green',
},
moduleS: {
badge: 'M',
label: 'module',
color: 'blue',
},
commandS: {
badge: 'C',
label: 'command',
color: 'cyan',
},
subcmdS: {
badge: 'c',
label: 'subcmd',
.then(() => {
if (progress) {
const {size, pending} = queue
const packageName = basename(cwd).grey
logUpdate(
`${figures.play} ${packageName}: ${size + pending} of ${
scopes.length
} packages installed`
)
}
})
.catch(err => {
logLevel: 'info'
},
pending: {
badge: figures.checkboxOff,
color: 'magenta',
label: 'pending',
logLevel: 'info'
},
note: {
badge: figures.bullet,
color: 'blue',
label: 'note',
logLevel: 'info'
},
start: {
badge: figures.play,
color: 'green',
label: 'start',
logLevel: 'info'
},
pause: {
badge: figures.squareSmallFilled,
color: 'yellow',
label: 'pause',
logLevel: 'info'
},
debug: {
badge: figures('⬤'),
color: 'red',
label: 'debug',
logLevel: 'debug'
},