Giter VIP home page Giter VIP logo

cz-cli's Introduction

Commitizen for contributors

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 (though that can still be helpful). 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.

Backers on Open Collective Sponsors on Open Collective travis.ci Azure Build Status codecov.io npm monthly downloads current version semantic-release commitizen on stackoverflow

Installing the command line tool

Commitizen is currently tested against Node.js 12, 14, & 16, although it may work in older versions of Node.js. You should also have npm 6 or greater.

Installation is as simple as running the following command (if you see EACCES error, reading fixing npm permissions may help):

npm install -g commitizen

Using the command line tool

If your repo is Commitizen friendly:

Simply use git cz or just cz instead of git commit when committing. You can also use git-cz, which is an alias for cz.

Alternatively, if you are using npm 5.2+ you can use npx instead of installing globally:

npx cz

or as an npm script:

  ...
  "scripts": {
    "commit": "cz"
  }

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 standards defined by project maintainers.

Add and commit with Commitizen

If your repo is NOT Commitizen friendly:

If you're not working in a Commitizen-friendly repository, then git cz will work just the same as git commit, but npx cz will use the streamich/git-cz adapter. To fix this, you need to first make your repo Commitizen friendly

Making your repo Commitizen friendly

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 CLI tools:

npm install commitizen -g

Next, initialize your project to use the cz-conventional-changelog adapter by typing:

# npm
commitizen init cz-conventional-changelog --save-dev --save-exact

# yarn
commitizen init cz-conventional-changelog --yarn --dev --exact

# pnpm
commitizen init cz-conventional-changelog --pnpm --save-dev --save-exact

Note that if you want to force install over the top of an old adapter, you can apply the --force argument. For more information on this, just run commitizen help.

The above command does three things for you:

  1. Installs the cz-conventional-changelog adapter npm module
  2. Saves it to package.json's dependencies or devDependencies
  3. Adds the config.commitizen key to the root of your package.json file as shown here:
...
  "config": {
    "commitizen": {
      "path": "cz-conventional-changelog"
    }
  }

Alternatively, Commitizen configs may be added to a .czrc file:

{
  "path": "cz-conventional-changelog"
}

This just tells Commitizen which adapter we actually want our contributors to use when they try to commit to this repo.

commitizen.path is resolved via require.resolve and supports:

  • npm modules
  • directories relative to process.cwd() containing an index.js file
  • file base names relative to process.cwd() with .js extension
  • full relative file names
  • absolute paths

Please note that in the previous version of Commitizen we used czConfig. czConfig has been deprecated, and you should migrate to the new format before Commitizen 3.0.0.

Optional: Install and run Commitizen locally

Installing and running Commitizen locally allows you to make sure that developers are running the exact same version of Commitizen on every machine.

Install Commitizen with npm install --save-dev commitizen.

On npm 5.2+ you can use npx to initialize the conventional changelog adapter:

npx commitizen init cz-conventional-changelog --save-dev --save-exact

For previous versions of npm (< 5.2) you can execute ./node_modules/.bin/commitizen or ./node_modules/.bin/cz in order to actually use the commands.

You can then initialize the conventional changelog adapter using: ./node_modules/.bin/commitizen init cz-conventional-changelog --save-dev --save-exact

And you can then add some nice npm scripts in your package.json file pointing to the local version of Commitizen:

  ...
  "scripts": {
    "commit": "cz"
  }

This will be more convenient for your users because then if they want to do a commit, all they need to do is run npm run commit and they will get the prompts needed to start a commit!

NOTE: If you are using precommit hooks thanks to something like husky, you will need to name your script something other than "commit" (e.g. "cm": "cz"). The reason is because npm scripts has a "feature" where it automatically runs scripts with the name prexxx where xxx is the name of another script. In essence, npm and husky will run "precommit" scripts twice if you name the script "commit", and the workaround is to prevent the npm-triggered precommit script.

Optional: Running Commitizen on git commit

This example shows how to incorporate Commitizen into the existing git commit workflow by using git hooks and the --hook command-line option. This is useful for project maintainers who wish to ensure the proper commit format is enforced on contributions from those unfamiliar with Commitizen.

Once either of these methods is implemented, users running git commit will be presented with an interactive Commitizen session that helps them write useful commit messages.

NOTE: This example assumes that the project has been set up to use Commitizen locally.

Traditional git hooks

Update .git/hooks/prepare-commit-msg with the following code:

#!/bin/bash
exec < /dev/tty && node_modules/.bin/cz --hook || true
Husky

For husky users, add the following configuration to the project's package.json file:

"husky": {
  "hooks": {
    "prepare-commit-msg": "exec < /dev/tty && npx cz --hook || true"
  }
}

Why exec < /dev/tty? By default, git hooks are not interactive. This command allows the user to use their terminal to interact with Commitizen during the hook.

Congratulations! Your repo is Commitizen friendly. Time to flaunt it!

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:

Commitizen friendly

It may also make sense to change your README.md or CONTRIBUTING.md files to include or link to the Commitizen project so that your new contributors may learn more about installing and using Commitizen.

Conventional commit messages as a global utility

Install commitizen globally, if you have not already.

npm install -g commitizen

Install your preferred commitizen adapter globally (for example cz-conventional-changelog).

npm install -g cz-conventional-changelog

Create a .czrc file in your home directory, with path referring to the preferred, globally-installed, commitizen adapter

echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc

You are all set! Now cd into any git repository and use git cz instead of git commit, and you will find the commitizen prompt.

Pro tip: You can use all the git commit options with git cz. For example: git cz -a.

If your repository is a Node.js project, making it Commitizen friendly is super easy.

If your repository is already Commitizen friendly, the local commitizen adapter will be used, instead of globally installed one.

Commitizen for multi-repo projects

As a project maintainer of many projects, you may want to standardize on a single commit message format for all of them. You can create your own node module which acts as a front-end for Commitizen.

1. Create your own entry point script

// my-cli.js

#!/usr/bin/env node
"use strict";

const path = require('path');
const bootstrap = require('commitizen/dist/cli/git-cz').bootstrap;

bootstrap({
  cliPath: path.join(__dirname, '../../node_modules/commitizen'),
  // this is new
  config: {
    "path": "cz-conventional-changelog"
  }
});

2. Add the script to your package.json file

// package.json

{
  "name": "company-commit",
  "bin": "./my-cli.js",
  "dependencies": {
    "commitizen": "^2.7.6",
    "cz-conventional-changelog": "^1.1.5"
  }
}

3. Publish it to npm and use it!

npm install --save-dev company-commit

./node_modules/.bin/company-commit

Adapters

We know that every project and build process has different requirements, so we've tried to keep Commitizen open for extension. You can do this by choosing from any of the pre-built adapters or even by building your own. Here are some of the great adapters available to you:

To create an adapter, just fork one of these great adapters and modify it to suit your needs. We pass you an instance of Inquirer.js, but you can capture input using whatever means necessary. Just call the commit callback with a string and we'll be happy. Publish it to npm, and you'll be all set!

Retrying failed commits

As of version 2.7.1, you may attempt to retry the last commit using the git cz --retry command. This can be helpful when you have tests set up to run via a git precommit hook. In this scenario, you may have attempted a Commitizen commit, painstakingly filled out all of the commitizen fields, but your tests fail. In previous Commitizen versions, after fixing your tests, you would be forced to fill out all of the fields again. Enter the retry command. Commitizen will retry the last commit that you attempted in this repo without you needing to fill out the fields again.

Please note that the retry cache may be cleared when upgrading Commitizen versions, upgrading adapters, or if you delete the commitizen.json file in your home or temp directory. Additionally, the commit cache uses the filesystem path of the repo, so if you move a repo or change its path, you will not be able to retry a commit. This is an edge case but might be confusing if you have scenarios where you are moving folders that contain repos.

It is important to note that if you are running cz from an npm script (let's say it is called commit) you will need to do one of the following:

  • Pass -- --retry as an argument for your script. i.e: npm run commit -- --retry
  • Use npx to find and call the cz executable directly. i.e: npx cz --retry

Note that the last two options do not require you to pass -- before the args but the first does.

Commitizen for project maintainers

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.

Go further

Commitizen is great on its own, but it shines when you use it with some other amazing open source tools. Kent C. Dodds shows you how to accomplish this in his Egghead.io series, How to Write an Open Source JavaScript Library. Many of the concepts can be applied to non-JavaScript projects as well.

Philosophy

About 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.

Commitizen or Commit Hooks

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-changelog adapter.

Related projects

Authors and Contributors

@JimTheDev (Jim Cummins, author) @kentcdodds @accraze @kytwb @Den-dp

Special thanks to @stevelacy, whose gulp-git project makes commitizen possible.

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

cz-cli's People

Contributors

andreasolund avatar berkmann18 avatar chenaski avatar ctrlplusb avatar d4rkr00t avatar dependabot[bot] avatar dmwelch avatar example123 avatar fastfrwrd avatar faust64 avatar felipecrs avatar giocodes avatar greenkeeperio-bot avatar hassankhan avatar hxzhao527 avatar jasonglassbrook avatar jimthedev avatar linusu avatar marionebl avatar prayagverma avatar renovate-bot avatar renovate[bot] avatar revelt avatar sarbbottam avatar slkennedy avatar ssilve1989 avatar tal-rofe avatar thawkin3 avatar travi avatar urg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cz-cli's Issues

Can commitizen be pre-compiled?

Right now we're using babel/register to run everything in commitizen and to get ES6 features. I'm doing this because I need to be able to require() adapters on the fly but still get the features of ES6. I'd love for most of the cli to be pre-built with babel, leaving only the adapter part to using babel/register. This would help git-cz to be faster. I've never done this before and am not even sure if it is possible. Any help would be great.

Set custom scope changes.

Hi, thanks for this awesome project.

I am curious, is it possible to override Denote the scope of this change ($location, $browser, $compile, etc.): message?
Would be great to preset scopes for projects.

Use npm's config object, deprecate czConfig

Per @killswitch and @kentcdodds in this original issue. We should be using npm's config object and not our own key. We want to be good package.json citizens after all. 👍

The main reason that this bad practice exists is that config loader originally came from jscs and thus followed their perhaps naive convention. The good news is we can easily add it and migrate to it being the default because their loader is pretty robust.

Things needed for this to happen:

  • Need to add some more robust tests to areas of the codebase that would be impacted by this change.
  • Add config.cz as the highest level priority option in the configLoader (note, we still need to support czConfig for now, but can add a deprecation warning in the cli to get people to switch)
  • Change commitizen init to use the config.cz location by default to encourage new adoption.
  • Change the docs to reflect this change
  • Add deprecation warning to cli, potentially even put in PRs on gh.

EDIT: Created a new ticket for removing czConfig in 3.0.0 per @kentcdodds

Hooray!

It doesn't work in a yeoman generated project

I installed and configured the cz-cli into a git project generated by yeoman (yeoman polymer).

Running git cz works fine until after the last questions that lunch yeoman generator. Here is an example of the process:

$ yo polymer myApp

     _-----_
    |       |    .--------------------------.
    |--(o)--|    | Out of the box I include |
   `---------´   |    Polymer Starter Kit   |
    ( _´U`_ )    '--------------------------'
    /___A___\    
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

? Would you like to include web-component-tester? No
? Would you like to include recipe docs? No
[…]
I'm all done. Running *npm install & bower install* for you to install the required dependencies. If this fails, try running the command yourself.
[…]
$ commitizen init cz-conventional-changelog --save --save-exact
$ git add .
$ git cz
[email protected], [email protected]


Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.

? Select the type of change that you're committing: chore:    Changes to the build process or auxiliary tools
            and libraries such as documentation generation
