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

[Bug?]: Codemod not doing anything #486

Closed
1 task
Alex-Van-Dijck opened this issue May 2, 2023 · 4 comments
Closed
1 task

[Bug?]: Codemod not doing anything #486

Alex-Van-Dijck opened this issue May 2, 2023 · 4 comments
Labels
invalid This doesn't seem right

Comments

@Alex-Van-Dijck
Copy link

Alex-Van-Dijck commented May 2, 2023

Self-service

  • I'd be willing to implement a fix

Describe the bug

aws-sdk-js-codemod flags all files using 'old code' as 'ok'.

Steps to reproduce

Follow the 'using codemod' steps as listed on
https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/migrating-to-v3.html

Observed behavior

the script returned

Processing 1 files... 
Spawning 1 workers...
Sending 1 files to free worker...
All done. 
Results:
0 errors
0 unmodified
0 skipped
1 ok
Time elapsed: 1.096seconds 

where example .ts is

// 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);
});

Expected behavior

Expected to actually modify the file instead of pasting the same text in again.

Environment

aws-sdk-js-codemod: 0.14.1
- jscodeshift: 0.14.0
- recast: 0.21.5

Additional context

No response

@Alex-Van-Dijck Alex-Van-Dijck added bug Something isn't working triage Triaging bugs labels May 2, 2023
@shortstuffsushi
Copy link

I am seeing the same issue on 0.14.1. When I run against my project, it succeeds without error, but makes no changes.

@trivikr
Copy link
Member

trivikr commented Sep 7, 2023

I'm not able to reproduce this, as codemod migrates the code for me.

$ 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
...
Results: 
0 errors
0 unmodified
0 skipped
1 ok
Time elapsed: 0.262seconds

$ 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);
});

This is a basic transformation, and should have worked in v0.14.1 too.


In the past, I'd noticed the jscodeshift didn't run our transform on certain platforms or configurations. For example, one user in #478 had to pass transform file explicitly.
The follow-up issue is open upstream in facebook/jscodeshift#554


From your report, it appears that transformer was run but no transformation happened.
Can you provide more info to help us debug further? Like running with the latest version, and providing details of your environement (node/OS version).

@Alex-Van-Dijck
Copy link
Author

Alex-Van-Dijck commented Sep 8, 2023

From your report, it appears that transformer was run but no transformation happened. Can you provide more info to help us debug further? Like running with the latest version, and providing details of your environement (node/OS version).

Hi, I'm sorry but I no longer possess the environment in which I was trying to get the codemod to work.

@trivikr trivikr added invalid This doesn't seem right and removed triage Triaging bugs bug Something isn't working labels Sep 8, 2023
@trivikr trivikr closed this as completed Sep 8, 2023
@github-actions
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants