Skip to content

Commit

Permalink
feat(plugin-loader): add cz.config.cjs config profiles (#73)
Browse files Browse the repository at this point in the history
`cz.config.js` is provide who not use commitlint
And `cz.config.cjs` is provide ESM project can use CommonJS config profile item

Co-authored-by: Zhengqbbb <1074059947@qq.com>
  • Loading branch information
Zhengqbbb and Zhengqbbb committed Oct 21, 2022
1 parent 46346b4 commit a915085
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 18 deletions.
1 change: 1 addition & 0 deletions docs-zh/config/index.md
Expand Up @@ -90,6 +90,7 @@ module.exports = {
==提示:== 如果你的项目未使用 commitlint,并想使用其他配置文件,可以选择下列配置项

- `cz.config.js`
- `cz.config.cjs`

:::details 点击展开 cz.config.js 完整 默认 配置模板

Expand Down
1 change: 1 addition & 0 deletions docs/config/index.md
Expand Up @@ -90,6 +90,7 @@ module.exports = {
==Tip:== If your project does not use commitlint,and want to use other profiles. You can use the following configuration items

- `cz.config.js`
- `cz.config.cjs`

:::details Click to expand cz.config.js complete default configuration template

Expand Down
1 change: 1 addition & 0 deletions docs/zh/config/index.md
Expand Up @@ -90,6 +90,7 @@ module.exports = {
==提示:== 如果你的项目未使用 commitlint,并想使用其他配置文件,可以选择下列配置项

- `cz.config.js`
- `cz.config.cjs`

:::details 点击展开 cz.config.js 完整 默认 配置模板

Expand Down

This file was deleted.

@@ -0,0 +1,3 @@
module.exports = {
useEmoji: true,
}

This file was deleted.

@@ -0,0 +1,13 @@
const mockUseEmoji = () => process.env.TEST && true
const mockCustomIssuePrefixsAlign = () => {
return new Promise((resolve) => {
setTimeout(() => {
resolve('top')
}, 10)
})
}

module.exports = {
useEmoji: mockUseEmoji,
customIssuePrefixsAlign: mockCustomIssuePrefixsAlign,
}
3 changes: 1 addition & 2 deletions packages/@cz-git/plugin-loader/src/index.ts
Expand Up @@ -110,9 +110,8 @@ export const czLoader = async (cwd?: string) => {
moduleName,
searchPlaces: [
`.${moduleName}rc`,
`.${moduleName}.json`,
`.${moduleName}.js`,
`${moduleName}.config.js`,
`${moduleName}.config.cjs`,
'package.json',
],
packageProp: ['config', 'commitizen'],
Expand Down

3 comments on commit a915085

@br1anchen
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is breaking changes here, it breaks 1.3.11 usage of .cz.js config. Maybe should consider bump major version or stated on changelogs.

@Zhengqbbb
Copy link
Owner Author

@Zhengqbbb Zhengqbbb commented on a915085 Oct 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is breaking changes here, it breaks 1.3.11 usage of .cz.js config. Maybe should consider bump major version or stated on changelogs.

Oh sorry. I should notice it. But I remember my docs not record .cz.js before v1.3.12 .
But anyway I should major the version. Sorry trouble for you.
I will add BREAKCHANGE of changelog

@br1anchen
Copy link

@br1anchen br1anchen commented on a915085 Oct 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry. I should notice it. But I remember my docs not record .cz.js before v1.3.12 . But anyway I should major the version. Sorry trouble for you. I will add BREAKCHANGE of changelog

No big deal, just caught it by surprise. Thanks for your work

Please sign in to comment.