Skip to content

Instantly share code, notes, and snippets.

Avatar
🔮
only way out is through

isaacs isaacs

🔮
only way out is through
View GitHub Profile
View gist:8a4b55782cc0f0570c148582ab833c4c
diff --git a/lib/node.js b/lib/node.js
index 1bb84140..d17e4b2a 100644
--- a/lib/node.js
+++ b/lib/node.js
@@ -400,6 +400,10 @@ class Node {
for (const edge of edges)
why.dependents.push(edge.explain(seen))
}
+
+ if (this.linksIn.size)
View gist:d108e87dd0f847d9d108aac7555a301b
diff --git a/docs/content/commands/npm-exec.md b/docs/content/commands/npm-exec.md
index 2364da32c..f728ac6e0 100644
--- a/docs/content/commands/npm-exec.md
+++ b/docs/content/commands/npm-exec.md
@@ -260,18 +260,21 @@ an error.
#### workspace
-* Alias: `-w`
-* Type: Array
View gist:00a9fabc4b9a8f2fc62176cfadcb88b8
// package.json in the project root
{
"name": "my-workspace-project",
"version": "1.2.3",
"workspaces": {
"packages": [
// four packages in the folder
// w: should share peer and intra-project deps with other workspaces
// x: has peerDependency on react-native, should be isolated
// y: depends on z, but at a different version, by design
View gist:a706fcc6ab399c5fb8a979389bf8b9ac
https://gist.github.com/isaacs/f111fe608fbea4f7d115987b076e3b43
View gist:6f482a2f246c16e9e4e7663f4417db43
diff --git a/lib/utils/update-notifier.js b/lib/utils/update-notifier.js
index 0a19be94e..4913b2ae1 100644
--- a/lib/utils/update-notifier.js
+++ b/lib/utils/update-notifier.js
@@ -68,6 +68,7 @@ const updateNotifier = module.exports = async (npm, spec = 'latest') => {
// always prefer latest, even if doing --tag=whatever on the cmd
defaultTag: 'latest',
...npm.flatOptions,
+ timeout: 30,
}).catch(() => null)
View gist:ba515d0c5cd4eaab7de99d3bd4566f94
diff --git a/lib/audit-report.js b/lib/audit-report.js
index 77cd6511..e585d827 100644
--- a/lib/audit-report.js
+++ b/lib/audit-report.js
@@ -101,6 +101,7 @@ class AuditReport extends Map {
async run () {
this.report = await this[_getReport]()
+ this.log.silly('audit report', this.report)
if (this.report)
View gist:3a1c20f9d6ff9e75356cba5bd9597d5d
diff --git a/lib/arborist/build-ideal-tree.js b/lib/arborist/build-ideal-tree.js
index 49b21ca2..d2ed2b35 100644
--- a/lib/arborist/build-ideal-tree.js
+++ b/lib/arborist/build-ideal-tree.js
@@ -1631,52 +1631,66 @@ This is a one-time fix-up, please be patient...
// placed here as well. the virtualRoot already has the appropriate
// overrides applied.
if (peerEntryEdge) {
- const peerSet = getPeerSet(current)
- OUTER: for (const p of peerSet) {
View package.json
{
"dependencies": {
"@isaacs/testing-peer-dep-conflict-chain-b": "2",
"@isaacs/testing-peer-dep-conflict-chain-m": "2"
}
}
View index.js
const walkUp = require('walk-up-path')
const { resolve } = require('path')
const { stat: stat_, statSync } = require('fs')
const { promisify } = require('util')
const stat = promisify(stat_)
function* binDirs (start, root) {
start = resolve(start)
root = resolve(root)
for (const path of walkUp(start)) {
View gist:cd279acf2c8b8c728c7a89127ac1e292
diff --git a/lib/arborist/build-ideal-tree.js b/lib/arborist/build-ideal-tree.js
index 78192cdd..49b21ca2 100644
--- a/lib/arborist/build-ideal-tree.js
+++ b/lib/arborist/build-ideal-tree.js
@@ -1647,12 +1647,34 @@ This is a one-time fix-up, please be patient...
// to get the conflict here so that we can decide whether to
// accept the current dep node, clobber it, or fail the install.
if (edge.from === target && edge.valid) {
+ // replacement from virtual root
const rep = dep.parent.children.get(edge.name)