Skip to content

Instantly share code, notes, and snippets.

View chrmoritz's full-sized avatar

Christian Moritz chrmoritz

  • Berlin, Germany
View GitHub Profile
@chrmoritz
chrmoritz / Node-for-brew-language-node-Contributors.md
Last active July 12, 2017 11:44
What homebrews language/node should consider when handling prepare/prepublish scrips in node modules.

We have to support 5 different cases with lifecycle scripts (prepare and prepublish) in node module based formulas. These are sorted by increasing difficulty / complexity to support:

  1. arbitrary download location with no prepare (or prepublish) script: trivial to handle
  2. npm registry tarball download (already prepared) with a prepare script, which could be run a second time without failure: running prepare twice would be unnecessary but wouldn't break anything
  3. npm registry tarball download (already prepared) with a prepare script, which fails when run a second time (e.g. mkdir fails on already existing directory): --ignore-scripts is required for npm pack (and if we want this case to be rooted through the bundledDependencies branch for consistency we would need to pass --production to the first local npm install (because --ignore-scripts won't work here, see npm background#1+4))
  4. source tarball downloads (not already prepared), but we don't want to run prepare (e.g. fo
require "language/node"
class NowCli < Formula
desc "The command-line interface for realtime global deployments."
homepage "https://zeit.co/now"
url "https://github.com/zeit/now-cli/archive/7.0.2.tar.gz"
sha256 "7924feb98f07a599cb9ffdabd07f95048864cf4fe15fdcbd2922b8cd8b32a8be"
depends_on "node" => :build
@chrmoritz
chrmoritz / npm-ddd.log
Created July 4, 2017 22:02
Log for running `npmc install grunt-cli -ddd` on yarn installed grafana deps
npm info it worked if it ends with ok
npm verb cli [ '/Users/chris/.nvm/versions/node/v8.1.2/bin/node',
npm verb cli '/usr/local/bin/npmc',
npm verb cli 'install',
npm verb cli 'grunt-cli',
npm verb cli '-ddd' ]
npm info using npm@5.0.4-canary.14
npm info using node@v8.1.2
npm notice CANARY npmc is experimental software. If you find an issue, please file it in the main npm repository, and call out that you were using npmc.
npm verb npm-session 27fe7dcf50d7ed18
@chrmoritz
chrmoritz / homebrew.js
Last active July 10, 2017 12:06
now cli homebrew build script
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const packagePath = path.join(__dirname, '../package.json')
var pkg_json = require(packagePath)
pkg_json.bin.now = 'bin/now.js'
pkg_json.files = ['bin', 'lib']
@chrmoritz
chrmoritz / now-cli.rb
Last active July 10, 2017 12:12
now cli
require "language/node"
class NowCli < Formula
desc "The command-line interface for realtime global deployments."
homepage "https://zeit.co/now"
url "https://github.com/zeit/now-cli/archive/7.0.2.tar.gz"
sha256 "7924feb98f07a599cb9ffdabd07f95048864cf4fe15fdcbd2922b8cd8b32a8be"
depends_on "node"
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/Cellar/node/8.0.0_1/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli 'grunt-cli',
npm verb cli '-ddd' ]
npm info using npm@5.0.1
npm info using node@v8.0.0
npm sill install loadCurrentTree
npm sill install readLocalPackageData
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.0.0_1/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'easy-table@0.0.1' ]
2 info using npm@5.0.1
3 info using node@v8.0.0
4 silly install loadCurrentTree
5 silly install readLocalPackageData
6 http fetch GET 200 https://registry.npmjs.org/easy-table 259ms
@chrmoritz
chrmoritz / issue.md
Last active June 2, 2017 15:10
3 undocumented breaking changes we encountered while upgarding npm to v5.0.1 in homebrew

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • Other (see below for feature requests):

supporting information:

  • npm -v prints: 5.0.1
0 info it worked if it ends with ok
1 verbose cli [ '/Users/chris/.nvm/versions/node/v8.0.0/bin/node',
1 verbose cli '/Users/chris/.nvm/versions/node/v8.0.0/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'azure-cli' ]
2 info using npm@5.0.0
3 info using node@v8.0.0
4 silly install loadCurrentTree
5 silly install readGlobalPackageData
{
"name": "azure-cli",
"version": "0.9.19",
"dependencies": {
"acorn": {
"version": "1.2.2",
"from": "acorn@>=1.0.3 <2.0.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-1.2.2.tgz"
},
"adal-node": {