Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prerelease script to test changed clients #970

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented Nov 7, 2024

Issue

Refs: #950 (comment)

Description

Prerelease script which tests updated client names and package names

Testing

No clients have changed in the current release

$ npx tsx scripts/testUpdatedIdentifiers
Changed package names: [  ]
Changed clients: [  ]

Simulated check after adding deprecated client

$ git diff
diff --git a/src/transforms/v2-to-v3/config/CLIENT_NAMES.ts b/src/transforms/v2-to-v3/config/CLIENT_NAMES.ts
index b4b0777..e14274b 100644
--- a/src/transforms/v2-to-v3/config/CLIENT_NAMES.ts
+++ b/src/transforms/v2-to-v3/config/CLIENT_NAMES.ts
@@ -382,4 +382,5 @@ export const CLIENT_NAMES = [
   "WorkSpacesThinClient",
   "WorkSpacesWeb",
   "XRay",
+  "BackupStorage",
 ];
diff --git a/src/transforms/v2-to-v3/config/CLIENT_PACKAGE_NAMES_MAP.ts b/src/transforms/v2-to-v3/config/CLIENT_PACKAGE_NAMES_MAP.ts
index ea8a175..373cf45 100644
--- a/src/transforms/v2-to-v3/config/CLIENT_PACKAGE_NAMES_MAP.ts
+++ b/src/transforms/v2-to-v3/config/CLIENT_PACKAGE_NAMES_MAP.ts
@@ -143,4 +143,5 @@ export const CLIENT_PACKAGE_NAMES_MAP: Record<string, string> = {
   WAFRegional: "client-waf-regional",
   WellArchitected: "client-wellarchitected",
   WorkMailMessageFlow: "client-workmailmessageflow",
+  BackupStorage: "client-backupstorage",
 };

$ npx tsx scripts/testUpdatedIdentifiers
Changed package names: [  ]
Changed clients: [ BackupStorage ]
Client 'BackupStorage' exists in '@aws-sdk/client-backupstorage'.

Simulated check for incorrect client name

$ diff --git a/src/transforms/v2-to-v3/config/CLIENT_NAMES_MAP.ts b/src/transforms/v2-to-v3/config/CLIENT_NAMES_MAP.ts
index 42bdcb1..44f8366 100644
--- a/src/transforms/v2-to-v3/config/CLIENT_NAMES_MAP.ts
+++ b/src/transforms/v2-to-v3/config/CLIENT_NAMES_MAP.ts
@@ -32,5 +32,5 @@ export const CLIENT_NAMES_MAP: Record<string, string> = {
   SESV2: "SESv2",
   SavingsPlans: "Savingsplans",
   StepFunctions: "SFN",
-  TranscribeService: "Transcribe",
+  TranscribeService: "S3",

$ npx tsx scripts/testUpdatedIdentifiers
Changed package names: [  ]
Changed clients: [ S3 ]
node:internal/errors:983
  const err = new Error(message);
              ^

Error: Command failed: node index.mjs
file:///private/var/folders/42/54jl1_3x4hz06cf7bc_kzd4h0000gn/T/codemod-br8Fiw/index.mjs:1
import { S3 } from "@aws-sdk/client-transcribe"
         ^^
SyntaxError: Named export 'S3' not found. The requested module '@aws-sdk/client-transcribe' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@aws-sdk/client-transcribe';
const { S3 } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:177:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:260:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)

Node.js v22.10.0

    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at ChildProcess.exithandler (node:child_process:419:12)
    at ChildProcess.emit (node:events:518:28)
    at maybeClose (node:internal/child_process:1104:16)
    at Socket.<anonymous> (node:internal/child_process:456:11)
    at Socket.emit (node:events:518:28)
    at Pipe.<anonymous> (node:net:343:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'node index.mjs',
  stdout: '',
  stderr: 'file:///private/var/folders/42/54jl1_3x4hz06cf7bc_kzd4h0000gn/T/codemod-br8Fiw/index.mjs:1\n' +
    'import { S3 } from "@aws-sdk/client-transcribe"\n' +
    '         ^^\n' +
    "SyntaxError: Named export 'S3' not found. The requested module '@aws-sdk/client-transcribe' is a CommonJS module, which may not support all module.exports as named exports.\n" +
    'CommonJS modules can always be imported via the default export, for example using:\n' +
    '\n' +
    "import pkg from '@aws-sdk/client-transcribe';\n" +
    'const { S3 } = pkg;\n' +
    '\n' +
    '    at ModuleJob._instantiate (node:internal/modules/esm/module_job:177:21)\n' +
    '    at async ModuleJob.run (node:internal/modules/esm/module_job:260:5)\n' +
    '    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)\n' +
    '    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)\n' +
    '\n' +
    'Node.js v22.10.0\n'
}

Node.js v22.10.0

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

changeset-bot bot commented Nov 7, 2024

⚠️ No Changeset found

Latest commit: 22880f7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@trivikr trivikr force-pushed the test-changed-packages branch from 80d5671 to 22880f7 Compare November 7, 2024 04:29
@trivikr trivikr marked this pull request as ready for review November 7, 2024 04:32
@trivikr trivikr requested a review from a team as a code owner November 7, 2024 04:32
@trivikr trivikr changed the title Add prerelease script to test updated identifiers Update prerelease script to test changed clients Nov 7, 2024
@trivikr trivikr merged commit 962de3f into main Nov 7, 2024
7 checks passed
@trivikr trivikr deleted the test-changed-packages branch November 7, 2024 04:33
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant