-
-
Save francoatmega/3750a5e8094f1ed2782c41ef9c81804c to your computer and use it in GitHub Desktop.
Setting up the development environment for the commit
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
Node and NPM: https://nodejs.org/en/ | |
YARN: https://yarnpkg.com/getting-started/install |
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
*SE FOR COM NPM: | |
npm install @commitlint/cli @commitlint/config-conventional --save-dev | |
*SE FOR COM YARN: | |
yarn add @commitlint/cli @commitlint/config-conventional -D | |
- Criar arquivo chamado **commitlint.config.js** na raíz do projeto, nele terá o conteúdo: | |
module.exports = {extends: ['@commitlint/config-conventional']} | |
Refences: https://commitlint.js.org/#/ | |
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
- ATENÇÃO NESSA PARTE, SÓ INSTALE O HUSKY SE TIVER UM REPOSITÓRIO GIT INICIALIZADO ANTES! | |
*SE FOR COM NPM: | |
npm install husky --save-dev | |
*SE FOR COM YARN: | |
yarn add husky -D | |
Adicionar trecho de código do package.json, ele irá fazer um hook nos commit's e chamar o commitlint para barrar commits mal feitos | |
"husky": { | |
"hooks": { | |
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | |
} | |
} | |
References: https://www.npmjs.com/package/husky |
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
*SE FOR COM NPM: | |
npm install commitizen --save-dev | |
npm commitizen init cz-conventional-changelog --save-dev --save-exact | |
*SE FOR COM YARN: | |
yarn add commitizen -D | |
yarn commitizen init cz-conventional-changelog --yarn --dev --exact | |
Agora vamos criar um script pra inicializar o Commitizen ,Adicionar trecho de código do package.json | |
"scripts": { | |
"commit": "git-cz" | |
} | |
Ou se já tiver scripts: | |
"commit": "git-cz" | |
References: https://www.npmjs.com/package/commitizen |
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
{ | |
"name": "name-project", | |
"version": "0.1.0", | |
"private": true, | |
"scripts": { | |
"commit": "git-cz" | |
}, | |
"husky": { | |
"hooks": { | |
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | |
} | |
}, | |
"devDependencies": { | |
"@commitlint/config-conventional": "^8.3.4", | |
"commitizen": "^4.1.2", | |
"cz-conventional-changelog": "3.2.0", | |
"husky": "^4.2.5", | |
}, | |
"config": { | |
"commitizen": { | |
"path": "./node_modules/cz-conventional-changelog" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment