Giter Site home page Giter Site logo

commitizen / cz-cli Goto Github PK

View Code? Open in Web Editor NEW
16.4K 81.0 551.0 2.3 MB

The commitizen command line utility. #BlackLivesMatter

Home Page: http://commitizen.github.io/cz-cli/

License: MIT License

JavaScript 97.76% Batchfile 0.04% Shell 2.20%
commitizen javascript commit-hooks node semantic-versioning semantic-release command-line utilities commitizen-adapter git

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

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

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/"
}

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.

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.

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.

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.

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.

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?

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$
`

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!

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.

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.

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.

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.

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.

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

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?

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 ` 

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"

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.

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.

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

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,

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.

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.

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.

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

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

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.

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

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

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?

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.

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.

Need a test suite

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

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>

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.