-
-
Save stevemao/280ef22ee861323993a0 to your computer and use it in GitHub Desktop.
Publish node module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# npm publish with goodies | |
# prerequisites: | |
# `npm install -g trash conventional-recommended-bump conventional-changelog conventional-github-releaser conventional-commits-detector json` | |
# `np` with optional argument `patch`/`minor`/`major`/`<version>` | |
# defaults to conventional-recommended-bump | |
# and optional argument preset `angular`/ `jquery` ... | |
# defaults to conventional-commits-detector | |
np() { | |
travis status --no-interactive && | |
trash node_modules &>/dev/null; | |
git pull --rebase && | |
npm install && | |
npm test && | |
cp package.json _package.json && | |
preset=`conventional-commits-detector` && | |
echo $preset && | |
bump=`conventional-recommended-bump -p angular` && | |
echo ${1:-$bump} && | |
npm --no-git-tag-version version ${1:-$bump} &>/dev/null && | |
conventional-changelog -i CHANGELOG.md -s -p ${2:-$preset} && | |
git add CHANGELOG.md && | |
version=`cat package.json | json version` && | |
git commit -m"docs(CHANGELOG): $version" && | |
mv -f _package.json package.json && | |
npm version ${1:-$bump} -m "chore(release): %s" && | |
git push --follow-tags && | |
conventional-github-releaser -p ${2:-$preset} && | |
npm publish | |
} | |
# apm publish with goodies | |
ap() { | |
travis status --no-interactive && | |
trash node_modules &>/dev/null; | |
git pull --rebase && | |
npm install && | |
apm install && | |
npm test && # checking coding styles or non atom related tests maybe | |
apm test && | |
cp package.json _package.json && | |
preset=`conventional-commits-detector` && | |
echo $preset && | |
bump=`conventional-recommended-bump -p angular` && | |
echo ${1:-$bump} && | |
npm --no-git-tag-version version ${1:-$bump} &>/dev/null && | |
conventional-changelog -i CHANGELOG.md -s -p ${2:-$preset} && | |
git add CHANGELOG.md && | |
version=`cat package.json | json version` && | |
git commit -m":memo: CHANGELOG for $version" && | |
mv -f _package.json package.json && | |
apm publish ${1:-$bump} && | |
git push --follow-tags && | |
conventional-github-releaser -p ${2:-$preset} | |
} |
I would need a bit of guidance about how to use this snippet. How can i execute it like npm run my-script?
Best
Michael
thanks
in march 2020 use this command:
npm install -g conventional-changelog-cli
and use sudo on circleci
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
version line could be tweaked to:
version=$(json -f package.json version)
.cat
is unnecessary and backticks are deprecated bash syntax.