Skip to content

Commit d088f76

Browse files
committed
[#19] Modify getFilteredCommitMessages and createReleaseForTags to include packageName in release notes
1 parent b50f87a commit d088f76

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

canary-publish/dist/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53392,6 +53392,8 @@ function main() {
5339253392
createRelease &&
5339353393
(yield (0, publish_1.createReleaseForTags)({
5339453394
packageData: publishedPackages.map(({ name, version }) => ({
53395+
name,
53396+
version,
5339553397
tag: `${name}@${version}`,
5339653398
packagePath: packagePathByName[name],
5339753399
})),
@@ -53667,7 +53669,7 @@ function getPublishedPackageInfos({ packagesDir, execOutput, language, }) {
5366753669
/**
5366853670
* changeset 변경 파일 커밋만 제외하고 작업 커밋 로그만 추출
5366953671
*/
53670-
function getFilteredCommitMessages({ baseSha, headSha, packagePath, }) {
53672+
function getFilteredCommitMessages({ baseSha, headSha, packagePath, packageName, }) {
5367153673
// 커밋 해시 목록만 추출
5367253674
const shas = (0, node_child_process_1.execSync)(`git log --reverse --pretty=format:"%H" ${baseSha}..${headSha} -- ${packagePath}`, {
5367353675
encoding: 'utf8',
@@ -53677,7 +53679,7 @@ function getFilteredCommitMessages({ baseSha, headSha, packagePath, }) {
5367753679
const messages = [
5367853680
'## 🚧 Pre-release',
5367953681
'',
53680-
`This release is a **pre-release** version.`,
53682+
`This release is a **pre-release** version of ${packageName}.`,
5368153683
'Please make sure to thoroughly test it before deploying to production.',
5368253684
'',
5368353685
'### Changes',
@@ -53699,7 +53701,7 @@ function getFilteredCommitMessages({ baseSha, headSha, packagePath, }) {
5369953701
}
5370053702
function createReleaseForTags(_a) {
5370153703
return __awaiter(this, arguments, void 0, function* ({ packageData, baseSha, headSha, }) {
53702-
for (const { tag, packagePath } of packageData) {
53704+
for (const { tag, packagePath, name } of packageData) {
5370353705
// 이미 Release가 생성된 태그는 건너뜀
5370453706
try {
5370553707
yield (0, exec_1.exec)('gh', ['release', 'view', tag]);
@@ -53710,7 +53712,7 @@ function createReleaseForTags(_a) {
5371053712
// IGNORE: release가 없으면 진행
5371153713
}
5371253714
// 커밋 로그 추출하여 릴리즈 노트 생성
53713-
const notes = getFilteredCommitMessages({ baseSha, headSha, packagePath });
53715+
const notes = getFilteredCommitMessages({ baseSha, headSha, packagePath, packageName: name });
5371453716
/**
5371553717
* GitHub Release 생성
5371653718
* @see https://cli.github.com/manual/gh_release_create

canary-publish/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ async function main() {
157157
createRelease &&
158158
(await createReleaseForTags({
159159
packageData: publishedPackages.map(({name, version}) => ({
160+
name,
161+
version,
160162
tag: `${name}@${version}`,
161163
packagePath: packagePathByName[name],
162164
})),

canary-publish/src/utils/publish.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ function getFilteredCommitMessages({
5050
baseSha,
5151
headSha,
5252
packagePath,
53+
packageName,
5354
}: {
5455
baseSha: string
5556
headSha: string
5657
packagePath: string
58+
packageName: string
5759
}) {
5860
// 커밋 해시 목록만 추출
5961
const shas = execSync(`git log --reverse --pretty=format:"%H" ${baseSha}..${headSha} -- ${packagePath}`, {
@@ -65,7 +67,7 @@ function getFilteredCommitMessages({
6567
const messages = [
6668
'## 🚧 Pre-release',
6769
'',
68-
`This release is a **pre-release** version.`,
70+
`This release is a **pre-release** version of ${packageName}.`,
6971
'Please make sure to thoroughly test it before deploying to production.',
7072
'',
7173
'### Changes',
@@ -96,13 +98,15 @@ export async function createReleaseForTags({
9698
headSha,
9799
}: {
98100
packageData: {
101+
name: string
102+
version: string
99103
tag: string
100104
packagePath: string
101105
}[]
102106
baseSha: string
103107
headSha: string
104108
}) {
105-
for (const {tag, packagePath} of packageData) {
109+
for (const {tag, packagePath, name} of packageData) {
106110
// 이미 Release가 생성된 태그는 건너뜀
107111
try {
108112
await exec('gh', ['release', 'view', tag])
@@ -113,7 +117,7 @@ export async function createReleaseForTags({
113117
}
114118

115119
// 커밋 로그 추출하여 릴리즈 노트 생성
116-
const notes = getFilteredCommitMessages({baseSha, headSha, packagePath})
120+
const notes = getFilteredCommitMessages({baseSha, headSha, packagePath, packageName: name})
117121

118122
/**
119123
* GitHub Release 생성

0 commit comments

Comments
 (0)