New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

libnpmexec

Package Overview
Dependencies
Maintainers
7
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libnpmexec - npm Package Compare versions

Comparing version

to
3.0.3

3

lib/cache-install-dir.js

@@ -6,4 +6,5 @@ const crypto = require('crypto')

const cacheInstallDir = ({ npxCache, packages }) => {
if (!npxCache)
if (!npxCache) {
throw new Error('Must provide a valid npxCache path')
}

@@ -10,0 +11,0 @@ // only packages not found in ${prefix}/node_modules

@@ -16,7 +16,9 @@ const { resolve } = require('path')

if (await fileExists(resolve(binDir, binName)))
if (await fileExists(resolve(binDir, binName))) {
return binDir
}
if (path.toLowerCase() === root)
if (path.toLowerCase() === root) {
return false
}
}

@@ -23,0 +25,0 @@

@@ -6,9 +6,11 @@ const getBinFromManifest = (mani) => {

const bin = mani.bin || {}
if (new Set(Object.values(bin)).size === 1)
if (new Set(Object.values(bin)).size === 1) {
return Object.keys(bin)[0]
}
// XXX probably a util to parse this better?
const name = mani.name.replace(/^@[^/]+\//, '')
if (bin[name])
if (bin[name]) {
return name
}

@@ -15,0 +17,0 @@ // XXX need better error message

@@ -62,4 +62,5 @@ const { delimiter, dirname, resolve } = require('path')

// nothing to maybe install, skip the arborist dance
if (!call && !args.length && !packages.length)
if (!call && !args.length && !packages.length) {
return await _run()
}

@@ -83,4 +84,5 @@ const needPackageCommandSwap = args.length && !packages.length

if (binExists)
if (binExists) {
return await _run()
}

@@ -114,4 +116,5 @@ packages.push(args[0])

if (needPackageCommandSwap)
if (needPackageCommandSwap) {
args[0] = getBinFromManifest(manis[0])
}

@@ -156,4 +159,5 @@ // figure out whether we need to install stuff, or if local is fine

// set -n to always say no
if (yes === false)
if (yes === false) {
throw new Error('canceled')
}

@@ -172,7 +176,9 @@ if (noTTY() || ciDetect()) {

}Ok to proceed? `
if (typeof log.clearProgress === 'function')
if (typeof log.clearProgress === 'function') {
log.clearProgress()
}
const confirm = await read({ prompt, default: 'y' })
if (confirm.trim().toLowerCase().charAt(0) !== 'y')
if (confirm.trim().toLowerCase().charAt(0) !== 'y') {
throw new Error('canceled')
}
}

@@ -179,0 +185,0 @@ }

@@ -6,8 +6,10 @@ const manifestMissing = ({ tree, manifest }) => {

// if no child, we have to load it
if (!child)
if (!child) {
return true
}
// if no version/tag specified, allow whatever's there
if (manifest._from === `${manifest.name}@`)
if (manifest._from === `${manifest.name}@`) {
return false
}

@@ -14,0 +16,0 @@ // otherwise the version has to match what we WOULD get

@@ -44,4 +44,5 @@ const { delimiter } = require('path')

if (log && log.disableProgress)
if (log && log.disableProgress) {
log.disableProgress()
}

@@ -53,4 +54,5 @@ try {

if (isTTY) {
if (ciDetect())
if (ciDetect()) {
return log.warn('exec', 'Interactive mode disabled in CI environment')
}

@@ -83,4 +85,5 @@ locationMsg = locationMsg || ` at location:\n${colorize.dim(runPath)}`

} finally {
if (log && log.enableProgress)
if (log && log.enableProgress) {
log.enableProgress()
}
}

@@ -87,0 +90,0 @@ }

{
"name": "libnpmexec",
"version": "2.0.1",
"version": "3.0.3",
"files": [
"bin",
"lib"

@@ -9,3 +10,3 @@ ],

"engines": {
"node": ">=10"
"node": "^12.13.0 || ^14.15.0 || >=16"
},

@@ -32,30 +33,30 @@ "description": "npm exec (npx) programmatic API",

"scripts": {
"lint": "eslint lib/*.js",
"pretest": "npm run lint",
"test": "tap test/*.js",
"snap": "tap test/*.js",
"lint": "eslint '**/*.js'",
"posttest": "npm run lint",
"test": "tap",
"snap": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
"prepublishOnly": "git push origin --follow-tags",
"postlint": "npm-template-check",
"lintfix": "npm run lint -- --fix"
},
"tap": {
"check-coverage": true
"color": true,
"check-coverage": true,
"files": "test/*.js"
},
"devDependencies": {
"bin-links": "^2.2.1",
"eslint": "^7.24.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0",
"@npmcli/template-oss": "^2.4.2",
"bin-links": "^3.0.0",
"tap": "^15.0.6"
},
"dependencies": {
"@npmcli/arborist": "^2.3.0",
"@npmcli/arborist": "^4.0.0",
"@npmcli/ci-detect": "^1.3.0",
"@npmcli/run-script": "^1.8.4",
"@npmcli/run-script": "^2.0.0",
"chalk": "^4.1.0",
"mkdirp-infer-owner": "^2.0.0",
"npm-package-arg": "^8.1.2",
"pacote": "^11.3.1",
"pacote": "^12.0.0",
"proc-log": "^1.0.0",

@@ -65,3 +66,6 @@ "read": "^1.0.7",

"walk-up-path": "^1.0.0"
},
"templateOSS": {
"version": "2.4.3"
}
}