diff options
author | Jacob Evans <dekz@dekz.net> | 2018-07-03 14:58:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-03 14:58:08 +0800 |
commit | 499915042ea644bec7266e5b4f09b624e55de6f1 (patch) | |
tree | ced473d564e65f18f2647e1009f7752ca8532865 /packages/monorepo-scripts/src | |
parent | 1a901554cceab03ead6129a1f41d87349fc3fe07 (diff) | |
parent | 328da21420e54ac0f2d9e2d7bcb894cc13f3bea8 (diff) | |
download | dexon-sol-tools-499915042ea644bec7266e5b4f09b624e55de6f1.tar dexon-sol-tools-499915042ea644bec7266e5b4f09b624e55de6f1.tar.gz dexon-sol-tools-499915042ea644bec7266e5b4f09b624e55de6f1.tar.bz2 dexon-sol-tools-499915042ea644bec7266e5b4f09b624e55de6f1.tar.lz dexon-sol-tools-499915042ea644bec7266e5b4f09b624e55de6f1.tar.xz dexon-sol-tools-499915042ea644bec7266e5b4f09b624e55de6f1.tar.zst dexon-sol-tools-499915042ea644bec7266e5b4f09b624e55de6f1.zip |
Merge branch 'v2-prototype' into eth-lightwallet-subprovider-final
Diffstat (limited to 'packages/monorepo-scripts/src')
-rw-r--r-- | packages/monorepo-scripts/src/prepublish_checks.ts | 12 | ||||
-rw-r--r-- | packages/monorepo-scripts/src/utils/utils.ts | 27 |
2 files changed, 23 insertions, 16 deletions
diff --git a/packages/monorepo-scripts/src/prepublish_checks.ts b/packages/monorepo-scripts/src/prepublish_checks.ts index 1c4ee1fc6..3b4ff9082 100644 --- a/packages/monorepo-scripts/src/prepublish_checks.ts +++ b/packages/monorepo-scripts/src/prepublish_checks.ts @@ -34,17 +34,17 @@ async function checkGitTagsForNextVersionAndDeleteIfExistAsync( const packageLocation = lernaPackage.location; const nextVersion = await utils.getNextPackageVersionAsync(currentVersion, packageName, packageLocation); - const localTagVersions = localTagVersionsByPackageName[packageName]; - if (_.includes(localTagVersions, nextVersion)) { - const tagName = `${packageName}@${nextVersion}`; - await utils.removeLocalTagAsync(tagName); - } - const remoteTagVersions = remoteTagVersionsByPackageName[packageName]; if (_.includes(remoteTagVersions, nextVersion)) { const tagName = `:refs/tags/${packageName}@${nextVersion}`; await utils.removeRemoteTagAsync(tagName); } + + const localTagVersions = localTagVersionsByPackageName[packageName]; + if (_.includes(localTagVersions, nextVersion)) { + const tagName = `${packageName}@${nextVersion}`; + await utils.removeLocalTagAsync(tagName); + } } } diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts index 20bc57bae..f819ab6f1 100644 --- a/packages/monorepo-scripts/src/utils/utils.ts +++ b/packages/monorepo-scripts/src/utils/utils.ts @@ -44,6 +44,9 @@ export const utils = { nextVersionIfValid = semver.inc(currentVersion, 'patch'); } const lastEntry = changelog[0]; + if (semver.gt(currentVersion, lastEntry.version)) { + throw new Error(`Package.json version cannot be greater then last CHANGELOG entry. Check: ${packageName}`); + } nextVersionIfValid = semver.eq(lastEntry.version, currentVersion) ? semver.inc(currentVersion, 'patch') : lastEntry.version; @@ -100,19 +103,23 @@ export const utils = { return tagVersionByPackageName; }, async removeLocalTagAsync(tagName: string): Promise<void> { - const result = await execAsync(`git tag -d ${tagName}`, { - cwd: constants.monorepoRootPath, - }); - if (!_.isEmpty(result.stderr)) { - throw new Error(`Failed to delete local git tag. Got err: ${result.stderr}`); + try { + await execAsync(`git tag -d ${tagName}`, { + cwd: constants.monorepoRootPath, + }); + } catch (err) { + throw new Error(`Failed to delete local git tag. Got err: ${err}`); } + this.log(`Removed local tag: ${tagName}`); }, async removeRemoteTagAsync(tagName: string): Promise<void> { - const result = await execAsync(`git push origin ${tagName}`, { - cwd: constants.monorepoRootPath, - }); - if (!_.isEmpty(result.stderr)) { - throw new Error(`Failed to delete remote git tag. Got err: ${result.stderr}`); + try { + await execAsync(`git push origin ${tagName}`, { + cwd: constants.monorepoRootPath, + }); + } catch (err) { + throw new Error(`Failed to delete remote git tag. Got err: ${err}`); } + this.log(`Removed remote tag: ${tagName}`); }, }; |