This recipe provides a set of codemods designed to assist with migrating to Fastify 5. Each codemod addresses specific changes and enhancements introduced in Fastify 5.
Included Codemods
fastify/5/req-params-hasOwnProperty-to-objectHasOwn
: Convertsreq.params.hasOwnProperty
toObject.hasOwn
.fastify/5/listen-arg-transformation
: Updates the transformation of arguments passed tolisten
.fastify/5/replace-hardcoded-url-in-hasroute
: Replaces hardcoded URLs inhasRoute
checks.fastify/5/replace-reply-sent-with-hijack
: Replacesreply.sent
withreply.hijack
.fastify/5/add-expose-head-routes-option
: Adds theexposeHeadRoutes
option where necessary.fastify/5/decorate-request-to-getter-method
: Converts request decorators to getter methods.fastify/5/route-schema-enhancement
: Enhances route schemas with new features.fastify/5/req-connection-to-socket
: Convertsreq.connection
toreq.socket
.fastify/5/getResponseTime-to-elapsedTime
: RenamesgetResponseTime
toelapsedTime
.fastify/5/redirect-arg-order
: Updates the argument order forredirect
.fastify/5/make-reply-trailer-async
: Convertsreply.trailer
to an async method.fastify/5/remove-done-callback
: Changesplugin.register
fromdone
callback toreturn
.fastify/5/rename-logger-to-logger-instance
: Renameslogger
tologgerInstance
.
These codemods will help streamline your migration process and ensure compatibility with Fastify 5.
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community