Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pre-publish script): Add pre-publish shell script to support standard-version prerelease #57

Merged
merged 16 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions bin-dev-scripts/standard-version-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bash -e to abort on error


npm install
npm test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove npm test from this. Let that be in pre release only

git diff --quiet

BRANCH=$(git branch | grep \* | cut -d ' ' -f2-)

if [ $BRANCH == 'master' ]
then
npx standard-version
else
npx standard-version --prerelease $BRANCH
fi

unset BRANCH
git push --follow-tags origin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention which branch you push to

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And please put this file in /bin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want the dev-time scripts to be part of the bundled package. So, we can put it in the bin folder and ensure that these files are not bundled into the tarball.

62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Libraries to help build Quintype Node.js apps",
"main": "index.js",
"scripts": {
"prepublishOnly": "npm install && npm test && git diff --quiet && npx standard-version && git push --follow-tags origin",
"prepublishOnly": "./bin-dev-scripts/standard-version-release.sh",
"test": "NODE_ENV=test npx mocha --recursive --require ./test/babel",
"watch-test": "NODE_ENV=test npx mocha --recursive --watch --require ./test/babel",
"coverage": "nyc --all npm test",
Expand Down