From e1723d0281fa8f709217fdfff3984a3f2778313c Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Wed, 6 Feb 2019 14:08:26 -0800 Subject: [PATCH] [ios, build] Improve error message when tagged version does not exist in changelog --- platform/ios/scripts/release-notes.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/ios/scripts/release-notes.js b/platform/ios/scripts/release-notes.js index d7a7d6dbb..41caff7fa 100755 --- a/platform/ios/scripts/release-notes.js +++ b/platform/ios/scripts/release-notes.js @@ -6,7 +6,8 @@ const ejs = require('ejs'); const _ = require('lodash'); const semver = require('semver'); -const changelog = fs.readFileSync('platform/ios/CHANGELOG.md', 'utf8'); +const changelogPath = 'platform/ios/CHANGELOG.md'; +const changelog = fs.readFileSync(changelogPath, 'utf8'); let outputMode = {}; switch(process.argv[2]) { @@ -61,6 +62,11 @@ const versionsInReleaseNotes = _.map(releaseNotes, 'version'); const bestReleaseNotesForCurrentVersion = semver.minSatisfying(versionsInReleaseNotes, ">=" + currentVersion); const currentReleaseNotes = _.find(releaseNotes, { version: bestReleaseNotesForCurrentVersion }); +if (!currentReleaseNotes) { + console.error('Could not find a release section satisfying %s in %s — did you forget to rename the "master" section to %s?', currentVersion, changelogPath, currentVersion.split("-")[0]); + process.exit(1); +} + /* Fill and print the release notes template. */