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 notes-reify.md

tree reification

For the tree:

a
+-- b
|   +-- c
|   +-- d
|   |   +-- e
View package-contents.js
const bundled = require('npm-bundled')
const {resolve, basename, dirname} = require('path')
const {promisify} = require('util')
const readdirScoped = promisify(require('readdir-scoped-modules'))
const fs = require('fs')
const stat = promisify(fs.stat)
const readdir_ = promisify(fs.readdir)
const readdir = async path =>
(await readdir_(path)).filter(p => p !== 'node_modules')
View rename.js
const fs = require('fs')
let path = 'foo'
try { fs.mkdirSync(path) } catch (e) {}
const stream = fs.createWriteStream(path + '/bar')
const write = (i = 10) => {
console.error('WRITE', i)
if (i === 0)
return stream.end()
stream.write('hello ' + i + '\n')
View t.js
const tar = require('tar')
const before = [
Buffer.from(
'1f8b0800000000000003edcfc10e82300c0660ce3ec5d2b38e4eb71d789b' +
'010d41e358187890f0ee56493c71319218937d977feb9aa50daebab886f2' +
'b0a43cc7ce671b4344abb558ab3f2934223b198b4a598bdcc707a38f9c5b' +
'0fb2668c83eb79946fff597611effc131378772528c0c11e6ed4c7b6f37c' +
'53122572a5a640be265fb514a198a0e43729f3f2f06a9043738779defd7a' +
'89244992e4630fd69e456800080000', 'hex'),
View license.js
const Arborist = require('./')
const a = new Arborist({path: '.'})
a.loadActual().then(tree => {
for (const license of tree.inventory.query('license')) {
console.log(license)
}
for (const node of tree.inventory.query('license', 'MIT')) {
console.log(`${node.name} ${node.location} ${node.package.description}`)
}
})
View x.js
const versions = [
'0.0.1-beta.0',
'0.0.1-beta.1',
'0.0.1-beta.2',
'0.0.1-beta.4',
'0.0.1-beta.5',
'0.0.1-beta.6',
'0.0.1-beta.7',
'0.0.1-beta.8',
'0.0.1-beta.10',
View package-lock.json
{
"name": "@isaacs/testing-peer-deps",
"version": "2.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@isaacs/testing-peer-deps",
"version": "2.0.0",
"dependencies": {
View package-lock.json
{
"name": "@isaacs/testing-peer-deps",
"version": "2.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@isaacs/testing-peer-deps",
"version": "2.0.0",
"dependencies": {
View gist:b17c62f35e40866847627325207208bb
$ node ideal.js
BUILD IDEAL DEPS STEP /Users/isaacs/dev/npm/arborist/test/fixtures/package-no-lock
PLACE DEP /Users/isaacs/dev/npm/arborist/test/fixtures/package-no-lock prod abbrev *
CHECK /Users/isaacs/dev/npm/arborist/test/fixtures/package-no-lock
PLACE DEP /Users/isaacs/dev/npm/arborist/test/fixtures/package-no-lock prod once 1
CHECK /Users/isaacs/dev/npm/arborist/test/fixtures/package-no-lock
BUILD IDEAL DEPS STEP /Users/isaacs/dev/npm/arborist/test/fixtures/package-no-lock/node_modules/abbrev
BUILD IDEAL DEPS STEP /Users/isaacs/dev/npm/arborist/test/fixtures/package-no-lock/node_modules/once
PLACE DEP /Users/isaacs/dev/npm/arborist/test/fixtures/package-no-lock/node_modules/once prod wrappy 1
CHECK /Users/isaacs/dev/npm/arborist/test/fixtures/package-no-lock/node_modules/once
View for-krainbolt.sh
#!/bin/bash
a () {
sleep 1
echo a
}
b () {
sleep 1
echo b
}
You can’t perform that action at this time.