? Denote the scope of this change ($location, $browser, $compile, etc.):
 *
? Write a short, imperative tense description of the change:
 Scafold built with `yo polymer`
? Provide a longer description of the change:
 Setp up the project (Polymer Starter Kit) using yeoman generator 
? List any breaking changes or issues closed by this change:


     _-----_
    |       |    .--------------------------.
    |--(o)--|    | Out of the box I include |
   `---------´   |    Polymer Starter Kit   |
    ( _´U`_ )    '--------------------------'
    /___A___\    
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

Allow specifying adaptor module, not path

Why do we load a path to an adaptor and not an actual module? I like to distribute the commitizen with my pre-git module as pre-git dependency by default. But commitizen cannot find the adaptor path

"czConfig": {
    "path": "node_modules/cz-conventional-changelog"
}

This breaks between npm 2 and 3 - npm3 seems to flatten paths, while npm2 leaves the paths nested.
I believe it would be better to just require the adaptor by name, rather than use node_modules path, or at least check if the path resolves or not.

package.json formatting

When I run commitizen init cz-conventional-changelog --save --save-exact the cz-conventional-changelog is added to package.json as promised, but my package.json is modified in such a way that all whitespace is gone. So there is only a very long line.

I'm not sure if this also happens with other commands.

Error: ReferenceError: Map is not defined

`

:uname -ra

Linux 3.13.0-76-generic #120-Ubuntu SMP Mon Jan 18 15:58:41 UTC 2016 i686 i686 i686 GNU/Linux

#:npm install -g commitizen

#:/Project/t$ sudo commitizen init cz-conventional-changelog --save --save-exact --force
Attempting to initialize using the npm package cz-conventional-changelog
Error: ReferenceError: Map is not defined
#:
/Project/SyncClient$
`

Great idea

Hi @jimthedev , Thanks for this module. The idea is really great. But I want to use a different approach to do this so I might just create another one. We could eventually merge in the future though. Will let you know once mine is done. Thanks.

Upgrade to babel 6

#49

To fix this PR we need to update our mocha command needs an update to the compiler flags:

What was this: js:babel/register

Needs to be this: js:babel-core/register

Use git cz globally, in non-npm / non-javascript projects

Big fan of commitizen here. In so much that I'm trying to use it for projects that are not part of the NPM/node/javascript ecosystem. Any git repository, that is.

I can't get that scenario to work. I've installed commitizen, conventional-changelog, cz-conventional-changelog globally with -g, but running git cz fails (and falls back to regular git) because the adapter is either not found, or not loaded. No surprise here I guess, since there is no package.json file, and there won't be one in that repo. Would it be possible to provide a global configuration file, say ~/.czconfig, that the CLI would use when all else fails?

Thanks

es6 string syntax (backticks) throwing error after clean install

I've tried using node v0.10.37 (which I figured wasn't likely to work after seeing the backticks) and v0.12.2 (via nvm).. but no matter what i try I can't get git cz to execute successfully.

error:

