-
Notifications
You must be signed in to change notification settings - Fork 35
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
feat(codemod): add codemods for fastify v4 #1254
base: main
Are you sure you want to change the base?
Conversation
@arshcodemod is attempting to deploy a commit to the Codemod Team on Vercel. A member of the Team first needs to authorize it. |
|
@@ -0,0 +1,33 @@ | |||
This codemod helps to improve error reporting in route definitions, route registration is now synchronous. As a result, if you specify an onRoute hook in a plugin you should now either: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is duplicated
## Before | ||
|
||
```jsx | ||
const fastify = require('fastify')(); | ||
|
||
fastify.get('/example', (request, reply) => { | ||
reply.send({ message: 'Hello, World!' }); | ||
}); | ||
|
||
fastify.listen(3000, () => { | ||
console.log('Server is running on http://localhost:3000'); | ||
}); | ||
|
||
``` | ||
|
||
## After | ||
|
||
```jsx | ||
const fastify = require('fastify')(); | ||
|
||
fastify.get('/example', (request, reply) => { | ||
reply.send({ message: 'Hello, World!' }); | ||
}); | ||
fastify.listen(3000, () => { | ||
console.log('Server is running on http://localhost:3000'); | ||
}); | ||
|
||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before and after look identical to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is manual change and we might not need a codemod for this. this is not required.
// Check if the route path matches the pattern '/posts/:id' | ||
if (routePath === "/posts/:id") { | ||
// Update the route path to '/posts/:id?' | ||
firstArg.value = "/posts/:id?"; | ||
dirtyFlag = true; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will work only for this specific url, rest is not handled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is manual change and we might not need a codemod for this. this is not required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include
"private": true
in packages jsons for packages that aren't meant for npm
@@ -0,0 +1,15 @@ | |||
{ | |||
"name": "@codemod/fastify-4-await-register-calls", | |||
"dependencies": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"private": true
@@ -0,0 +1,15 @@ | |||
{ | |||
"name": "@codemod/fastify-4-expose-head-routes", | |||
"dependencies": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"private": true
"name": "@codemod/fastify-4-migration-recipe", | ||
"files": ["./README.md", "./.codemodrc.json"], | ||
"type": "module" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"private": true
@@ -0,0 +1,15 @@ | |||
{ | |||
"name": "@codemod/fastify-4-remove-app-use", | |||
"dependencies": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"private": true
@@ -0,0 +1,15 @@ | |||
{ | |||
"name": "@codemod/fastify-4-reply-raw-access", | |||
"dependencies": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"private": true
@@ -0,0 +1,15 @@ | |||
{ | |||
"name": "@codemod/fastify-4-url-params-optional", | |||
"dependencies": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"private": true
@@ -0,0 +1,15 @@ | |||
{ | |||
"name": "@codemod/fastify-4-wrap-routes-plugin", | |||
"dependencies": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"private": true
Added codemods for fastify v4 upgrade :
fastify/4/await-register-calls
fastify/4/expose-head-routes
fastify/4/remove-app-use
fastify/4/reply-raw-access
fastify/4/url-params-optional
fastify/4/wrap-routes-plugin