MCPcopy Index your code
hub / github.com/aws/aws-sdk-js-codemod

github.com/aws/aws-sdk-js-codemod @v3.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0.2 ↗ · + Follow
294 symbols 1,090 edges 702 files 0 documented · 0% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

aws-sdk-js-codemod

This repository contains a collection of codemod scripts for use with JSCodeshift that help update AWS SDK for JavaScript APIs.

The aws-sdk-js-codemod CLI is a lightweight wrapper over jscodeshift. It processes --help, --version and --transform options before passing them downstream.

You can provide names of the custom transforms instead of a local path or url:

 v2-to-v3  Converts AWS SDK for JavaScript APIs in a Javascript/TypeScript
           codebase from version 2 (v2) to version 3 (v3).

Please review the code change thoroughly for required functionality before deploying it to production. If the transformation is not complete or is incorrect, please report the issue on GitHub.

Prerequisites

To use aws-sdk-js-codemod, please install Node.js.

Usage

  • Optionally execute dry-run for the transform, and print transformed files on stdout: console npx aws-sdk-js-codemod@latest --dry --print -t v2-to-v3 PATH...
  • Run transform, and make changes to files: console npx aws-sdk-js-codemod@latest -t v2-to-v3 PATH...

Example

$ cat example.ts
import AWS from "aws-sdk";
const client = new AWS.DynamoDB();
const response = await client.listTables({}).promise();

$ npx aws-sdk-js-codemod@latest -t v2-to-v3 example.ts

$ cat example.ts
import { DynamoDB } from "@aws-sdk/client-dynamodb";
const client = new DynamoDB();
const response = await client.listTables({});

For a summary of supported transformations, check TRANSFORMATIONS.md.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

Extension points exported contracts — how you extend this code

AwsSdkJsCodemodTransformOption (Interface)
(no doc)
src/transforms/types.ts
V3PackageImportEqualsCodeOptions (Interface)
(no doc)
scripts/generateNewClientTests/getV3PackageImportEqualsCode.ts
AwsSdkJsCodemodTransform (Interface)
(no doc)
src/transforms/types.ts
V3PackageRequiresCodeOptions (Interface)
(no doc)
scripts/generateNewClientTests/getV3PackageRequiresCode.ts
ClientMetadata (Interface)
(no doc)
src/transforms/v2-to-v3/types.ts
V3PackageImportsCodeOptions (Interface)
(no doc)
scripts/generateNewClientTests/getV3PackageImportsCode.ts
ThisMemberExpression (Interface)
(no doc)
src/transforms/v2-to-v3/types.ts
GetRequireDeclaratorsWithObjectPattern (Interface)
(no doc)
src/transforms/v2-to-v3/modules/getRequireDeclaratorsWithObjectPattern.ts

Core symbols most depended-on inside this repo

listTables
called by 41
src/transforms/v2-to-v3/__fixtures__/api-promise/client-class-member.input.ts
getV2ClientsNewExpressionCode
called by 18
scripts/generateNewClientTests/getV2ClientsNewExpressionCode.ts
addNamedModule
called by 13
src/transforms/v2-to-v3/modules/addNamedModule.ts
listTagsOfResource
called by 13
src/transforms/v2-to-v3/__fixtures__/api-promise/client-class-member.input.ts
getV3ClientsNewExpressionCode
called by 13
scripts/generateNewClientTests/getV3ClientsNewExpressionCode.ts
getClientNamesSortedByPackageName
called by 13
scripts/generateNewClientTests/getClientNamesSortedByPackageName.ts
getClientNameWithLocalSuffix
called by 10
scripts/generateNewClientTests/getClientNameWithLocalSuffix.ts
getTSQualifiedNameFromClientName
called by 9
src/transforms/v2-to-v3/ts-type/getTSQualifiedNameFromClientName.ts

Shape

Function 205
Method 32
Interface 30
Class 24
Enum 3

Languages

TypeScript100%

Modules by API surface

src/transforms/v2-to-v3/__fixtures__/api-promise/client-class-member.output.ts10 symbols
src/transforms/v2-to-v3/__fixtures__/api-promise/client-class-member.output.js10 symbols
src/transforms/v2-to-v3/__fixtures__/api-promise/client-class-member.input.ts10 symbols
src/transforms/v2-to-v3/__fixtures__/api-promise/client-class-member.input.js10 symbols
src/transforms/v2-to-v3/apis/getClientIdNamesFromNewExpr.ts5 symbols
src/transforms/v2-to-v3/__fixtures__/aws-error-name/service-import.output.ts5 symbols
src/transforms/v2-to-v3/__fixtures__/aws-error-name/service-import.input.ts5 symbols
src/transforms/v2-to-v3/__fixtures__/aws-error-name/global-import.output.ts5 symbols
src/transforms/v2-to-v3/__fixtures__/aws-error-name/global-import.input.ts5 symbols
src/transforms/v2-to-v3/modules/types.ts4 symbols
src/transforms/v2-to-v3/client-instances/getObjectWithUpdatedAwsConfigKeys.ts4 symbols
src/transforms/v2-to-v3/__fixtures__/waiters/client-class-member.output.ts4 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add aws-sdk-js-codemod \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact