From ee29ed26ff1d754fa13576840c08267b8b5707ba Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 13 Mar 2018 17:36:12 +0100 Subject: Use async/await instead of promise syntax --- packages/monorepo-scripts/src/postpublish_utils.ts | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'packages/monorepo-scripts/src/postpublish_utils.ts') 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 { 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, '...'); -- cgit