Giter Club home page Giter Club logo

trpc-v10-migrate-codemod's Introduction

trpc-v10-migrate-codemod

codemod to migrate your tRPC codebase from v9 to v10

This codemod will not perform a complete transformation. Rather, it is meant to help you with the most straightforward changes. Additionally, please examine the transformed code to ensure that it is correct.

Usage

npx trpc-v10-migrate-codemod

Warning It is recommended to run this codemod on a clean branch to ensure your changes are not lost.

This command will migrate all files included in your tsconfig.json to v10.

Current transformations:

  • v9 router to v10 router
  • v9 React client to v10 proxy React client
  • createCaller to proxy caller

Options

Run npx trpc-v10-migrate-codemod --help to see all options.

--tsconfig-path - path to your tsconfig.json file (default = 'tsconfig.json')

--react-namespace - namespace of your tRPC React hooks (can be specified multiple times) (default = 'trpc')

--caller-namespace - namespace of your tRPC createCallers (i.e. const caller = appRouter.createCaller()) (can be specified multiple times) (default = 'caller')

--context-namespace - namespace of your tRPC context helpers (i.e. const utils = trpc.useContext()) (can be specified multiple times) (default = 'utils')

--router-factory - the function you use to create your routers (i.e. createRouter, createProtectedRouter) (can be specified multiple times) (default = ['router'])

--base-procedure - the base procedure unit for v10 (i.e. adminProcedure) (default = 't.procedure') --import - named import to add to the top of every file with a transformed router (can be specified multiple times)

  • structure is [named import]:[module specifier]
  • example: --import t:~/server/trpc --import adminProcedure:~/server/trpc

--remove-import - named import to remove from every file with a transformed router (can be specified multiple times)

  • structure is [named import]:[module specifier]
  • example: --remove-import createRouter:~/server/trpc

trpc-v10-migrate-codemod's People

Contributors

sachinraja avatar renovate[bot] avatar rayzr522 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.