From 87fb70826b149168934da8e8e4487be9b6d29519 Mon Sep 17 00:00:00 2001 From: Mateusz Russak Date: Mon, 13 Mar 2023 13:22:58 +0100 Subject: [PATCH] feat: support for "@" sign in component name --- src/util/pull-request-title.ts | 2 +- test/util/pull-request-title.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/pull-request-title.ts b/src/util/pull-request-title.ts index 375a7eef9..c9df13721 100644 --- a/src/util/pull-request-title.ts +++ b/src/util/pull-request-title.ts @@ -47,7 +47,7 @@ export function generateMatchPattern( .replace('(', '\\(') .replace(')', '\\)') .replace('${scope}', '(\\((?[\\w-./]+)\\))?') - .replace('${component}', ' ?(?[\\w-./]*)?') + .replace('${component}', ' ?(?@?[\\w-./]*)?') .replace('${version}', 'v?(?[0-9].*)') .replace('${branch}', '(?[\\w-./]+)?')}$` ); diff --git a/test/util/pull-request-title.ts b/test/util/pull-request-title.ts index 947b79d2b..263c6b7a8 100644 --- a/test/util/pull-request-title.ts +++ b/test/util/pull-request-title.ts @@ -133,7 +133,7 @@ describe('PullRequestTitle', () => { it('return matchPattern with default Pattern', () => { const matchPattern = generateMatchPattern(); expect(matchPattern).to.eql( - /^chore(\((?[\w-./]+)\))?: release ?(?[\w-./]*)? v?(?[0-9].*)$/ + /^chore(\((?[\w-./]+)\))?: release ?(?@?[\w-./]*)? v?(?[0-9].*)$/ ); }); }); @@ -224,7 +224,7 @@ describe('PullRequestTitle with custom pullRequestTitlePattern', () => { it('parses a complex title and pattern', () => { const pullRequestTitle = PullRequestTitle.parse( - '[HOTFIX] - chore(hotfix/v3.1.0-bug): release 3.1.0-hotfix1 (storage)', + '[HOTFIX] - chore(hotfix/v3.1.0-bug): release 3.1.0-hotfix1 (@example/storage)', '[HOTFIX] - chore${scope}: release ${version} (${component})' ); expect(pullRequestTitle).to.not.be.undefined; @@ -232,7 +232,7 @@ describe('PullRequestTitle with custom pullRequestTitlePattern', () => { expect(pullRequestTitle?.getVersion()?.toString()).to.eql( '3.1.0-hotfix1' ); - expect(pullRequestTitle?.getComponent()).to.eql('storage'); + expect(pullRequestTitle?.getComponent()).to.eql('@example/storage'); }); }); describe('ofVersion', () => { @@ -287,7 +287,7 @@ describe('PullRequestTitle with custom pullRequestTitlePattern', () => { 'chore${scope}: 🔖 release${component} ${version}' ); expect(matchPattern).to.eql( - /^chore(\((?[\w-./]+)\))?: 🔖 release ?(?[\w-./]*)? v?(?[0-9].*)$/ + /^chore(\((?[\w-./]+)\))?: 🔖 release ?(?@?[\w-./]*)? v?(?[0-9].*)$/ ); });