arvinxx / gitmoji-commit-workflow

😉 Gitmoji Commit Workflow
MIT License
211 stars 26 forks source link

能否支持 ESmodule? Can it support ES modules? #671

Closed you-hengh closed 10 months ago

you-hengh commented 10 months ago

开发者你好, Hello developer,

我在使用 vitepress 构建自己的博客,同时使用了仓库的部分提交约束库, 最近 vitepress 最新版本由 commonJS 升级到了 ESmodule, I am using Vitepress to build my own blog, and at the same time, I have used some repository submission constraint libraries. Recently, the latest version of Vitepress has been upgraded from CommonJS to ES module.

要求必须是package.json中配置type:module, The requirement is that type: module must be configured in the package.json file.

我在做出如上配置后, 在提交约束过程中遇到了一些自己无法解决的问题,具体可以看图片所示,在提交的最后一步产生了报错: After making the above configuration, I encountered some problems that I couldn't solve during the submission constraint process. You can see the specific details in the picture below. An error occurred in the last step of submission.

未命名1

package.json

{
  "name": "vitepress",
  "version": "2.0.9",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "dev": "vitepress dev docs --open",
    "build": "vitepress build docs",
    "serve": "vitepress serve docs",
    "prepare": "husky install",
    "cz": "git-cz",
    "clog": "npx standard-version --preset gitmoji-config -i docs/CHANGELOG.md --header '# 更新日志'"
  },
  "config": {
    "commitizen": {
      "path": "node_modules/cz-message-helper"
    },
    "cz-message-helper": {
      "config": ".cz-message.cjs"
    },
    "commitlint": {
      "extends": [
        "gitmoji"
      ]
    },
    "changelog": {
      "titleLanguage": "zh-CN"
    }
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@algolia/client-search": "^4.17",
    "@types/node": "^18.15.11",
    "commitizen": "^4.3.0",
    "commitlint": "^17.6.6",
    "commitlint-config-gitmoji": "^2.3.1",
    "conventional-changelog-gitmoji-config": "^1.5.2",
    "cz-message-helper": "^1.3.0",
    "husky": "^8.0.0",
    "standard-version": "^9.5.0",
    "vitepress": "^1.0.0-rc.4"
  },
  "dependencies": {
    "markdown-it-footnote": "^3.0.3",
    "markdown-it-task-checkbox": "^1.0.6",
    "medium-zoom": "^1.0.8"
  }
}

System Info

System:
    OS: macOS 13.5
    CPU: (10) arm64 Apple M1 Max
    Memory: 7.17 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.16.0 - ~/Library/pnpm/node
    npm: 9.5.1 - ~/Library/pnpm/npm
    pnpm: 8.6.3 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 115.0.5790.170
    Safari: 16.6
  npmPackages:
    vitepress: 1.0.0-rc.4 => 1.0.0-rc.4

希望能修复这个报错,让我正常提交代码, 如果还需要任何信息,可以随时回复. I hope to fix this error so that I can submit the code normally. If any further information is needed, please feel free to reply.

you-hengh commented 10 months ago

问题解决了, 把.commitlintrc.js文件名改为.commitlintrc.cjs,然后删除在 package 中的commitlint配置即可