Skip to content

Commit

Permalink
fix(cli): czg export type can not be used (#175)
Browse files Browse the repository at this point in the history
Co-authored-by: Zhengqbbb <Zhengqbbb@users.noreply.github.com>
  • Loading branch information
huxinfeng and Zhengqbbb committed Jun 11, 2024
1 parent 4c6ed1d commit 4fe94cf
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/cli/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ e.g `czg --config="./config/cz.js"`

```js
// config/cz.js
/** @type {import('czg').CommitizenGitOptions} */
/** @type {import('czg').UserConfig['prompt']} */
module.exports = {
maxSubjectLength: 100
// configure ...
Expand Down
2 changes: 1 addition & 1 deletion docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module.exports = {

```js
// cz.config.js
/** @type {import('cz-git').CommitizenGitOptions} */
/** @type {import('cz-git').UserConfig['prompt']} */
module.exports = {
alias: { fd: 'docs: fix typos' },
messages: {
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cli/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const v = site.value.themeConfig.nav?.[4]?.text.slice(1)

```js
// config/cz.js
/** @type {import('czg').CommitizenGitOptions} */
/** @type {import('czg').UserConfig['prompt']} */
module.exports = {
maxSubjectLength: 100
// 配置 ...
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module.exports = {

```js
// cz.config.js
/** @type {import('cz-git').CommitizenGitOptions} */
/** @type {import('cz-git').UserConfig['prompt']} */
module.exports = {
alias: { fd: 'docs: fix typos' },
messages: {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"./package.json": "./package.json"
},
"main": "lib/index.js",
"types": "lib/config.d.ts",
"types": "lib/index.d.ts",
"bin": {
"czg": "bin/index.js",
"git-czg": "bin/index.js"
Expand Down
16 changes: 12 additions & 4 deletions packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@ import { defineConfig } from 'tsup'
import baseConfig from '../../tsup.config'

export default defineConfig((opts) => {
return Object.assign({}, baseConfig, {
dts: './src/shared/types/config.ts',
minify: !opts.watch,
})
return [
{
...baseConfig,
dts: false,
minify: !opts.watch,
},
{
entry: { index: './src/shared/types/config.ts' },
outDir: './lib',
dts: { only: true },
},
]
})
3 changes: 3 additions & 0 deletions packages/cz-git/src/shared/types/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import type { QuestionsType } from '../../generator'
import type { CommitlintUserConfig } from './commitlint'

/** cz-git + commitlint configure */
export interface UserConfig extends CommitlintUserConfig {
/** cz-git configure */
prompt?: CommitizenGitOptions
}

Expand Down Expand Up @@ -167,6 +169,7 @@ export interface GenerateAIPromptType {
diff?: string
}

/** cz-git configure */
export interface CommitizenGitOptions {
/**
* @description: define commonly used commit message alias
Expand Down

0 comments on commit 4fe94cf

Please sign in to comment.