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.hasOwnPropertytoObject.hasOwn.fastify/5/listen-arg-transformation: Updates the transformation of arguments passed tolisten.fastify/5/replace-hardcoded-url-in-hasroute: Replaces hardcoded URLs inhasRoutechecks.fastify/5/replace-reply-sent-with-hijack: Replacesreply.sentwithreply.hijack.fastify/5/add-expose-head-routes-option: Adds theexposeHeadRoutesoption 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.connectiontoreq.socket.fastify/5/getResponseTime-to-elapsedTime: RenamesgetResponseTimetoelapsedTime.fastify/5/redirect-arg-order: Updates the argument order forredirect.fastify/5/make-reply-trailer-async: Convertsreply.trailerto an async method.fastify/5/remove-done-callback: Changesplugin.registerfromdonecallback toreturn.fastify/5/rename-logger-to-logger-instance: RenamesloggertologgerInstance.
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