diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-10-19 21:34:31 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-10-19 21:36:46 +0800 |
commit | 3f2b6482c3e0abcc2b6dc1a3caef767c01a446b3 (patch) | |
tree | 62de6dc471a8f9a686561a2c06f130050d6d09b3 /packages/monorepo-scripts/src/utils | |
parent | 17643d98aae596f896039459afbc1ce3df51a073 (diff) | |
download | dexon-sol-tools-3f2b6482c3e0abcc2b6dc1a3caef767c01a446b3.tar dexon-sol-tools-3f2b6482c3e0abcc2b6dc1a3caef767c01a446b3.tar.gz dexon-sol-tools-3f2b6482c3e0abcc2b6dc1a3caef767c01a446b3.tar.bz2 dexon-sol-tools-3f2b6482c3e0abcc2b6dc1a3caef767c01a446b3.tar.lz dexon-sol-tools-3f2b6482c3e0abcc2b6dc1a3caef767c01a446b3.tar.xz dexon-sol-tools-3f2b6482c3e0abcc2b6dc1a3caef767c01a446b3.tar.zst dexon-sol-tools-3f2b6482c3e0abcc2b6dc1a3caef767c01a446b3.zip |
Fix the package versions in release notes
Diffstat (limited to 'packages/monorepo-scripts/src/utils')
-rw-r--r-- | packages/monorepo-scripts/src/utils/github_release_utils.ts | 18 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/utils/utils.ts | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/packages/monorepo-scripts/src/utils/github_release_utils.ts b/packages/monorepo-scripts/src/utils/github_release_utils.ts index 43c52ec2d..7434d397e 100644 --- a/packages/monorepo-scripts/src/utils/github_release_utils.ts +++ b/packages/monorepo-scripts/src/utils/github_release_utils.ts @@ -12,7 +12,7 @@ import { utils } from './utils'; const publishReleaseAsync = promisify(publishRelease); // tslint:disable-next-line:completed-docs -export async function publishReleaseNotesAsync(updatedPublishPackages: Package[], isDryRun: boolean): Promise<void> { +export async function publishReleaseNotesAsync(packagesToPublish: Package[], isDryRun: boolean): Promise<void> { // Git push a tag representing this publish (publish-{commit-hash}) (truncate hash) const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath }); const latestGitCommit = result.stdout; @@ -40,12 +40,8 @@ export async function publishReleaseNotesAsync(updatedPublishPackages: Package[] let assets: string[] = []; let aggregateNotes = ''; - _.each(updatedPublishPackages, pkg => { - const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version); - if (_.isEmpty(notes)) { - return; // don't include it - } - aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`; + _.each(packagesToPublish, pkg => { + aggregateNotes += getReleaseNotesForPackage(pkg.packageJson.name); const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets'); if (!_.isUndefined(packageAssets)) { @@ -92,7 +88,7 @@ function adjustAssetPaths(assets: string[]): string[] { return finalAssets; } -function getReleaseNotesForPackage(packageName: string, version: string): string { +function getReleaseNotesForPackage(packageName: string): string { const packageNameWithoutNamespace = packageName.replace('@0x/', ''); const changelogJSONPath = path.join( constants.monorepoRootPath, @@ -115,5 +111,9 @@ function getReleaseNotesForPackage(packageName: string, version: string): string } notes += `\n`; }); - return notes; + if (_.isEmpty(notes)) { + return ''; // don't include it + } + const releaseNotesSection = `### ${packageName}@${latestLog.version}\n${notes}\n\n`; + return releaseNotesSection; } diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts index 5e2e877c7..44ff971e8 100644 --- a/packages/monorepo-scripts/src/utils/utils.ts +++ b/packages/monorepo-scripts/src/utils/utils.ts @@ -61,7 +61,7 @@ export const utils = { }); return updatedPackages; }, - async getUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise<Package[]> { + async getPackagesToPublishAsync(shouldIncludePrivate: boolean): Promise<Package[]> { const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate); const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name); |