Git Product home page Git Product logo

aws-sdk-js-codemod's Introduction

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

  • 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 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@latest -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.

aws-sdk-js-codemod's People

Contributors

trivikr avatar github-actions[bot] avatar renovate[bot] avatar ishmaello avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.