Zhengqbbb / cz-git

cz-git | czg 🛠️ DX first and more engineered, lightweight, customizable, standard output format Commitizen adapter and CLI
https://cz-git.qbb.sh
MIT License
1.05k stars 39 forks source link

[Bug report] node16、18版本 自定义配置失效 #142

Closed ivestszheng closed 1 year ago

ivestszheng commented 1 year ago

✅ Checklist

📄 System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 2.48 GB / 11.80 GB
  Binaries:
    Node: 16.20.1 - C:\Program Files\nodejs\node.EXE
    npm: 8.19.4 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    commitizen: ^4.2.5 => 4.3.0
    cz-git: ^1.7.0 => 1.7.0

🔎 Description

Concise Description

node v14 可以正常使用我的配置文件,切换到最新的16和18版本,配置文件无法正常生效,我的commitlint.config.js配置如下: // .commitlintrc.js /* @type {import('cz-git').UserConfig} / module.exports = { rules: { // @see: https://commitlint.js.org/#/reference-rules }, prompt: { alias: { fd: "docs: fix typos" }, messages: { type: "Select the type of change that you're committing:", scope: "Denote the SCOPE of this change (optional):", customScope: "Denote the SCOPE of this change:", subject: "Write a SHORT, IMPERATIVE tense description of the change:\n", body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n', breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n', footerPrefixesSelect: "Select the ISSUES type of changeList by this change (optional):", customFooterPrefix: "Input ISSUES prefix:", footer: "List any ISSUES by this change. E.g.: #31, #34:\n", generatingByAI: "Generating your AI commit subject...", generatedSelectByAI: "Select suitable subject by AI generated:", confirmCommit: "Are you sure you want to proceed with the commit above?", }, types: [ { value: "feat", name: "feat: ✨ 新增功能 | A new feature", emoji: ":sparkles:", }, { value: "fix", name: "fix: 🐛 修复缺陷 | A bug fix", emoji: ":bug:", }, { value: "docs", name: "docs: 📝 文档更新 | Documentation only changes", emoji: ":memo:", }, { value: "style", name: "style: 💄 代码格式 | Changes that do not affect the meaning of the code", emoji: ":lipstick:", }, { value: "refactor", name: "refactor: ♻️ 代码重构 | A code change that neither fixes a bug nor adds a feature", emoji: ":recycle:", }, { value: "perf", name: "perf: ⚡️ 性能提升 | A code change that improves performance", emoji: ":zap:", }, { value: "test", name: "test: ✅ 测试相关 | Adding missing tests or correcting existing tests", emoji: ":white_check_mark:", }, { value: "build", name: "build: 📦️ 构建相关 | Changes that affect the build system or external dependencies", emoji: ":package:", }, { value: "ci", name: "ci: 🎡 持续集成 | Changes to our CI configuration files and scripts", emoji: ":ferris_wheel:", }, { value: "chore", name: "chore: 🔨 其他修改 | Other changes that do not modify src or test files", emoji: ":hammer:", }, { value: "revert", name: "revert: ⏪️ 回退代码 | Revert to a commit", emoji: ":rewind:", }, ], useEmoji: true, emojiAlign: "center", useAI: false, aiNumber: 1, themeColorCode: "", scopes: [], allowCustomScopes: true, allowEmptyScopes: true, customScopesAlign: "bottom", customScopesAlias: "custom", emptyScopesAlias: "empty", upperCaseSubject: false, markBreakingChangeMode: false, allowBreakingChanges: ["feat", "fix"], breaklineNumber: 100, breaklineChar: "|", skipQuestions: [], issuePrefixes: [ { value: "closed", name: "closed: ISSUES has been processed" }, ], customIssuePrefixAlign: "top", emptyIssuePrefixAlias: "skip", customIssuePrefixAlias: "custom", allowCustomIssuePrefix: true, allowEmptyIssuePrefix: true, confirmColorize: true, maxHeaderLength: Infinity, maxSubjectLength: Infinity, minSubjectLength: 0, scopeOverrides: undefined, defaultBody: "", defaultIssues: "", defaultScope: "", defaultSubject: "", }, };

Expected behavior

node 版本14、16、18,git cz 时出现都应该是自定义的中英文配置

Steps to reproduce

同上

Screenshots or Screen Recording(if possible)

Snipaste_2023-08-08_15-50-20 Snipaste_2023-08-08_15-58-22 Snipaste_2023-08-08_15-58-48

🔗 Reproduction link / repo:

No response

Zhengqbbb commented 1 year ago
npm uninstall -g git-cz

使用 nvm 切换版本后,出于对版本隔离的要求,会将全局安装的目录也进行切换,导致你切换版本后全局包中根本不是 cz-gitcommitizen


CleanShot 2023-08-08 at 20 21 06@2x