Skip to content

Commit

Permalink
Add prepublishOnly script
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenmoya committed Aug 22, 2017
1 parent 0dea3b7 commit 0d5a99e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/dist
/_dev
/coverage
/.package.json

# Additional bundles
/devtools.js
Expand Down
20 changes: 20 additions & 0 deletions config/prepublish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const path = require('path').join(__dirname, '..', 'package.json');
const pkg = require(path);

const UNNECESSARY_KEYS = [
'babel',
'greenkeeper',
'bundlesize',
'devDependencies',
'eslintConfig'
];

UNNECESSARY_KEYS.forEach(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));
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "npm run -s donate",
Expand Down

0 comments on commit 0d5a99e

Please sign in to comment.