Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration file needs the path. #816

Closed
2 of 3 tasks
chienweiluo opened this issue Aug 18, 2023 · 4 comments
Closed
2 of 3 tasks

Configuration file needs the path. #816

chienweiluo opened this issue Aug 18, 2023 · 4 comments

Comments

@chienweiluo
Copy link

chienweiluo commented Aug 18, 2023

Type

  • Content inaccurate
  • Content missing
  • Typo

URL

https://commitizen-tools.github.io/commitizen/customization/

Description

I am stuck in the customization message template. So I looked into the ConfigPage and the CustomizePage.

Then I create a .cz.json in my home directory. like the example in these pages.

{
  "commitizen": {
    "name": "cz_conventional_commits",
    "version": "0.1.0",
    "version_files": ["src/__version__.py", "pyproject.toml:version"],
    "style": [
      ["qmark", "fg:#ff9d00 bold"],
      ["question", "bold"],
      ["answer", "fg:#ff9d00 bold"],
      ["pointer", "fg:#ff9d00 bold"],
      ["highlighted", "fg:#ff9d00 bold"],
      ["selected", "fg:#cc5454"],
      ["separator", "fg:#cc5454"],
      ["instruction", ""],
      ["text", ""],
      ["disabled", "fg:#858585 italic"]
    ],
    "customize": {
      "message_template": "[{{change_type}}]:{% if show_message %} {{message}}{% endif %}",
      "example": "feature: this feature enable customize through config file",
      "schema": "<type>: <body>",
      "schema_pattern": "(feature|bug fix):(\\s.*)",
      "bump_pattern": "^(break|new|fix|hotfix)",
      "bump_map": {
          "break": "MAJOR",
          "new": "MINOR",
          "fix": "PATCH",
          "hotfix": "PATCH"
      },
      "change_type_order": ["BREAKING CHANGE", "feat", "fix", "refactor", "perf"],
      "info_path": "cz_customize_info.txt",
      "info": "This is customized info",
      "commit_parser": "^(?P<change_type>feature|bug fix):\\s(?P<message>.*)?",
      "changelog_pattern": "^(feature|bug fix)?(!)?",
      "change_type_map": {"feature": "Feat", "bug fix": "Fix"},
      "questions": [
          {
              "type": "list",
              "name": "change_type",
              "choices": [
                  {
                      "value": "feature",
                      "name": "feature: A new feature."
                  },
                  {
                      "value": "bug fix",
                      "name": "bug fix: A bug fix."
                  }
              ],
              "message": "Select the type of change you are committing"
          },
          {
              "type": "input",
              "name": "message",
              "message": "Body."
          },
          {
              "type": "confirm",
              "name": "show_message",
              "message": "Do you want to add body message in commit?"
          }
      ]
  }
  }
}

But when I git cz like usual doing, it threw the error The "path" argument must be of type string. Received undefined.

and If I tried to use the cz_customize as the -n argument(Customization page mentioned), it threw error: pathspec 'cz_customize' did not match any file(s) known to git

Actually, the only thing I want to do is making the commit message

from
"feat(scope): message"
to
"[feat] message"

thanks in advance.

@Lee-W
Copy link
Member

Lee-W commented Aug 20, 2023

undefined looks like a JavaScripts thing. Could you please make sure you're using python commitizen again? I failed to reproduce it. You can also use git cz version -r to provide us with more information

@chienweiluo
Copy link
Author

chienweiluo commented Aug 25, 2023

sorry for the late reply.

Just tried the git cz & git cz version -r. But this error might caused by the "path" in .cz.json.
After I add the "path": "zzz" in .cz.json, it throws Could not resolve zzz. Cannot find module 'zzz' ,this means that the config works.
截圖 2023-08-26 上午3 27 54

And If I delete this file. it would works as usual.

deps

another one.
截圖 2023-08-26 上午3 20 45
截圖 2023-08-26 上午3 29 23

@Lee-W
Copy link
Member

Lee-W commented Aug 26, 2023

I think what you're using is https://github.com/commitizen/cz-cli instead of this project. I'll close it for now. But feel free to reopen it if you think there's more to discuss 🙂

@Lee-W Lee-W closed this as completed Aug 26, 2023
@chienweiluo
Copy link
Author

okay. sorry for the misleading. I've accomplished my deal by customizing git-cz. thanks for the response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants