codemod-com / codemod

The e2e platform for creating, sharing, and running codemods, built on top of your favorite codemod engine. Automate code migrations, cleanups, and refactors for yourself, colleagues, and the community.
https://codemod.com
Apache License 2.0
225 stars 10 forks source link

[cli] codemod index.cjs detection fails on GitHub Actions #1007

Open foxted opened 6 days ago

foxted commented 6 days ago

HI there,

I'm trying to run codemod on Github Actions using the following npx command:

npx codemod --source /path/to/my-codemod-repo --target /path/to/my-target-repo

But it seems like the index.cjs detection doesn't work.

Output:

Run ls -la /path/to/my-codemod-repo/dist
total 12
drwxr-xr-x 2 runner docker 4096 Jun 27 22:23 .
drwxr-xr-x 8 runner docker 4096 Jun 27 22:23 ..
-rw-r--r-- 1 runner docker 2027 Jun 27 22:23 index.cjs

npx codemod --source /path/to/my-codemod-repo --target /path/to/my-target-repo
npm warn exec The following package was not found and will be installed: codemod@0.11.21

Could not find the main file of the codemod with name index.cjs. Did you forget to run "codemod build"?

I tried both with the index.cjs committed to my repo and running codemod build in the previous steps of the pipeline, but nothing seems to help.

Looks like an issue with this function, but so far I am not sure what could be going wrong: https://github.com/codemod-com/codemod/blob/main/apps/cli/src/utils.ts#L133.

alexbit-codemod commented 6 days ago

@foxted, thanks for reporting this issue. i'll have the team look into it. in the meantime, can you share more details for repro? is it for a private codemod? with jscodeshift? and for --source did you use the path to the codemod folder?

you can also chat with me/team/community here: https://go.codemod.com/community

foxted commented 6 days ago

The community link you shared is a 404 on my end.

alexbit-codemod commented 6 days ago
  1. gotcha. you can also share a Codemod Studio link like this https://go.codemod.com/h8HkdrS
  2. fixed the URL for our slack channel.
foxted commented 6 days ago

Here's the repo: https://github.com/foxted/codemod-polyfill