Skip to content

Instantly share code, notes, and snippets.

🔮
the only way out is through

isaacs isaacs

🔮
the only way out is through
Block or report user

Report or block isaacs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View weird-cb-not-called-should-be-handled-test.js
const fs = require('fs')
if (process.argv[2] === 'install') {
const eacces = (path, dest) => {
const er = new Error('EACCES: I can\'t go for that')
er.path = path
er.dest = dest
er.code = 'EACCES'
er.syscall = 'rename'
er.errno = -13
View gist:826822befc8cd6de8280faf75c9fe230
diff --git a/index.js b/index.js
index d9a8373..d5eb76a 100644
--- a/index.js
+++ b/index.js
@@ -97,6 +97,13 @@ function pickManifest (packument, wanted, opts) {
target &&
packument.versions[target]
)
+
+ // // check packument.restrictedByPolicy[target] ...
View gist:aad0efaf5fee9e698ffd15452132e680
Find the best place to add a node, given the current state of the tree,
the constraints of the node being added, and the place where it is
going to be added.
Given an npa request, resolve it to either a single object (like a folder,
url, or git repo) or a range of manifests (a range of versions), or a
specific version (pinned or dist-tag)
1. Resolve any peer deps that each node has (to a range or single object)
2. Available options are R(all versions in range) x P(all peer deps in each)
View gist:5ab2523ec09488dcb11b86968050b9f3
diff --git a/index.js b/index.js
index b2a25ee..b34ae25 100644
--- a/index.js
+++ b/index.js
@@ -21,19 +21,14 @@ const resolveFrom = require('resolve-from')
const DEFAULT_NODE_GYP_PATH = resolveFrom(__dirname, 'node-gyp/bin/node-gyp')
const hookStatCache = new Map()
-let PATH = 'PATH'
+let PATH = isWindows ? 'Path' : 'PATH'
View failback-parse-error.js
var name = 'foo\\\\-bar'
var failbackExpr = /(\\*)-/g
var failbackMatch
var failback
while ((failbackMatch = failbackExpr.exec(name))) {
esc = failbackMatch[1]
esc = esc.length && esc.length % 2
if (esc) continue
failback = name.slice(failbackMatch.index + 1)
name = name.slice(0, failbackMatch.index)
View test.js
const tar = require('tar')
const {writeFileSync} = require('fs')
const {resolve} = require('path')
const {spawnSync} = require('child_process')
const mkdirp = require('mkdirp')
const $ = (...args) => {
const res = spawnSync('tar', args, { stdio: [0, 1, 2 ] }).status
console.log(res ? `ERROR=${res}` : 'OK')
}
View test.js
const tar = require('tar')
const {writeFileSync} = require('fs')
const {resolve} = require('path')
const {spawnSync} = require('child_process')
const mkdirp = require('mkdirp')
const $ = (...args) => {
const res = spawnSync('tar', args, { stdio: [0, 1, 2 ] }).status
console.log(res ? `ERROR=${res}` : 'OK')
}
View test-gh-218.js
const fs = require("fs");
const path = require("path");
const tar = require("tar");
const workingDir = path.resolve('working-dir')
// set up the test files
const mkdirp = require('mkdirp')
const rimraf = require('rimraf')
const paths = ["dir1/", "dir2/", "dir3/", "dir4/"];
View rpt-lstat-new.txt
done
{
lstats: { DUPES: 0 },
realpaths: { DUPES: 0 },
lstatCount: 3054,
realpathCount: 0
}
View rpt-dupes.txt
REALPATH .
LSTAT /Users
LSTAT /Users/isaacs
LSTAT /Users/isaacs/dev
LSTAT /Users/isaacs/dev/npm
LSTAT /Users/isaacs/dev/npm/cli
REALPATH /Users/isaacs/dev/npm/cli
LSTAT /Users
LSTAT /Users/isaacs
LSTAT /Users/isaacs/dev
You can’t perform that action at this time.