diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-02 06:46:16 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-02 06:46:16 +0800 |
commit | 50552546f392214726e6b969a72c04f320486b16 (patch) | |
tree | 99cb4bf459ee287c599f758c188a5e7dd73bbf13 /packages/monorepo-scripts/src/publish.ts | |
parent | e8771fb36a5e2eb9c2640f409f1fc9d3a5219bd7 (diff) | |
download | dexon-sol-tools-50552546f392214726e6b969a72c04f320486b16.tar dexon-sol-tools-50552546f392214726e6b969a72c04f320486b16.tar.gz dexon-sol-tools-50552546f392214726e6b969a72c04f320486b16.tar.bz2 dexon-sol-tools-50552546f392214726e6b969a72c04f320486b16.tar.lz dexon-sol-tools-50552546f392214726e6b969a72c04f320486b16.tar.xz dexon-sol-tools-50552546f392214726e6b969a72c04f320486b16.tar.zst dexon-sol-tools-50552546f392214726e6b969a72c04f320486b16.zip |
Rename changelogs to changelog
Diffstat (limited to 'packages/monorepo-scripts/src/publish.ts')
-rw-r--r-- | packages/monorepo-scripts/src/publish.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts index 45dea9796..36970f85b 100644 --- a/packages/monorepo-scripts/src/publish.ts +++ b/packages/monorepo-scripts/src/publish.ts @@ -122,9 +122,9 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[]) const packageName = lernaPackage.package.name; const changelogJSONPath = path.join(lernaPackage.location, 'CHANGELOG.json'); const changelogJSON = utils.getChangelogJSONOrCreateIfMissing(changelogJSONPath); - let changelogs: Changelog; + let changelog: Changelog; try { - changelogs = JSON.parse(changelogJSON); + changelog = JSON.parse(changelogJSON); } catch (err) { throw new Error( `${lernaPackage.package.name}'s CHANGELOG.json contains invalid JSON. Please fix and try again.`, @@ -132,7 +132,7 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[]) } const currentVersion = lernaPackage.package.version; - const shouldAddNewEntry = changelogUtils.shouldAddNewChangelogEntry(currentVersion, changelogs); + const shouldAddNewEntry = changelogUtils.shouldAddNewChangelogEntry(currentVersion, changelog); if (shouldAddNewEntry) { // Create a new entry for a patch version with generic changelog entry. const nextPatchVersion = utils.getNextPatchVersion(currentVersion); @@ -145,27 +145,27 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[]) }, ], }; - changelogs = [newChangelogEntry, ...changelogs]; + changelog = [newChangelogEntry, ...changelog]; packageToVersionChange[packageName] = semverDiff(currentVersion, nextPatchVersion); } else { // Update existing entry with timestamp - const lastEntry = changelogs[0]; + const lastEntry = changelog[0]; if (_.isUndefined(lastEntry.timestamp)) { lastEntry.timestamp = TODAYS_TIMESTAMP; } // Check version number is correct. const proposedNextVersion = lastEntry.version; lastEntry.version = updateVersionNumberIfNeeded(currentVersion, proposedNextVersion); - changelogs[0] = lastEntry; + changelog[0] = lastEntry; packageToVersionChange[packageName] = semverDiff(currentVersion, lastEntry.version); } // Save updated CHANGELOG.json - fs.writeFileSync(changelogJSONPath, JSON.stringify(changelogs, null, '\t')); + fs.writeFileSync(changelogJSONPath, JSON.stringify(changelog, null, '\t')); await utils.prettifyAsync(changelogJSONPath, constants.monorepoRootPath); utils.log(`${packageName}: Updated CHANGELOG.json`); // Generate updated CHANGELOG.md - const changelogMd = changelogUtils.generateChangelogMd(changelogs); + const changelogMd = changelogUtils.generateChangelogMd(changelog); const changelogMdPath = path.join(lernaPackage.location, 'CHANGELOG.md'); fs.writeFileSync(changelogMdPath, changelogMd); await utils.prettifyAsync(changelogMdPath, constants.monorepoRootPath); |