Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dirs.forEach(dir=> {
var pkg = join(dir, 'package.json')
var json = require(pkg)
console.log(chalk.green(' λ '))
console.log(chalk.green(' λ ') + chalk.underline.dim.cyan(json.name))
if (json.dependencies) {
Object.keys(json.dependencies).forEach(k=> {
var f = lodash.padEnd(` - ${k}`, 30, '.')
var l = lodash.padStart(`${json.dependencies[k]}`, 11, '.')
console.log(chalk.green(' λ ') + chalk.dim(f) + chalk.dim.yellow(l))
})
}
if (json.devDependencies) {
Object.keys(json.devDependencies).forEach(k=> {
var f = lodash.padEnd(` - ${k}`, 30, '.')
var l = lodash.padStart(`${json.devDependencies[k]}`, 11, '.')
console.log(chalk.green(' λ ') + chalk.dim(f) + chalk.dim.yellow(l))
})
}
if (!json.dependencies && !json.devDependencies) {
console.log(chalk.green(' λ ') + chalk.dim(' x no deps'))
}
})
dirs.forEach(dir=> {
var pkg = join(dir, 'package.json')
var json = require(pkg)
console.log(chalk.green(' λ '))
console.log(chalk.green(' λ ') + chalk.underline.dim.cyan(json.name))
if (json.dependencies) {
Object.keys(json.dependencies).forEach(k=> {
var f = lodash.padEnd(` - ${k}`, 30, '.')
var l = lodash.padStart(`${json.dependencies[k]}`, 11, '.')
console.log(chalk.green(' λ ') + chalk.dim(f) + chalk.dim.yellow(l))
})
}
if (json.devDependencies) {
Object.keys(json.devDependencies).forEach(k=> {
var f = lodash.padEnd(` - ${k}`, 30, '.')
var l = lodash.padStart(`${json.devDependencies[k]}`, 11, '.')
console.log(chalk.green(' λ ') + chalk.dim(f) + chalk.dim.yellow(l))
})
}
if (!json.dependencies && !json.devDependencies) {
console.log(chalk.green(' λ ') + chalk.dim(' x no deps'))
}
})
let v = json.dependencies[pkg]
const vs = v.match(vRe)
console.log(v, vs)
if (vs) {
v = vs[1] + '.' + vs[2] + '.' + vs[3]
if (parseInt(vs[2], 10)) v = '~' + vs[1] + '.' + vs[2] + '.' + vs[3]
if (parseInt(vs[1], 10)) v = '^' + vs[1] + '.' + vs[2] + '.' + vs[3]
json.dependencies[pkg] = v
}
}
if (!json.devDependencies) {
json.devDependencies = {}
}
if (!json.devDependencies.aegir) {
json.devDependencies.aegir = '^12.4.0'
}
if (repo) {
const tmp = {
'repository': {
'type': 'git',
'url': 'git+https://github.com/ZeroNetJS/' + repo + '.git'
},
'bugs': {
'url': 'https://github.com/ZeroNetJS/' + repo + '/issues'
},
'homepage': 'https://github.com/ZeroNetJS/' + repo + '#readme'
}
Object.assign(json, tmp)
}
const vs = v.match(vRe)
console.log(v, vs)
if (vs) {
v = vs[1] + '.' + vs[2] + '.' + vs[3]
if (parseInt(vs[2], 10)) v = '~' + vs[1] + '.' + vs[2] + '.' + vs[3]
if (parseInt(vs[1], 10)) v = '^' + vs[1] + '.' + vs[2] + '.' + vs[3]
json.dependencies[pkg] = v
}
}
if (!json.devDependencies) {
json.devDependencies = {}
}
if (!json.devDependencies.aegir) {
json.devDependencies.aegir = '^12.4.0'
}
if (repo) {
const tmp = {
'repository': {
'type': 'git',
'url': 'git+https://github.com/ZeroNetJS/' + repo + '.git'
},
'bugs': {
'url': 'https://github.com/ZeroNetJS/' + repo + '/issues'
},
'homepage': 'https://github.com/ZeroNetJS/' + repo + '#readme'
}
Object.assign(json, tmp)
}
const vRe = /.*([0-9]+)\.([0-9]+)\.([0-9]+)/
for (const pkg in json.dependencies) {
let v = json.dependencies[pkg]
const vs = v.match(vRe)
console.log(v, vs)
if (vs) {
v = vs[1] + '.' + vs[2] + '.' + vs[3]
if (parseInt(vs[2], 10)) v = '~' + vs[1] + '.' + vs[2] + '.' + vs[3]
if (parseInt(vs[1], 10)) v = '^' + vs[1] + '.' + vs[2] + '.' + vs[3]
json.dependencies[pkg] = v
}
}
if (!json.devDependencies) {
json.devDependencies = {}
}
if (!json.devDependencies.aegir) {
json.devDependencies.aegir = '^12.4.0'
}
if (repo) {
const tmp = {
'repository': {
'type': 'git',
'url': 'git+https://github.com/ZeroNetJS/' + repo + '.git'
},
'bugs': {
'url': 'https://github.com/ZeroNetJS/' + repo + '/issues'
},
function collect(pkg) {
const PKG = require(pkg);
const dependencies = PKG.dependencies || {};
const devDependencies = PKG.devDependencies || {};
insert(dependencies, dep, pkg);
insert(devDependencies, devDep, pkg);
}
(fs.readdirSync(this.input.code)||[]).forEach(function(dir){
if (fs.statSync(require('path').dirname(dir)).isDirectory()){
var pkg = require('path').join(dir,'package.json');
if (fs.existsSync(pkg)){
var p = require(pkg);
if (p.hasOwnProperty('dependencies')){
me.node_modules = me.node_modules.concat(Object.keys(p.dependencies));
}
if (p.hasOwnProperty('devDependencies')){
me.node_modules = me.node_modules.concat(Object.keys(p.devDependencies));
}
}
}
});
this.node_modules = this.node_modules.filter(function(el,i,a){