From 84275f14b43027690a02dd49597f2bf53dc97a0f Mon Sep 17 00:00:00 2001 From: Edward Foyle Date: Thu, 4 Apr 2024 18:46:41 -0700 Subject: [PATCH] remove unused code --- .../get_dist_tag_from_release_tag.test.ts | 33 ------------------- .../get_dist_tag_from_release_tag.ts | 8 ----- 2 files changed, 41 deletions(-) delete mode 100644 scripts/components/get_dist_tag_from_release_tag.test.ts delete mode 100644 scripts/components/get_dist_tag_from_release_tag.ts diff --git a/scripts/components/get_dist_tag_from_release_tag.test.ts b/scripts/components/get_dist_tag_from_release_tag.test.ts deleted file mode 100644 index 3ec12aa778..0000000000 --- a/scripts/components/get_dist_tag_from_release_tag.test.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { describe, it } from 'node:test'; -import { getDistTagFromReleaseTag } from './get_dist_tag_from_release_tag.js'; -import assert from 'node:assert'; - -void describe('getDistTagFromReleaseTag', () => { - void it('defaults to latest when releaseTag is not a prerelease version', () => { - assert.equal( - getDistTagFromReleaseTag('@aws-amplify/backend-auth@0.5.0'), - 'latest' - ); - assert.equal( - getDistTagFromReleaseTag('@aws-amplify/form-generator@1.8.0'), - 'latest' - ); - assert.equal( - getDistTagFromReleaseTag('create-amplify@123.89.921'), - 'latest' - ); - }); - - void it('grabs expected dist tag names', () => { - assert.equal( - getDistTagFromReleaseTag('@aws-amplify/backend-data@0.10.0-beta.9'), - 'beta' - ); - assert.equal( - getDistTagFromReleaseTag( - '@aws-amplify/model-generator@0.5.0-tag.with-dashes_and_underscores_and_123.0' - ), - 'tag.with-dashes_and_underscores_and_123' - ); - }); -}); diff --git a/scripts/components/get_dist_tag_from_release_tag.ts b/scripts/components/get_dist_tag_from_release_tag.ts deleted file mode 100644 index 1ad79a2c56..0000000000 --- a/scripts/components/get_dist_tag_from_release_tag.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Given a string like '@aws-amplify/auth-construct-alpha@0.6.0-beta.8', this regex will grab 'beta' from the string. - * For a non-pre release tag like @aws-amplify/backend-cli@0.10.0, this regex will not match and we default to the 'latest' tag. - */ -export const getDistTagFromReleaseTag = (releaseTag: string) => { - const distTagMatch = releaseTag.match(/\.\d+-(?[\w\-.]+)\.\d+$/); - return distTagMatch?.groups?.distTag ?? 'latest'; -};