diff --git a/.gitignore b/.gitignore index 40acf3f76e..0afcc7aa2b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ /dist /_dev /coverage +/.package.json # Additional bundles /devtools.js diff --git a/config/prepublish.js b/config/prepublish.js new file mode 100644 index 0000000000..073c6caa8f --- /dev/null +++ b/config/prepublish.js @@ -0,0 +1,22 @@ +const path = require('path').join(__dirname, '..', 'package.json'); +const pkg = require(path); + +const UNNECESSARY_KEYS = [ + 'babel', + 'greenkeeper', + 'bundlesize', + 'devDependencies', + 'eslintConfig' +]; + +UNNECESSARY_KEYS.forEach(function (key) { + delete pkg[key]; +}); + +pkg.scripts = { + donate: pkg.scripts.donate, + postinstall: pkg.scripts.postinstall, + postpublish: 'mv -f .package.json package.json' +}; + +require('fs').writeFileSync(path, JSON.stringify(pkg, null, 2)); diff --git a/package.json b/package.json index 10aeebe244..362e87bf29 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "test:size": "bundlesize", "lint": "eslint debug devtools src test", "prepublish": "npm run build", + "prepublishOnly": "cp package.json .package.json; node config/prepublish.js", "smart-release": "npm run build && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish", "release": "cross-env npm run smart-release", "postinstall": "node ./config/donation-message.js"