Skip to content

Codemod scripts to update AWS SDK for JavaScript APIs.

License

Notifications You must be signed in to change notification settings

aws/aws-sdk-js-codemod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e3ce1e4 · Mar 29, 2025
Nov 7, 2024
Mar 29, 2025
Aug 5, 2024
Mar 2, 2022
Mar 15, 2025
Mar 17, 2025
Mar 2, 2022
Mar 29, 2025
Nov 7, 2024
Mar 14, 2022
Feb 4, 2024
Mar 14, 2022
Nov 10, 2023
Nov 10, 2023
Jul 28, 2024
Mar 29, 2025
Jun 25, 2024
Mar 17, 2025

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:
    npx aws-sdk-js-codemod@latest --dry --print -t v2-to-v3 PATH...
  • Run transform, and make changes to files:
    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.