Skip to content

Instantly share code, notes, and snippets.

View MylesBorins's full-sized avatar

Myles Borins MylesBorins

View GitHub Profile
@MylesBorins
MylesBorins / hack.patch
Created April 21, 2022 20:55
Allow for automation tokens when setting 2FA mode via CLI
diff --git a/workspaces/libnpmaccess/lib/index.js b/workspaces/libnpmaccess/lib/index.js
index 71219d009..27cebddec 100644
--- a/workspaces/libnpmaccess/lib/index.js
+++ b/workspaces/libnpmaccess/lib/index.js
@@ -169,7 +169,7 @@ function setRequires2fa (spec, required, opts = {}) {
return npmFetch(uri, {
...opts,
method: 'POST',
- body: { publish_requires_tfa: required },
+ body: { publish_requires_tfa: required, automation_token_overrides_tfa: required },
@MylesBorins
MylesBorins / index.mjs
Created February 21, 2021 21:09
No more CJS `$ node --experimental-loader ./no-cjs.mjs index.mjs`
import './no-more.cjs';
@MylesBorins
MylesBorins / index.js
Created February 12, 2021 16:02
example wrapper
const namespace = require('./wrapper');
console.log(namespace);
@MylesBorins
MylesBorins / maybe-simple.md
Created January 8, 2021 02:53
An attempt to document exports

The "exports" field allows defining the entry points of a package. Through the use of conditional exports loader specific entries can be defined.

It can be a string an object or an array

If package.exports is a string an import or require of your package will always resolve to that string

If package.exports is an object you can define two types of fields.

@MylesBorins
MylesBorins / 15.x-commits.md
Created January 5, 2021 16:25
branch-diff v15.x-staging upstream/master --exclude-label semver-major,dont-land-on-v15.x,backport-requested-v15.x,backported-to-v15.x,backport-blocked-v15.x,backport-open-v15.x --filter-release
@MylesBorins
MylesBorins / fs-promises-polyfill.js
Created January 4, 2021 15:51
fs/promises polyfill
try {
require('fs/promises');
} catch (e) {
const {join} = require('path');
const {promises} = require('fs');
const polyfillRoot = join(__dirname, 'node_modules', 'fs')
const polyfillPath = join(polyfillRoot, 'promises.js');
require.cache[polyfillPath] = {
id: polyfillPath,
path: polyfillRoot,
@MylesBorins
MylesBorins / v14.x-diff.md
Last active December 11, 2020 23:02
branch-diff v14.x-staging upstream/v15.x --exclude-label semver-major,semver-minor,dont-land-on-v14.x,backport-requested-v14.x,backported-to-v14.x,backport-blocked-v14.x,backport-open-v14.x,baking-for-lts --filter-release
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 = {}
@MylesBorins
MylesBorins / v12.x-backport.md
Last active November 3, 2020 22:30
branch-diff v12.x-staging upstream/v14.x --exclude-label semver-major,dont-land-on-v12.x,backport-requested-v12.x,backported-to-v12.x,backport-blocked-v12.x,backport-open-v12.x --filter-release
@MylesBorins
MylesBorins / backtrace
Last active July 21, 2020 20:43
oh noes
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x00007fff7180933a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff718c5e60 libsystem_pthread.dylib`pthread_kill + 430
frame #2: 0x00007fff71790808 libsystem_c.dylib`abort + 120
frame #3: 0x00007fff7178fac6 libsystem_c.dylib`__assert_rtn + 314
frame #4: 0x00000001011d7ee3 node`uv_close.cold.1 + 35
frame #5: 0x00000001009363d8 node`uv_close(handle=<unavailable>, close_cb=<unavailable>) at core.c:178:5 [opt]
frame #6: 0x0000000102de1065 fse.node`fse::FSEvents::Stop(Nan::FunctionCallbackInfo<v8::Value> const&) [inlined] fse::FSEvents::asyncStop(this=<unavailable>) at async.cc:42:3 [opt]
frame #7: 0x0000000102de104a fse.node`fse::FSEvents::Stop(info=0x00007ffeefbfe968) at methods.cc:33 [opt]
frame #8: 0x0000000102de238d fse.node`Nan::imp::FunctionCallbackWrapper(info=0x00007ffeefbfe9f0) at nan_callbacks_12_inl.h:176:3 [opt]