Skip to content

Instantly share code, notes, and snippets.

@chrmoritz
Last active July 10, 2017 12:06
Show Gist options
  • Save chrmoritz/c29019d322d7be4c81d6e5b2de9bafcc to your computer and use it in GitHub Desktop.
Save chrmoritz/c29019d322d7be4c81d6e5b2de9bafcc to your computer and use it in GitHub Desktop.
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']
delete pkg_json.pkg
for (var s of ['postinstall', 'prepublish', 'link', 'pack', 'webpack', 'clean']) {
delete pkg_json.scripts[s]
}
pkg_json.dependencies = {}
for (var d in pkg_json.devDependencies){
// ToDo: Could add update-notifier too, if bin/now.js is patched to only require it when needed (if inside pkg)
if (!d.startsWith('babel') && !['ava', 'cross-spawn', 'in-publish', 'slackup', 'webpack', 'xo'].includes(d)){
pkg_json.dependencies[d] = pkg_json.devDependencies[d]
delete pkg_json.devDependencies[d]
}
}
fs.writeFileSync(packagePath, JSON.stringify(pkg_json, null, ' '))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment