Skip to content

Commit

Permalink
fix: remove commitizen from git hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
MomenSherif committed Jan 21, 2022
1 parent 18b0975 commit f4b3149
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
"@babel/runtime": "^7.16.7",
"ansi-colors": "^4.1.1",
"enquirer": "^2.3.6",
"fs-extra": "^10.0.0",
"nanospinner": "^1.0.0"
"fs-extra": "^10.0.0"
},
"devDependencies": {
"@babel/cli": "^7.16.8",
Expand Down
3 changes: 2 additions & 1 deletion src/generators/commitizen.generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import pkgManager from '@utils/pkgManager';

export default async function commitizenConfigGenerator() {
console.log(c.blue('\nConfiguring Commitizen 🔨 🔨'));
// npm i -D commitizen cz-conventional-changelog

await pkgManager.install(['commitizen', 'cz-conventional-changelog']);

Expand All @@ -18,5 +17,7 @@ export default async function commitizenConfigGenerator() {

await fse.writeJSON('package.json', packageJson, { spaces: 2 });

await pkgManager.runCommand('npm set-script commit "cz"');

console.log(c.blue('Commtizien successfully configured 🎉 🎉'));
}
7 changes: 2 additions & 5 deletions src/generators/husky-lintstaged.generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default async function huskyLintStagedConfigGenerator(
const hasPrettier = installedPackages.includes('Prettier');
const hasEslint = installedPackages.includes('Eslint');
const hasStylelint = installedPackages.includes('Stylelint');
const hasCommitizen = installedPackages.includes('Commitizen');

await fse.writeJSON(
'.lintstagedrc.json',
Expand Down Expand Up @@ -50,11 +51,6 @@ export default async function huskyLintStagedConfigGenerator(
'npx husky set .husky/commit-msg "npx --no -- commitlint --edit $1"',
);

if (installedPackages.includes('Commitizen'))
await pkgManager.runCommand(
'npx husky set .husky/prepare-commit-msg "exec < /dev/tty && git cz --hook || true"',
);

console.log(
c.bold.blue('Husky & Lint-Staged successfully configured 🎉 🎉\n'),
);
Expand All @@ -63,6 +59,7 @@ export default async function huskyLintStagedConfigGenerator(
console.log(
c.bold.cyan(
`We added scripts for ${[
hasCommitizen && 'commit (to use commitizen)',
hasEslint && 'eslint',
hasStylelint && 'stylelint',
hasPrettier && 'prettier',
Expand Down

0 comments on commit f4b3149

Please sign in to comment.