npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cz-custom

v0.0.2

Published

Commitizen customizable adapter following the conventional-changelog format.

Downloads

1,181

Readme

cz-custom

forked from leoforfree/cz-customizable

The customizable Commitizen plugin (or standalone utility) to help achieve consistent commit messages like the AngularJS team.

screenshot

Suitable for large teams working with multiple projects with their own commit scopes. It allows you to select the pre-defined scopes or commit types. It works perfectly with https://github.com/semantic-release/semantic-release.

Commitizen friendly npm monthly downloads bundlephobia

You have two ways to use cz-custom. Originally, this project started as a commitizen plugin (Option 1).

We introduced the second option to run this cz-custom in standalone mode (Option 2), just like any NodeJS script. It's recommended to use Option 2 for simplicity. The way you configure is shared between both options.

Quick start (New, recommended)

Configuration

  • Copy contents of the example config file and paste into a new file .cz-config.js
  • move file cz-config.js to your home directory.

cz-custom via global install

npm i cz-custom -g

Then run cz-custom from your root repo.

If everything is correct, you should see commit questions like the image above.

Slow start

Option 1 - cz-custom via npx

npx cz-custom

Option 2 - cz-custom in standalone mode

Use cz-custom without commitzen.

  • npm install npm install cz-custom --save-dev
  • add a new script to your package.json:
"scripts" : {
  ...
  "commit": "./node_modules/cz-custom/standalone.js"
}
  • See options below how to create and where you could put your .cz-config.js file.
  • now run: npm run commit.

Option 3 - cz-custom as commitizen plugin

This is how this project started.

  • install commitizen in case you don't have it: npm install -g commitizen. Make sure you have the latest version of commitizen installed globally.

  • configure commitizen to use cz-custom as plugin. Add those lines to your package.json:

...
"config": {
  "commitizen": {
    "path": "node_modules/cz-custom"
  }
}

Configuration (Shared between options 1,2 and 3)

Option 1 - You can make changes to your git repository, file package.json.

  • cz-custom will first look for a file called .cz-config.js or .config/cz-config.js in the project root, near your package.json
  • If no config found, it will look for .cz-config.js or .config/cz-config.js in your home directory
  • alternatively add the config location in your package.json:
...
"config": {
  "commitizen": { // not needed for standlone usage
    "path": "node_modules/cz-custom"
  },
  "cz-custom": {
    "config": "config/path/to/my/config.js"
  }
}

Note: option one allows you to have your config away from root directory. It also gives you a change to define any name to your .cz-config.js.

No Changes to your git repository*.

This is suitable when your team is not ready to roll cz-custom across all teams but you still would like to use it for your own commits, no matter the project.

Steps:

  • create config file:
    • create a file called .cz-config.js in your git repository root (*Assumptions: you git ignore global on ~/.gitignore_global for .cz-config.js). Or;
    • create a file called .cz-config.js your home directory.

Additional steps when used as commitizen plugin

  • npm install -g commitizen
  • npm install -g cz-custom. Make sure you have version >v5.6.x
  • create global commitizen config file .czrc: echo '{ "path": "cz-custom" }' > ~/.czrc
  • now run: npx git-cz or git cz.

Notes:

  • you should commit your .cz-config.js file to your git when applicable.

Hopefully this will help you to have consistent commit messages and have a fully automated deployment without any human intervention.


Options

Here are the options you can set in your .cz-config.js:

  • subjectLimit: {number, default 100}: This is the subject limit. Example: this is a new feature or fix a bug

  • subjectSeparator: {string, default ': '}: This is the subject separator. Example: feat: this is a new feature

  • typePrefix: {string, default ''}: This is the commit type prefix. Example: config: { typePrefix: '[' }, result: [feat: this is a new feature

  • typeSuffix: {string, default ''}: This is the commit type suffix. Example: config: { typePrefix: '[', typeSuffix: ']', subjectSeparator: ' ' }, result: [feat] this is a new feature

  • scopes: {Array of Strings}: Specify the scopes for your particular project. Eg.: for some banking system: ["acccounts", "payments"]. For another travelling application: ["bookings", "search", "profile"]

  • scopeOverrides: {Object where key contains a Array of String}: Use this when you want to override scopes for a specific commit type. Example below specify scopes when type is fix:

    scopeOverrides: {
      fix: [
        {name: 'merge'},
        {name: 'style'},
        {name: 'e2eTest'},
        {name: 'unitTest'}
      ]
    }
  • allowCustomScopes: {boolean, default false}: adds the option custom to scope selection so you can still type a scope if you need.

  • allowEmptyScopes: {boolean, default false}: allow non-selection or not to fill in the scopes.

  • customScopesName: {string, default 'custom scopes'}: custom scopes label in terminal scopes list.

  • emptyScopesName: {string, default 'empty scopes'}: empty scopes label in terminal scopes list.

  • allowBreakingChanges: {Array of Strings: default none}. List of commit types you would like to the question breaking change prompted. Eg.: ['feat', 'fix'].

  • skipQuestions: {Array of Strings: default none}. List of questions you want to skip. Eg.: ['body', 'footer'].

  • skipEmptyScopes: {boolean, default false}: If a chosen type has no scopes declared, skip the scope question

  • appendBranchNameToCommitMessage: If you use cz-custom with cz-customizable-ghooks, you can get the branch name automatically appended to the commit message. This is done by a commit hook on cz-customizable-ghooks. This option has been added on cz-customizable-ghooks, v1.3.0. Default value is true.

  • ticketNumberPrefix: {string, default 'ISSUES CLOSED:'}: Set custom prefix for footer ticker number.

  • breakingPrefix: {string, default 'BREAKING CHANGE:'}: Set a custom prefix for the breaking change block in commit messages.

  • footerPrefix: {string, default 'ISSUES CLOSED:'}: Set a custom prefix for the footer block in commit messages. Set to empty string to remove prefix.

  • breaklineChar: {string, default '|'}: It gets replaced with \n to create the breakline in your commit message. This is supported for fields body and footer at the moment.

  • upperCaseSubject: { boolean, default false }: Capitalizes first subject letter if set to true

  • askForBreakingChangeFirst: { boolean, default false }: It asks for breaking change as first question when set to true

Related tools

  • (https://github.com/commitizen/cz-cli)
  • (https://github.com/leonardoanalista/corp-semantic-release)
  • (https://github.com/semantic-release/semantic-release)
  • (https://github.com/uglow/cz-customizable-ghooks)

GOTCHAS

  • backticks If you wish to have backticks in your content, for example "feat: `string`", the commit preview will be "feat: \`string\`". Don't worry because on your git log will be "feat: `string`" as desired.

  • multiline contents on the body of the message Body is the only place where you can use a pipe to break lines. E.g.: you type this: my items are:| - item01| - item 02, which will become:

my items are:
 - item01
 - item 02

CONTRIBUTING

Contributor Guidelines

  • if you add a new config property, please remember to update files README.md and index.d.ts.
  • add or update relevant tests
  • Favor non-breaking changes when possible
  • Send preliminary PR if you would like to start a discussion

Conduct of Code:

  • Be polite, respectful and understanding that we are all here after working hours spending time to build something useful to all.
  • We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience

Leonardo Correa