Skip to content

Commit 32e6fd5

Browse files
committed
fix: commit message length
1 parent 34799a7 commit 32e6fd5

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

src/publish.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import fs from 'node:fs';
2+
import os from 'node:os';
3+
import path from 'node:path';
14
import chalk from 'chalk';
25
import { execa } from 'execa';
36
import open from 'open';
@@ -31,8 +34,20 @@ async function bumpVersionAndTag(opts: ReleaseOptions) {
3134

3235
await run('git add -A', { dryRun });
3336

34-
const tags = pkgs.map(s => getGitTagVersion(s.name, s.version, opts));
35-
await run(`git commit -m "chore: release ${tags.join(', ')}"`, { dryRun });
37+
// git commit message
38+
const tags = pkgs.map(s => getGitTagVersion(s.name, s.newVersion, opts));
39+
let msg = `chore: release ${tags.length > 1 ? `${tags.length} packages` : `${tags[0]}`}`;
40+
if (pkgs.length > 1) {
41+
msg += `\n\n`;
42+
msg += pkgs.map(s => `${s.name}: ${s.version} => ${s.newVersion}`).join('\n');
43+
}
44+
45+
const msgFile = path.join(os.tmpdir(), `tomjs-release-${Date.now()}.txt`);
46+
fs.writeFileSync(msgFile, msg);
47+
48+
await run([`git commit --file "${msgFile}"`], { dryRun });
49+
50+
fs.rmSync(msgFile);
3651

3752
for (const tag of tags) {
3853
await run(`git tag ${tag}`, { dryRun });

0 commit comments

Comments
 (0)