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: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 Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active Jun 18, 2021
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
View node-and-npm-in-30-seconds.sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
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
#!/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 =>