diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-14 00:36:12 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-14 00:36:12 +0800 |
commit | ee29ed26ff1d754fa13576840c08267b8b5707ba (patch) | |
tree | cbfb847cccf36e874ec923d06d52cc98e3a1172c /packages/monorepo-scripts/src | |
parent | a08ae722c112e3bbd257bcf1606e3cf962266eae (diff) | |
download | dexon-sol-tools-ee29ed26ff1d754fa13576840c08267b8b5707ba.tar.gz dexon-sol-tools-ee29ed26ff1d754fa13576840c08267b8b5707ba.tar.zst dexon-sol-tools-ee29ed26ff1d754fa13576840c08267b8b5707ba.zip |
Use async/await instead of promise syntax
Diffstat (limited to 'packages/monorepo-scripts/src')
-rw-r--r-- | packages/monorepo-scripts/src/postpublish_utils.ts | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts index e04c31649..6c8771c6f 100644 --- a/packages/monorepo-scripts/src/postpublish_utils.ts +++ b/packages/monorepo-scripts/src/postpublish_utils.ts @@ -19,22 +19,21 @@ export const postpublishUtils = { async getLatestTagAndVersionAsync(subPackageName: string): Promise<TagAndVersion> { const subPackagePrefix = `${subPackageName}@`; const gitTagsCommand = `git tag -l "${subPackagePrefix}*"`; - return execAsync(gitTagsCommand).then((result: any) => { - if (!_.isEmpty(result.stderr)) { - throw new Error(result.stderr); - } - const tags = result.stdout.trim().split('\n'); - const versions = tags.map((tag: string) => { - return tag.slice(subPackagePrefix.length); - }); - const sortedVersions = semverSort.desc(versions); - const latestVersion = sortedVersions[0]; - const latestTag = subPackagePrefix + latestVersion; - return { - tag: latestTag, - version: latestVersion, - }; + const result = await execAsync(gitTagsCommand); + if (!_.isEmpty(result.stderr)) { + throw new Error(result.stderr); + } + const tags = result.stdout.trim().split('\n'); + const versions = tags.map((tag: string) => { + return tag.slice(subPackagePrefix.length); }); + const sortedVersions = semverSort.desc(versions); + const latestVersion = sortedVersions[0]; + const latestTag = subPackagePrefix + latestVersion; + return { + tag: latestTag, + version: latestVersion, + }; }, async publishReleaseNotesAsync(tag: string, releaseName: string, assets: string[]) { utils.log('POSTPUBLISH: Releasing ', releaseName, '...'); |