8000 GitHub - kuhe/aws-sdk-js-codemod: Codemod scripts to update AWS SDK for JavaScript APIs.
[go: up one dir, main page]

Skip to content

kuhe/aws-sdk-js-codemod

 
 

Repository files navigation

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).

Prerequisites

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

Usage

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

Example

$ cat example.ts
import AWS from "aws-sdk";

const region = "us-west-2";
const client = new AWS.DynamoDB({ region });
client.listTables({}, (err, data) => {
  if (err) console.log(err, err.stack);
  else console.log(data);
});

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

$ cat example.ts
import { DynamoDB } from "@aws-sdk/client-dynamodb";

const region = "us-west-2";
const client = new DynamoDB({ region });
client.listTables({}, (err, data) => {
  if (err) console.log(err, err.stack);
  else console.log(data);
});

License

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

About

Codemod scripts to update AWS SDK for JavaScript APIs.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.5%
  • JavaScript 2.5%
0