How to use the pkg.devDependencies function in pkg

To help you get started, we’ve selected a few pkg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smallwins / lambda / scripts / deps.js View on Github external
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'))
  }
})
github smallwins / lambda / scripts / deps.js View on Github external
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'))
  }
})
github ZeroNetJS / zeronet-js / tools / sync-pkg-json.js View on Github external
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)
}
github ZeroNetJS / zeronet-js / tools / sync-pkg-json.js View on Github external
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)
}
github ZeroNetJS / zeronet-js / tools / sync-pkg-json.js View on Github external
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'
    },
github 51nb / miox / cmd / dep.js View on Github external
function collect(pkg) {
    const PKG = require(pkg);
    const dependencies = PKG.dependencies || {};
    const devDependencies = PKG.devDependencies || {};

    insert(dependencies, dep, pkg);
    insert(devDependencies, devDep, pkg);
}
github ngnjs / NGN / Gruntfile.js View on Github external
(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){