aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts/src/publish.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-06-19 01:00:39 +0800
committerFabio Berger <me@fabioberger.com>2018-06-19 05:08:33 +0800
commit3e64b3da398a90e6ddfc287ebf28ec780b64b56f (patch)
treec1788d98471b58f90d99fa8bedb1553725cec4b6 /packages/monorepo-scripts/src/publish.ts
parent9a748c8bf1dfd1a090e3d44a4cbebb59bcedd5e6 (diff)
downloaddexon-sol-tools-3e64b3da398a90e6ddfc287ebf28ec780b64b56f.tar
dexon-sol-tools-3e64b3da398a90e6ddfc287ebf28ec780b64b56f.tar.gz
dexon-sol-tools-3e64b3da398a90e6ddfc287ebf28ec780b64b56f.tar.bz2
dexon-sol-tools-3e64b3da398a90e6ddfc287ebf28ec780b64b56f.tar.lz
dexon-sol-tools-3e64b3da398a90e6ddfc287ebf28ec780b64b56f.tar.xz
dexon-sol-tools-3e64b3da398a90e6ddfc287ebf28ec780b64b56f.tar.zst
dexon-sol-tools-3e64b3da398a90e6ddfc287ebf28ec780b64b56f.zip
Use semver library instead of semverUtils
Diffstat (limited to 'packages/monorepo-scripts/src/publish.ts')
-rw-r--r--packages/monorepo-scripts/src/publish.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts
index 637512a5a..cdd250ec3 100644
--- a/packages/monorepo-scripts/src/publish.ts
+++ b/packages/monorepo-scripts/src/publish.ts
@@ -8,6 +8,7 @@ import opn = require('opn');
import * as path from 'path';
import { exec as execAsync, spawn } from 'promisify-child-process';
import * as prompt from 'prompt';
+import semver = require('semver');
import semverDiff = require('semver-diff');
import semverSort = require('semver-sort');
@@ -129,10 +130,13 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
);
if (shouldAddNewEntry) {
// Create a new entry for a patch version with generic changelog entry.
- const nextPatchVersion = utils.getNextPatchVersion(currentVersion);
+ const nextPatchVersionIfValid = semver.inc(currentVersion, 'patch');
+ if (_.isNull(nextPatchVersionIfValid)) {
+ throw new Error(`Encountered invalid semver version: ${currentVersion} for package: ${packageName}`);
+ }
const newChangelogEntry: VersionChangelog = {
timestamp: TODAYS_TIMESTAMP,
- version: nextPatchVersion,
+ version: nextPatchVersionIfValid,
changes: [
{
note: 'Dependencies updated',
@@ -140,7 +144,7 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
],
};
changelog = [newChangelogEntry, ...changelog];
- packageToVersionChange[packageName] = semverDiff(currentVersion, nextPatchVersion);
+ packageToVersionChange[packageName] = semverDiff(currentVersion, nextPatchVersionIfValid);
} else {
// Update existing entry with timestamp
const lastEntry = changelog[0];