Skip to content

chore(template): update #1633

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

AugustinMauroy
Copy link
Contributor

Description

Update JSSG example to make it functional and related to lasted change

Copy link

vercel bot commented Jul 22, 2025

@AugustinMauroy is attempting to deploy a commit to the Codemod Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

pkg-pr-new bot commented Jul 22, 2025

Open in StackBlitz

npm i https://pkg.pr.new/codemod@1633

commit: d48298b

@mohab-sameh mohab-sameh requested a review from mohebifar July 22, 2025 14:25
Copy link
Member

@mohebifar mohebifar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! And this was so overdue! Thanks. Just a comment on the codemod file name

},
"scripts": {
"test": "node tests/test.js",
"apply": "node scripts/apply-codemod.js"
"test": "npx codemod@next jssg test -l typescript ./scripts/codemod.js.ts",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"test": "npx codemod@next jssg test -l typescript ./scripts/codemod.js.ts",
"test": "npx codemod@next jssg test -l typescript ./scripts/codemod.ts",

js-ast-grep:
js_file: "scripts/codemod.ts"
base_path: "."
js_file: scripts/codemod.js.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why .js.ts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because in the example the transform function that touch js file is call like that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's the template file names. When the file gets created, it's actually named codemod.ts always:

fs::write(scripts_dir.join("codemod.ts"), codemod_script.as_str())?;

that .<lang> extension prefix is just for the template file name in our source code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool cool cool let's me update that

},
"devDependencies": {
"@codemod.com/jssg-types": "^1.0.3"
"@codemod.com/jssg-types": "^1.0.3",
"typescript": "^5.8.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants