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
#!/bin/bash
set -o errexit
set -o pipefail
j () {
node -e '
const inp = []
const {runInNewContext} = require("vm")
process.stdin.on("data", c => inp.push(c))
process.stdin.on("end", () =>
#!/bin/bash
set -o errexit
set -o pipefail
j () {
node -e '
const inp = []
const {runInNewContext} = require("vm")
process.stdin.on("data", c => inp.push(c))
process.stdin.on("end", () =>
#!/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
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
#!/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
#!/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
#!/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
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')

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
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 =>