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

[Feature]: Provide an option to transform only specific clients #589

Open
1 task
trivikr opened this issue Sep 15, 2023 · 0 comments
Open
1 task

[Feature]: Provide an option to transform only specific clients #589

trivikr opened this issue Sep 15, 2023 · 0 comments
Labels
enhancement New feature or request p2 This is a standard priority issue

Comments

@trivikr
Copy link
Member

trivikr commented Sep 15, 2023

Self-service

  • I'd be willing to implement this feature

Problem

Application code may use multiple JS SDK clients. Transforming all of them in one pass might be difficult, and user might want to transform specific clients.

For example, in the following code user might want to transform only S3 client

import AWS from "aws-sdk";

const s3Client = new AWS.S3();
const ddbClient = new AWS.DynamoDB();

Then, the output should be:

import AWS from "aws-sdk";
import { S3 } from "@aws-sdk/client-s3";

const s3Client = new S3();
const ddbClient = new AWS.DynamoDB();

Solution

Provide an option which user can pass at top-level when running codemod.

The option can be clients and it can be passed as follows:

$ npx aws-sdk-js-codemod@latest -t v2-to-v3 --clients s3 **/*.js

Alternatives

If user has written application code in such a way, that it's separated into folders based on clients they can run existing codemod on specific folders.

For example:

$ npx aws-sdk-js-codemod@latest -t v2-to-v3 src/s3/*.js

However, this requires application code to be refactored.
We can't expect users to do that.

Additional context

Example code: https://github.com/aws-solutions/qnabot-on-aws/blob/7fb99e0c716ad7c6702f630f46d5626ad3cb5a69/bin/build.js#L10-L11

@trivikr trivikr added enhancement New feature or request p2 This is a standard priority issue labels Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

1 participant