Skip to content

Instantly share code, notes, and snippets.

@developit
Created August 21, 2017 17:11
Show Gist options
  • Save developit/11bf91c3e4240ea3b615ac80684351d0 to your computer and use it in GitHub Desktop.
Save developit/11bf91c3e4240ea3b615ac80684351d0 to your computer and use it in GitHub Desktop.
strip all non-essential fields from package.json prior to publishing.
var path = require('path').join(__dirname, '..', 'package.json');
var pkg = require(path);
['babel', 'greenkeeper', 'bundlesize', 'devDependencies', 'eslintConfig'].forEach(function(key) { delete pkg[key] });
pkg.scripts = { postinstall: pkg.scripts.postinstall, donate: pkg.scripts.donate };
require('fs').writeFileSync(path, JSON.stringify(pkg, null, 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment