README
conventional-release-setup
Sets up an npm project for committing and releasing with Conventional Commits:
npx conventional-release-setup
Install
Install the CLI globally:
# with npm
npm install --global conventional-release-setup
# with yarn
yarn global add conventional-release-setup
Usage
If the CLI is installed globally, you can execute it in the command-line:
conventional-release-setup
Otherwise, you can install and execute the CLI like so:
npx conventional-release-setup
Explanation
The script:
- updates
package.json
:version
- appends
-alpha
- appends
scripts
- prepends
release
withhusky install
- prepends
- installs devDependencies:
- @commitlint/cli - lints commit messages
- @commitlint/config-conventional - config with conventional commits rules
- husky - sets up git hooks
- standard-version - generates changelog, bumps version, and creates git commit and tag
- copies the config:
- adds husky hook
commit-msg
If the package is not private
, the script also:
- updates
package.json
scripts:- prepends
pinst --enable
topostpublish
- prepends
pinst --disable
toprepublishOnly
- prepends
- installs devDependency:
- pinst - lets you have
postinstall
hook that runs only in dev
- pinst - lets you have
Release
If -alpha
is appended to your package.json
version:
{
"version": "1.0.0-alpha"
}
You can run a release like so:
npm run release # npx standard-version --no-verify
Otherwise, you can release as a target type imperatively:
npx standard-version --release-as 1.0.0
Or if you want to use the current version as your first release:
npx standard-version --first-release
Lint
Lint files:
npm run lint
Fix lint errors:
npm run lint:fix
Release
Only collaborators with credentials can release and publish:
npm run release
git push --follow-tags && npm publish