From 83c6dae9704ac0e94c6994bd2a20f312a47d9837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20Grammeltvedt?= Date: Fri, 20 Aug 2021 12:06:24 +0200 Subject: [PATCH] Chore commits should map to 'none' type beachball changes --- src/__tests__/changefile/conventionalCommits.test.ts | 3 ++- src/changefile/conventionalCommits.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/__tests__/changefile/conventionalCommits.test.ts b/src/__tests__/changefile/conventionalCommits.test.ts index 08a29b782..306b81e7e 100644 --- a/src/__tests__/changefile/conventionalCommits.test.ts +++ b/src/__tests__/changefile/conventionalCommits.test.ts @@ -2,12 +2,13 @@ import { parseConventionalCommit } from '../../changefile/conventionalCommits'; describe.each<[string, ReturnType]>([ ['fix: change message\nbody', { type: 'patch', message: 'change message' }], - ['chore: change', { type: 'patch', message: 'change' }], + ['chore: change', { type: 'none', message: 'change' }], ['feat: change', { type: 'minor', message: 'change' }], ['feat(scope): change', { type: 'minor', message: 'change' }], ['feat!: change', { type: 'major', message: 'change' }], ['feat(scope)!: change', { type: 'major', message: 'change' }], ['foo', undefined], + ['fix(foo-bar): change', { type: 'patch', message: 'change' }], ])('parse(%s)', (s, expected) => { test('should parse correctly', () => expect(parseConventionalCommit(s)).toEqual(expected)); }); diff --git a/src/changefile/conventionalCommits.ts b/src/changefile/conventionalCommits.ts index 267923494..abc4a6f66 100644 --- a/src/changefile/conventionalCommits.ts +++ b/src/changefile/conventionalCommits.ts @@ -6,7 +6,7 @@ import { ChangeType } from '../types/ChangeInfo'; * 3. breaking * 4. message */ -const COMMIT_RE = /([a-z]+)(?:\(([a-z]+)\))?(!)?: (.+)/; +const COMMIT_RE = /([a-z]+)(?:\(([a-z\-]+)\))?(!)?: (.+)/; interface ConventionalCommit { type: string; @@ -34,8 +34,9 @@ function map(d: ConventionalCommit): Change | undefined { } switch (d.type) { - case 'fix': case 'chore': + return { type: 'none', message: d.message }; + case 'fix': return { type: 'patch', message: d.message }; case 'feat': return { type: 'minor', message: d.message };