Skip to content

Commit

Permalink
chore: build dist (#38)
Browse files Browse the repository at this point in the history
* chore: build dist

* fix: CHANGELOG_REG

* chore: build
  • Loading branch information
liweijie0812 authored Oct 17, 2024
1 parent 90fa5fd commit 35b86af
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30012,7 +30012,7 @@ const breakingLabel = ['break', 'breaking', 'breaking changes'];
const featureLabel = ['feature', 'feat', 'enhancement'];
const docsLabel = ['docs', 'doc', 'documentation'];
const refactorLabel = ['pref', 'refactor'];
exports.CHANGELOG_REG = /-\s([A-Z]+)(?:\(([A-Z\s]*)\))?:\s(.+)/gi;
exports.CHANGELOG_REG = /-\s([A-Z]+)(?:\(([A-Z\s_-]*)\))?\s*:\s(.+)/gi;
exports.PULL_NUMBER_REG = /in\shttps:\/\/github\.com\/.+\/pull\/(\d+)/g;
exports.SKIP_CHANGELOG_REG = /\[x\] 本条 PR 不需要纳入 changelog/i;
function getPullNumbers(body) {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const featureLabel = ['feature', 'feat', 'enhancement']
const docsLabel = ['docs', 'doc', 'documentation']
const refactorLabel = ['pref', 'refactor']

export const CHANGELOG_REG = /-\s([A-Z]+)(?:\(([A-Z\s]*)\))?\s*:\s(.+)/gi
export const CHANGELOG_REG = /-\s([A-Z]+)(?:\(([A-Z\s_-]*)\))?\s*:\s(.+)/gi
export const PULL_NUMBER_REG = /in\shttps:\/\/github\.com\/.+\/pull\/(\d+)/g
export const SKIP_CHANGELOG_REG = /\[x\] 本条 PR 不需要纳入 changelog/i
export function getPullNumbers(body: string) {
Expand Down
2 changes: 2 additions & 0 deletions test/__snapshots__/generatorLog.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ exports[`generatorLog > : generatorLogStart 1`] = `
- \`A\`: a bug fix label in fix @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
- \`A\`: a bug fix label in hotfix @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
- \`A\`: a bug fix label in bug @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
- \`CHANGELOG_REG\`: 修复日志冒号前面有空格正则匹配不到 @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
- \`test-test\`: test-test @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
### 📈 Performance
- \`I\`: a refactor label in refactor @liweijie0812 ([#29](https://github.com/TDesignOteam/tdesign-changelog-action/pull/29))
### 📝 Documentation
Expand Down
12 changes: 12 additions & 0 deletions test/__snapshots__/regexp.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ exports[`regexp > : CHANGELOG_REG 1`] = `
undefined,
"test label in test",
],
[
"- fix(CHANGELOG_REG): 修复日志冒号前面有空格正则匹配不到",
"fix",
"CHANGELOG_REG",
"修复日志冒号前面有空格正则匹配不到",
],
[
"- fix(test-test): test-test",
"fix",
"test-test",
"test-test",
],
]
`;

Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const changelog = `
- refactor(I): a refactor label in refactor
- test(J) : test label in test
- test : test label in test
- fix(CHANGELOG_REG): 修复日志冒号前面有空格正则匹配不到
- fix(test-test): test-test
`

export default changelog
4 changes: 2 additions & 2 deletions test/regexp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import releaseNotes from './fixtures/release-notes'
describe('regexp', () => {
it(': CHANGELOG_REG', () => {
const records = changelog.matchAll(/-\s/g)
expect([...records].length).toBe(16)
expect([...records].length).toBe(18)

const result = changelog.matchAll(CHANGELOG_REG)
const arr = [...result]
expect(arr.length).toBe(16)
expect(arr.length).toBe(18)
expect(arr).toMatchSnapshot()
})

Expand Down

0 comments on commit 35b86af

Please sign in to comment.