Skip to content

Commit ca0540f

Browse files
committed
chore(repo): fix release script stripping commit message
1 parent 6ad1721 commit ca0540f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

scripts/release.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const commitChanges = async (cwd: string, shortName: string, version: string) =>
5252
await execa('git', params);
5353
};
5454

55-
const getCommits = async (shortName: string, stripScope: string[]) => {
55+
const getCommits = async (shortName: string) => {
5656
log(chalk`{blue Gathering Commits}`);
5757

5858
let params = ['tag', '--list', `${shortName}-v*`, '--sort', '-v:refname'];
@@ -62,8 +62,7 @@ const getCommits = async (shortName: string, stripScope: string[]) => {
6262
log(chalk`{blue Last Release Tag}: ${latestTag || '<none>'}`);
6363

6464
params = ['--no-pager', 'log', `${latestTag}..HEAD`, '--format=%B%n-hash-%n%H🐒💨🙊'];
65-
const scope = stripScope.reduce((prev, strip) => prev.replace(strip, ''), shortName);
66-
const rePlugin = new RegExp(`^[\\w\\!]+\\(([\\w,]+)?${scope}([\\w,]+)?\\)`, 'i');
65+
const rePlugin = new RegExp(`^[\\w\\!]+\\(([\\w,]+)?${shortName}([\\w,]+)?\\)`, 'i');
6766
let { stdout } = await execa('git', params);
6867

6968
if (!stdout) {
@@ -144,7 +143,7 @@ const updateChangelog = (commits: Commit[], cwd: string, shortName: string, vers
144143

145144
for (const { breaking, hash, header, type } of commits) {
146145
const ref = /\(#\d+\)/.test(header as string) ? '' : ` (${hash?.substring(0, 7)})`;
147-
const message = header?.trim().replace(/\(.+\)/, '') + ref;
146+
const message = header?.trim().replace(/\(.+\)!?:/, '') + ref;
148147
if (breaking) {
149148
notes.breaking.push(message);
150149
} else if (type === 'fix') {
@@ -194,7 +193,6 @@ const updatePackage = async (cwd: string, pkg: RepoPackage, version: string) =>
194193
try {
195194
const argv = yargs(process.argv.slice(2));
196195
const packagePath = argv.packagePath || 'packages';
197-
const stripScope = argv.stripScope?.split(',') || [];
198196
const packageName = argv.pkg;
199197
const shortName = packageName.replace(/^@.+\//, '').replace('plugin-', '');
200198
const cwd = join(process.cwd(), `/${packagePath}/`, shortName);
@@ -211,7 +209,7 @@ const updatePackage = async (cwd: string, pkg: RepoPackage, version: string) =>
211209

212210
log(chalk`{cyan Releasing \`${packageName}\`} from {grey packages/${shortName}}\n`);
213211

214-
const commits = await getCommits(shortName, stripScope);
212+
const commits = await getCommits(shortName);
215213

216214
if (!commits.length) {
217215
log(chalk`\n{red No Commits Found}. Did you mean to publish ${packageName}?`);

0 commit comments

Comments
 (0)