Set commitlint & conventional-changelog quickly
I need to write and install lots of works when I want to use commitlint
with @moyuyc/husky
and conventional-changelog
, commitizen for conventional changelog.
{
"scripts": {
"version": "npm run changelog",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
}
},
"commitlint": {
"extends": ["@commitlint/config-conventional"]
},
"config": {
"commitizen": {
"path": "./node_modules/foo"
}
}
"devDependencies": {
"@commitlint/cli": "^7.1.1",
"@commitlint/config-conventional": "^7.1.1",
"conventional-changelog-cli": "^2.0.5",
"@moyuyc/husky": "^1.1.1"
}
}
So the package can help you setting commitlint & conventional-changelog quickly.
npm install cc-init -g
# or use yarn
yarn global add cc-init
cc-init -h
import ccInit from 'cc-init'
ccInit(cwd, {
// ...options
})
export CHANGELOG_PRESET=@baidu/befe
export CHANGELOG_PRESET_PKGNAME=@baidu/conventional-changelog-befe
export COMMITIZEN_ADAPATOR=@baidu/cz-conventional-changelog-befe
export NPM_REGISTRY=http://registry.npm.baidu-int.com
export COMMITLINT_PRESET=@baidu/commitlint-config-befe
# Preset the default values
cc-init
make commitlint, husky and conventional-changelog getting along harmoniously together.
-
cwd
{string} - the project's root path -
opts
{{}}-
opts.commitizenAdaptor
{string|null} (optional, defaultnull
) -
opts.commitizenInGlobal
{boolean} (optional, defaulttrue
) -
opts.changelogPresetPkgName
{string} the custom changelog preset package's name should be installed like@scoped/conventional-changelog-foo
(optional, default''
) -
opts.changelogPreset
{string} conventional-changelog's preset like@scoped/foo
(optional, default'angular'
) -
opts.registry
{string} the npm's registry (optional, default''
) -
opts.commitlintPreset
{string} the commitlint's preset config (optional, default'@commitlint/config-conventional'
) -
opts.force
{boolean} - overwrite the existed config and devDependencies inpackage.json
-
opts.stdio
{string} the stdio of npm install process (optional, default'inherit'
)
-
Returns boolean
MIT