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 test.sh
#!/bin/bash
rm -rf *.log *.err package*.json
rm -rf real link package*.json
mkdir -p real/sub
ln -s real link
echo '{"dependencies":{"npm-packlist":"*"}}' > real/sub/package.json
arborist reify ./link/sub 2>siblings-sub.err >siblings-sub.log
tree
View gist:c02d6c2f72cbbbb0c7c5be856d8bac8a
diff --git a/lib/diff.js b/lib/diff.js
index dac7c81f..1f8eff0f 100644
--- a/lib/diff.js
+++ b/lib/diff.js
@@ -145,9 +145,9 @@ const allChildren = node => {
if (!node)
return new Map()
- // if the node is a global root, and also a link, then what we really
+ // if the node is root, and also a link, then what we really
View test.sh
#!/bin/bash
rm -rf *.log *.err package*.json
rm -rf real link package*.json
mkdir -p real/sub
ln -s real link
echo '{"dependencies":{"npm-packlist":"*"}}' > real/sub/package.json
arborist reify ./link/sub 2>siblings-sub.err >siblings-sub.log
tree
View test.sh
#!/usr/bin/env bash
rm -rf node_modules .git package-lock.json package.json .gitignore
git init
echo {} > package.json
echo node_modules > .gitignore
npm i optoolco/tonic#v13.3.2
git add .
git commit -m 'wip'
# then
View test.sh
#!/usr/bin/env bash
rm -rf node_modules .git package-lock.json package.json .gitignore
git init
echo {} > package.json
echo node_modules > .gitignore
npm i optoolco/tonic#v13.3.0
git add .
git commit -m 'wip'
# then
View gist:fc8a644e53b712608129b88b4c1d6f04
diff --git a/lib/arborist/build-ideal-tree.js b/lib/arborist/build-ideal-tree.js
index 73a6f667..5db11eb3 100644
--- a/lib/arborist/build-ideal-tree.js
+++ b/lib/arborist/build-ideal-tree.js
@@ -7,7 +7,7 @@ const semver = require('semver')
const promiseCallLimit = require('promise-call-limit')
const getPeerSet = require('../peer-set.js')
const realpath = require('../../lib/realpath.js')
-const { resolve } = require('path')
+const { resolve, dirname } = require('path')
View docs-classes-arborist-build-ideal-tree.md

Arborist.buildIdealTree(options)

This method is used to calculate the idealTree, which satisfies dependencies, complies with the lockfile if one exists, and makes the changes to the tree that the user has requested.

Algorithm

  1. Init Tree Load the virtualTree or actualTree as a starting point. (The actualTree
View gist:29ad4f7d0a2e60f6e793f6ea01c92b65
diff --git a/lib/cli.js b/lib/cli.js
index f42132f94..b1f6ba6ae 100644
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -53,7 +53,9 @@ module.exports = (process) => {
npm.config.set('usage', false, 'cli')
}
- npm.updateNotification = await updateNotifier(npm)
+ npm.updateNotification = updateNotifier(npm).then(notification =>
View gist:da57f6261183bb9ca741b8032c998dff
diff --git a/lib/shrinkwrap.js b/lib/shrinkwrap.js
index cff9f096..0a19ef93 100644
--- a/lib/shrinkwrap.js
+++ b/lib/shrinkwrap.js
@@ -714,6 +714,7 @@ class Shrinkwrap {
resolved,
integrity,
hasShrinkwrap,
+ version,
} = this.get(node.path)
View test.sh
#!/bin/bash
rm -rf packages package-lock.json node_modules
cat >package.json <<PJ
{
"devDependencies": {
"abbrev": "1.1.0"
}
}