Skip to content

Instantly share code, notes, and snippets.

View isaacs's full-sized avatar
🔮
only way out is through

isaacs isaacs

🔮
only way out is through
View GitHub Profile
const {Node} = require('../')
const tree = new Node({
path: '/some/path',
pkg: { dependencies: { foo: '' }},
children: [
{
pkg: {name:'foo',version:'1.2.3',dependencies:{bar:''}},
children: [{pkg: {name:'bar',version:'1.2.3'}}],
},
],
const {Node} = require('../')
const tree = new Node({
path: '/some/path',
pkg: { dependencies: { foo: '' }},
children: [
{
pkg: {name:'foo',version:'1.2.3',dependencies:{bar:''}},
children: [{pkg: {name:'bar',version:'1.2.3'}}],
},
],
diff --git a/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js b/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
index ed0e47daf..1d4e20292 100644
--- a/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
+++ b/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js
@@ -308,11 +308,13 @@ module.exports = cls => class VirtualLoader extends cls {
target,
pkg: target && target.package,
})
- link.extraneous = target.extraneous
- link.devOptional = target.devOptional
diff --git a/lib/can-place-dep.js b/lib/can-place-dep.js
index 6be59093..3291b6fb 100644
--- a/lib/can-place-dep.js
+++ b/lib/can-place-dep.js
@@ -145,7 +145,9 @@ class CanPlaceDep {
return CONFLICT
}
- if (targetEdge && !dep.satisfies(targetEdge) && targetEdge !== this.edge) {
+ // skip this test if there's a current node, because we might be able
diff --git a/node_modules/@npmcli/arborist/lib/can-place-dep.js b/node_modules/@npmcli/arborist/lib/can-place-dep.js
index 6be59093c..3291b6fbf 100644
--- a/node_modules/@npmcli/arborist/lib/can-place-dep.js
+++ b/node_modules/@npmcli/arborist/lib/can-place-dep.js
@@ -145,7 +145,9 @@ class CanPlaceDep {
return CONFLICT
}
- if (targetEdge && !dep.satisfies(targetEdge) && targetEdge !== this.edge) {
+ // skip this test if there's a current node, because we might be able
diff --git a/lib/can-place-dep.js b/lib/can-place-dep.js
index 6be59093..e4eba7ac 100644
--- a/lib/can-place-dep.js
+++ b/lib/can-place-dep.js
@@ -145,7 +145,9 @@ class CanPlaceDep {
return CONFLICT
}
- if (targetEdge && !dep.satisfies(targetEdge) && targetEdge !== this.edge) {
+ // skip this test if there's a current node, because we might be able
diff --git a/index.js b/index.js
new file mode 100644
index 000000000..5447643e0
--- /dev/null
+++ b/index.js
@@ -0,0 +1,5 @@
+if (require.main === module) {
+ require('./lib/cli.js')(process)
+} else {
+ throw new Error('The programmatic API was removed in npm v8.0.0')
#!/usr/bin/env node
/*
put this in your package.json
"scripts": {
"preinstall": "node node-version-preinstall.js"
}
*/
#!/usr/bin/env node
const args = process.argv.slice(2)
if (args.length < 3)
console.error(`usage: node ${process.argv[1]} <file> <key> [<subkey> ...] <value>`)
const file = args.shift()
const value = args.pop()
const { readFileSync, writeFileSync } = require('fs')
diff --git a/lib/index.js b/lib/index.js
index 0bf91c1..70b9cbf 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -6,4 +6,4 @@ const { resolve } = require('path')
const eslintrc = resolve(__dirname, './.eslintrc.json')
const args = ['-c', eslintrc, ...process.argv.slice(2)]
const result = spawnSync(whichSync('eslint'), args, { stdio: 'inherit' })
-process.exitCode = result.exitCode
+process.exitCode = result.status