Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
commitizen
Advanced tools
Commitizen is a tool that helps you write consistent and conventional commit messages. It provides a command-line interface (CLI) to guide you through the process of creating commit messages that follow a specified convention, such as the Angular commit message guidelines.
Interactive Commit Prompts
Commitizen provides an interactive CLI that prompts you to fill out the different parts of a commit message, ensuring that your commits follow a specified convention. Running `npx cz` will start the interactive prompt.
npx cz
Custom Adapters
Commitizen supports custom adapters that define different commit message conventions. For example, you can initialize the `cz-conventional-changelog` adapter to follow the Angular commit message guidelines.
npx commitizen init cz-conventional-changelog --save-dev --save-exact
Configuration
Commitizen allows you to configure the adapter in your project's `package.json` file. This configuration tells Commitizen which adapter to use for generating commit messages.
{
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
Commitlint checks if your commit messages meet the conventional commit format. It can be used in conjunction with Commitizen to enforce commit message conventions. While Commitizen helps you write commit messages, Commitlint ensures that they adhere to the specified guidelines.
Standard Version is a tool for versioning and changelog generation based on conventional commit messages. It automates the process of version bumping and changelog generation, which complements Commitizen's functionality of creating consistent commit messages.
Semantic Release automates the versioning and package publishing process based on the commit messages. It uses the same conventional commit guidelines that Commitizen helps enforce, making it a good companion tool for automating releases.
When you commit with Commitizen, you'll be prompted to fill out any required commit fields at commit time. No more waiting until later for a git commit hook to run and reject your commit. No more digging through CONTRIBUTING.md to find what the preferred format is. Get instant feedback on your commit message formatting and be prompted for required fields.
Installation is as simple as running the following command (add sudo if on OSX/Linux):
npm install -g commitizen
Now, simply use git cz
instead of git commit
when committing.
When you're working in a Commitizen friendly repository, you'll be prompted to fill in any required fields and your commit messages will be formatted according to the the standards defined by project maintainers.
If you're not working in a Commitizen friendly repository, then git cz
will work just the same as git commit
.
As a project maintainer, making your repo Commitizen friendly allows you to select pre-existing commit message conventions or to create your own custom commit message convention. When a contributor to your repo uses Commitizen, they will be prompted for the correct fields at commit time.
For this example, we'll be setting up our repo to use AngularJS's commit message convention also known as conventional-changelog.
First, install the Commitizen conventional-changelog adapter into your project.
npm install cz-conventional-changelog
Then just add .cz.json to the root of your repository with the following contents:
{
"path": "node_modules/cz-conventional-changelog/"
}
This just tells Commitizen which adapter we actually want our contributors to use when they try to commit to this repo.
Add the Commitizen-friendly badge to your README using the following markdown:
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
Your badge will look like this:
It may also make sense to change your README.md or CONTRIBUTING.md to include or link to the Commitizen project so that your new contributors may learn more about installing and using Commitizen.
Commitizen is an open source project that helps contributors be good open source citizens. It accomplishes this by prompting them to follow commit message conventions at commit time. It also empowers project maintainers to create or use predefined commit message conventions in their repos to better communicate their expectations to potential contributors.
Both! Commitizen is not meant to be a replacement for git commit hooks. Rather, it is meant to work side-by-side with them to ensure a consistent and positive experience for your contributors. Commitizen treats the commit command as a declarative action. The contributor is declaring that they wish to contribute to your project. It is up to you as the maintainer to define what rules they should be following.
We accomplish this by letting you define which adapter you'd like to use in your project. Adapters just allow multiple projects to share the same commit message conventions. A good example of an adapter is the cz-conventional-commit adapter.
Jim Cummins (@JimTheDev)
FAQs
Git commit, but play nice with conventions.
The npm package commitizen receives a total of 730,616 weekly downloads. As such, commitizen popularity was classified as popular.
We found that commitizen demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.