Socket
Socket
Sign inDemoInstall

npmconf

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npmconf - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

61

lib/load-prefix.js

@@ -10,43 +10,34 @@ module.exports = loadPrefix

// try to guess at a good node_modules location.
var p
, gp
Object.defineProperty(this, "prefix",
{ get : function () {
var g = this.get("global")
return g ? this.globalPrefix : this.localPrefix
}.bind(this)
, enmerable : true
})
if (!Object.prototype.hasOwnProperty.call(cli, "prefix")) {
p = process.cwd()
} else {
p = this.get("prefix")
}
gp = this.get("prefix")
findPrefix(p, function (er, p) {
Object.defineProperty(this, "localPrefix",
{ get : function () { return p }
, set : function (r) { return p = r }
, enumerable : true
})
// the prefix MUST exist, or else nothing works.
if (!this.get("global")) {
mkdirp(p, next.bind(this))
} else {
next.bind(this)(er)
}
}.bind(this))
gp = path.resolve(gp)
Object.defineProperty(this, "globalPrefix",
{ get : function () { return gp }
, set : function (r) { return gp = r }
{ get : function () {
return path.resolve(this.get("prefix"))
}.bind(this)
, enumerable : true
})
// the prefix MUST exist, or else nothing works.
mkdirp(gp, next.bind(this))
var i = 2
var errState = null
function next (er) {
if (errState) return
if (er) return cb(errState = er)
if (--i === 0) return cb()
var p
Object.defineProperty(this, "localPrefix",
{ get : function () { return p }
, enumerable: true })
// try to guess at a good node_modules location.
// If we are *explicitly* given a prefix on the cli, then
// always use that. otherwise, infer local prefix from cwd.
if (Object.prototype.hasOwnProperty.call(cli, "prefix")) {
p = path.resolve(cli.prefix)
process.nextTick(cb)
} else {
findPrefix(process.cwd(), function (er, found) {
p = found
cb(er)
}.bind(this))
}
}

@@ -106,3 +106,3 @@

conf.loadExtras(function(er) {
conf.loadPrefix(function(er) {
if (er)

@@ -143,6 +143,10 @@ return cb(er)

conf.once('load', function () {
// warn about invalid bits.
validate(conf)
exports.loaded = conf
cb(null, conf)
conf.loadExtras(function(er) {
if (er)
return cb(er)
// warn about invalid bits.
validate(conf)
exports.loaded = conf
cb(er, conf)
})
})

@@ -179,9 +183,10 @@ }

Conf.prototype.loadExtras = function(cb) {
this.loadPrefix(function(er) {
this.setUser(function(er) {
if (er)
return cb(er)
this.setUser(function(er) {
this.loadUid(function(er) {
if (er)
return cb(er)
this.loadUid(cb)
// Without prefix, nothing will ever work
mkdirp(this.prefix, cb)
}.bind(this))

@@ -188,0 +193,0 @@ }.bind(this))

{
"name": "npmconf",
"version": "1.0.3",
"version": "1.0.4",
"description": "The config thing npm uses",

@@ -5,0 +5,0 @@ "main": "npmconf.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc