From 754be75dbfbb0ea4ca769d8810a76f382f31e031 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 3 Dec 2018 12:48:53 +0100 Subject: Fix hardcoded path in release notes fetching --- packages/monorepo-scripts/CHANGELOG.json | 4 ++++ packages/monorepo-scripts/src/utils/github_release_utils.ts | 12 +++--------- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'packages') diff --git a/packages/monorepo-scripts/CHANGELOG.json b/packages/monorepo-scripts/CHANGELOG.json index 170a97a33..428168437 100644 --- a/packages/monorepo-scripts/CHANGELOG.json +++ b/packages/monorepo-scripts/CHANGELOG.json @@ -13,6 +13,10 @@ { "note": "Add ForwarderError to the IGNORED_EXCESSIVE_TYPES array", "pr": 1147 + }, + { + "note": "Fix a bug when hardcoded CHANGELOG paths cause fetching release notes to fail", + "pr": 1311 } ] }, diff --git a/packages/monorepo-scripts/src/utils/github_release_utils.ts b/packages/monorepo-scripts/src/utils/github_release_utils.ts index 7434d397e..e63244b46 100644 --- a/packages/monorepo-scripts/src/utils/github_release_utils.ts +++ b/packages/monorepo-scripts/src/utils/github_release_utils.ts @@ -41,7 +41,7 @@ export async function publishReleaseNotesAsync(packagesToPublish: Package[], isD let assets: string[] = []; let aggregateNotes = ''; _.each(packagesToPublish, pkg => { - aggregateNotes += getReleaseNotesForPackage(pkg.packageJson.name); + aggregateNotes += getReleaseNotesForPackage(pkg.location, pkg.packageJson.name); const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets'); if (!_.isUndefined(packageAssets)) { @@ -88,14 +88,8 @@ function adjustAssetPaths(assets: string[]): string[] { return finalAssets; } -function getReleaseNotesForPackage(packageName: string): string { - const packageNameWithoutNamespace = packageName.replace('@0x/', ''); - const changelogJSONPath = path.join( - constants.monorepoRootPath, - 'packages', - packageNameWithoutNamespace, - 'CHANGELOG.json', - ); +function getReleaseNotesForPackage(packageLocation: string, packageName: string): string { + const changelogJSONPath = path.join(packageLocation, 'CHANGELOG.json'); const changelogJSON = readFileSync(changelogJSONPath, 'utf-8'); const changelogs = JSON.parse(changelogJSON); const latestLog = changelogs[0]; -- cgit v1.2.3