Skip to content

Instantly share code, notes, and snippets.

Avatar
🔮
the only way out is through

isaacs isaacs

🔮
the only way out is through
View GitHub Profile
View gist:b5fca3998d8f2ddcedb7c00a086089b9
diff --git a/index.js b/index.js
index cc73d1d..4bfb1c1 100644
--- a/index.js
+++ b/index.js
@@ -11,18 +11,21 @@ const isPipe = (stdio = 'pipe', fd) =>
const promiseSpawn = (cmd, args, opts, extra = {}) => {
const cwd = opts.cwd || process.cwd()
const isRoot = process.getuid && process.getuid() === 0
- return !isRoot ? promiseSpawnUid(cmd, args, {
- ...opts,
View gist:b1ea5a0dd6a9565f929cfbfdc9eb3a48
if (!isRoot) {
return promiseSpawnUid(cmd, args, {
...opts,
cwd,
uid: undefined,
gid: undefined,
}, extra)
}
const {uid, gid} = inferOwner.sync(cwd)
return promiseSpawnUid(cmd, args, {
View gist:00521f823ef33da041f389aee55091c9
commit 5a7c615eea11ba4c540210c0a29c843da5def060
Author: isaacs <i@izs.me>
Date: Tue Oct 27 11:07:00 2020 -0700
Do not return 0-length buffer if stdio is inherited
diff --git a/README.md b/README.md
index 3b604f2..b569948 100644
--- a/README.md
+++ b/README.md
View gist:9ac4c3849153bff998b7b862520e44c2
diff --git a/index.js b/index.js
index 2324e7f..c52adf8 100644
--- a/index.js
+++ b/index.js
@@ -21,15 +21,25 @@ const urlIsValid = u => {
}
}
+const parsePublishConfig = (publishConfig = {}) => {
+ const opt = {}
View gist:909cbb9cdfe1589692b9dd7e809e0f2b
diff --git a/lib/arborist/rebuild.js b/lib/arborist/rebuild.js
index fd7be34..0932089 100644
--- a/lib/arborist/rebuild.js
+++ b/lib/arborist/rebuild.js
@@ -8,7 +8,10 @@ const binLinks = require('bin-links')
const runScript = require('@npmcli/run-script')
const promiseCallLimit = require('promise-call-limit')
const {resolve} = require('path')
-const { isNodeGypPackage } = require('@npmcli/node-gyp')
+const {
View gist:aca7eaa8378dea9a888f7e97928064d1
diff --git a/lib/ls.js b/lib/ls.js
index 09e70c9be..7d9be02fb 100644
--- a/lib/ls.js
+++ b/lib/ls.js
@@ -423,7 +423,7 @@ const ls = async (args) => {
!(node instanceof Arborist.Node) || (node[_depth] > depthToPrint)
return (shouldSkipChildren)
? []
- : [...node.edgesOut.values()]
+ : [...(node.target || node).edgesOut.values()]
View gist:9d7032da09d8456b97010367d6bf18a9
diff --git a/node_modules/minipass-fetch/lib/body.js b/node_modules/minipass-fetch/lib/body.js
index baa3fa3e2..fb7ffc356 100644
--- a/node_modules/minipass-fetch/lib/body.js
+++ b/node_modules/minipass-fetch/lib/body.js
@@ -130,6 +130,12 @@ class Body {
this.url} (over ${this.timeout}ms)`, 'body-timeout'))
}, this.timeout) : null
+ // do not keep the process open just for this timeout, even
+ // though we expect it'll get cleared eventually.
View gist:00fa33f93f309750bfbc423694829af7
diff --git a/lib/npm.js b/lib/npm.js
index 79d276722..7fb234cc9 100644
--- a/lib/npm.js
+++ b/lib/npm.js
@@ -3,6 +3,30 @@
// we define and instantiate the singleton ahead of loading any modules
// required for its methods.
+/* istanbul ignore next */ {
+ const timers = {}
View byname.js
const cacache = require('cacache')
const advisoriesByName = async (name, options) => {
const { cache } = options
const advisories = []
const pattern = new RegExp('^security-advisory:' + name + ':')
const keys = []
await cacache.ls.stream(cache).on('data', d => {
if (pattern.test(d.key)) {
keys.push(d.key)
View bulk-advisory-submission.json
{
"tslib": [
"2.0.1",
"1.13.0"
],
"semver": [
"5.7.1",
"7.0.0",
"6.3.0",
"7.3.2"
You can’t perform that action at this time.