Potentially unhandled rejection [2] evalmachine.<anonymous>:80
      commit(`${answers.type}(${answers.scope}): ${answers.subject}`.slice(0,
             ^
SyntaxError: Unexpected token ILLEGAL
    at Object.exports.runInThisContext (vm.js:73:16)
    at doEval (/Users/rai/.nvm/versions/v0.12.2/lib/node_modules/commitizen/node_modules/systemjs/dist/system.src.js:2330:10)
    at __eval (/Users/rai/.nvm/versions/v0.12.2/lib/node_modules/commitizen/node_modules/systemjs/dist/system.src.js:2247:7)
    at Loader.exec [as __exec] (/Users/rai/.nvm/versions/v0.12.2/lib/node_modules/commitizen/node_modules/systemjs/dist/system.src.js:339:5)
    at load.metadata.execute (/Users/rai/.nvm/versions/v0.12.2/lib/node_modules/commitizen/node_modules/systemjs/dist/system.src.js:1182:16)
    at linkDynamicModule (/Users/rai/.nvm/versions/v0.12.2/lib/node_modules/commitizen/node_modules/systemjs/dist/system.src.js:668:32)
    at link (/Users/rai/.nvm/versions/v0.12.2/lib/node_modules/commitizen/node_modules/systemjs/dist/system.src.js:528:11)
    at Object.execute (/Users/rai/.nvm/versions/v0.12.2/lib/node_modules/commitizen/node_modules/systemjs/dist/system.src.js:842:11)
    at doDynamicExecute (/Users/rai/.nvm/versions/v0.12.2/lib/node_modules/commitizen/node_modules/systemjs/node_modules/es6-module-loader/dist/es6-module-loader.src.js:1938:25)
    at link (/Users/rai/.nvm/versions/v0.12.2/lib/node_modules/commitizen/node_modules/systemjs/node_modules/es6-module-loader/dist/es6-module-loader.src.js:1986:24)

my .cz.json

{
"path": "node_modules/cz-conventional-changelog/"
}

Ability to re-run a commit if it fails

Sometimes, when a pre_commit hook is configured, our commit will fail. It would be helpful to have a way to pass something like --retry so we won't need to enter the message again.

Add common troubleshooting steps

There are a set of steps that would probably be useful in troubleshooting problems with Commitizen and Adapters. Over time it would be nice to have a place for them to be documented rather than being stuck in issues.

It doesn't work

>(release +) git cz
/Users/ADoyle/.nvm/versions/node/v0.12.2/lib/node_modules/commitizen/src/cli/git-cz.js:1
(function (exports, require, module, __filename, __dirname) { import {configLo
                                                              ^^^^^^
SyntaxError: Unexpected reserved word
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Module._extensions..js (module.js:478:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/ADoyle/.nvm/versions/node/v0.12.2/lib/node_modules/commitizen/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:214:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/ADoyle/.nvm/versions/node/v0.12.2/lib/node_modules/commitizen/bin/git-cz.js:3:1)
    at Module._compile (module.js:460:26)

Versions:
node v0.12.2
npm 2.13.3
commitizen 2.0.1

NPM@3 support

Npm's flat modules break existing commitizen functionality. In order to fix these issues there needs to be some major architectural changes in Commitizen 2 and in the adapters.

Module process?

Hi, just tried this and had:

Error: Cannot find module 'process'

Why are you requiring process? It's a global module (and variable!) and should be available without the use of require.

Usage in non-node projects?

Hi,
I'm happy to meet this tool. While running

commitizen init cz-conventional-changelog --save --save-exact

I got package.json Not Found, but you know, git is a generic version control system and has been applied to many non-node projects, so any suggestions of using this in non-node projects?

Cheers,

Should nodemon be a dep instead of devdep?

I've not looked at this in detail yet, but when I installed a package that had commitizen as a devDependencies it also appeared to install nodemon - which is (I suspect) used for development in commitizen.

So should nodemon be moved to devDependencies instead of dependencies?

Need a test suite

There is currently no test suite for commitizen or a way for adapters to smoke test.

Remove node 0.10 support from test suite

Node is now LTS on 4. We're going to support back to 0.12 even though 0.10 should work. Moving forward we'll no longer be testing 0.10 so please use it at your own risk.

Is it possible to get branch name in a adapter?

Hi,

First of all, great project!

Is it possible to pass information about a branch (or some other git information) to an custom adapter?

I find this line: https://github.com/commitizen/cz-cli/blob/master/src/cli/strategies/git-cz.js#L59 where it looks like you are passing all arguments to git(?). Is it possible to parse the arguments and exclude cz-cli-specific arguments and pass them to a adapter?

Example:

$ git cz --author="Name <email>" --cz-branch-name="$(git rev-parse --abbrev-ref HEAD)"

The command above should pass --author to git commit and --cz-branch-name to the adapter (because the argument starts with --cz-).

What do you think? Is this a good solution? Or is it a better way?

Long term goal: Integrate with various Git GUIs

Would be great it we could provide a way for git GUIs to inject themselves in the place of inquirer so that they could use their own GUIs to ask users for prompts. This might be a pie in the sky idea but it would be pretty freaking cool.

Add adapters-repo hooks

As an adapter author, I want to be able to have my adapter be configurable (data) and also be able to tap into hook functions (events). I want repo maintainers to be able to define paths to hooks in a similar manor to what we let adapter maintainers do in the commitizen cli-adapter relationship. In the cli-adapter relationship there is really just one hook (prompter) that runs the prompter method of the adapter. Ideally we'd have more hooks available to allow the cli-adapter-repo chain to be solid and configurable.

I would imagine that both the cli-adapter and the adapter-repo relationship need more hooks to be effective. I'm not really sure exactly what points people would want to tap into but this is something I'd love to hear more about from adapter maintainers.

Specifically, if I maintain cz-conventional-widgets, I might decide that I want someone who maintains the AwesomeWidgetBuilder repo to be able to define the following in their package.json:

{
  config: {
    commitizen: {

      // HOOKS: All hooks are exports of one file, hooks is an array, with index 0 being the path
      hooks: ['myfile.js', 'init', 'bootstrap'];

      // -- OR --

      // HOOKS: Each hook is in its own file, hooks is an object
      hooks: {

        // SIMPLE HOOK ITEMS: the exported bootstrap method gets run from myRepoCzSettings.js
        "bootstrap": "./myRepoCzBootstrap.js",
        "end": "./myRepoCzEnd.js",

        // -- OR --

        // ADVANCED HOOK ITEMS: an object is used and we call mySweetInitFunction in the init hook
        "init": {
          path: "./myCzRepoInit.js",
          function: "mySweetInitFunction"
        }

      }
    }
  }
}

This way my adapter and any other adapters that follow my interface can make calls into the repo paths and expect to get data back from the repo.

Note that because the config paths are not scoped to a specific adapter but rather to a series of hooks, an adapter that uses a different commit style could still implement the interface and serve the repo owner. Specifically, if I use the widgetReader interface hooks then I can use either cz-conventional-changelog or cz-smart-commit without having an issue so long as the adapters follow the interface an calls certain hooks at expected times in the execution flow.

Cannot find module 'lodash' on latest version 2.4.3

node version 4.2.2

install the latest: npm install -g commitizen

modify and add some files then run: git cz

you get:

module.js:339
    throw err;
    ^

Error: Cannot find module 'lodash'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/leonardo/.nvm/versions/v4.2.2/lib/node_modules/commitizen/dist/commitizen/adapter.js:23:15)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)

I downgraded to version 2.1.0 and works fine.

cheers
Leonardo Correa

Multiline description

I can not figure a way to make easily multiline description in the commitizen promt.
Do you have a clever way to do it?

Thanks.

Make `.cz.json` part of package.json

This project looks very promising, thank your for this!
What shies me away as a maintainer is that I have to add another dotfile to my repository.
As the .cz.json is mostly one line, and also json, it would be nice if commitizen could just look up a "cz" field the package.json.

What do you think?

(Sorry if I missed the a previous discussion on this, couldn't find one.)

Gracefully handle cli and adapter incompatibilities

Brainstorming:

As commitizen iterates, as a user I want to be notified when there is an adapter/cli incompatibility.

  • Decide how adapters can communicate their cli version requirements. (semver in package.json)
  • How best do we communicate an incompatibility? prompt to update, notify only?
  • What if an adapter wants users to be able to specify parameters in their package's config.commitizen per mapbox/cz-mapbox-changelog#2
  • Create and document a more robust programmatic spec for adapters

How to add custom commit types?

Is it possible to create new type(scope): title... commit types? We're using this in tandem with clog and we have some custom commit types defined for the changelog.

Error with quote `

? Write a short, imperative tense description of the change:
 \`myUp\` is still false after upping

or

? Write a short, imperative tense description of the change:
 `myUp` is still false after upping

They make no sense.

Remove deprecated czConfig

#30 added deprecation warnings and switched defaults over to using config.commitizen in package.json. We just need to remove the deprecated code for 3.0.0 but this'll be a breaking change.

clear confusion

when i run commitizen init cz-conventional-changelog --save --save-exact i get this output

Attempting to initialize using the npm package cz-conventional-changelog

********
WARNING: You are using czConfig in your package.json. czConfig will be deprecated in Commitizen 3. 
Please use this instead:
{
  "config": {
    "commitizen": {
      "path": "./path/to/adapter"
    }
  }
}
For more information, see: http://commitizen.github.io/cz-cli/
********

npm WARN install Couldn't install optional dependency: Unsupported
[email protected] /home/oussama/Desktop/IContribute
└─┬ [email protected] 
  └── [email protected] 

the message say, Please use this instead but the suggested config is the same in package.json, also what is the optional dependency?

Jira smart commits?

This is super awesome. Would it be possible to add custom prompts or something so I could use this to help me with Jira smart commits. Basically I'd like to have prompts that ask for:

  • Jira Issue Key (this sort of exists currently, though I think the issue key needs to appear first in the message)
  • Time spent
  • Workflow command (testing, closed, etc.)
  • Comment (this could just use what's existing currently, but use the proper command)

This would be super awesome if we could add this.

Does not work after npm i and package config

Hi!

TLDR; IRFM, ran it, then tried to run git cz, it failed with an unfortunate but epic error,

D:\work\MyBlog\C\c2-bin>git cz
module.js:338
    throw err;
          ^
Error: Cannot find module 'D:\work\MyBlog\C\c2-bin\node_modules\commitizen\bin\git-cz'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

The longer story

Running windows 7 with node and npm such

D:\work\MyBlog\C\c2-bin>npm -v
2.11.3

D:\work\MyBlog\C\c2-bin>node -v
v0.12.7

I have run D:\work\MyBlog\C\c2-bin>npm install -g commitizen,
then D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save --save-exact

Then i configured my local package.json file to add

  ,"config": {
    "commitizen": {
      "path": "node_modules/cz-conventional-changelog"
    }
  }

Where did i get it wrong ?

Thanks !


D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save --save-exact
Attempting to initialize using the npm package cz-conventional-changelog
Error: A previous adapter is already configured. Use --force to override

D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save --save-exact --force
Attempting to initialize using the npm package cz-conventional-changelog
npm WARN using --force I sure hope you know what you are doing.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] license should be a valid SPDX license expression
[email protected] node_modules\cz-conventional-changelog
└── [email protected]
{this.config was unexpected at this time.

D:\work\MyBlog\C\c2-bin>  "C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\node_modules\.bin\\node.exe"  "C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\node
_modules\.bin\\..\json\lib\json.js" -I -f D:\work\MyBlog\C\c2-bin\package.json -e 'if(!this.config) {this.config={};}; if(!this.config.commitizen) { this.config.commitizen={};}
; this.config.commitizen.path="./node_modules/cz-conventional-changelog"'

D:\work\MyBlog\C\c2-bin>git cz
module.js:338
    throw err;
          ^
Error: Cannot find module 'D:\work\MyBlog\C\c2-bin\node_modules\commitizen\bin\git-cz'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

D:\work\MyBlog\C\c2-bin>

How do you --amend?

How does one use git-cz to amend a commit message? It does not seem to be handling extra arguments.

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean
$ git-cz -a --amend
[...]
✗ Commit failed. Did you forget to 'git add' your files?

Thank you

npm run test:watch infinite loop

When you run tests the first test that runs triggers nodemon to rerun the test suite again so the test suite never completes.

feat: use existing message

if git cz is passed the argument -m then that message should be passed to the "short imperative tense description of the change"

Log githook output

I have a pre-commit hook that runs eslint. I don't see any output from eslint when that is running when using commitizen. Any idea why that is?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.