We have seen that init command is added to the program in the index.ts as shown below:
// https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/index.tsconst program = new Command() .name("shadcn-ui") .description("add components and dependencies to your project") .version( packageInfo.version || "1.0.0", "-v, --version", "display the version number" ) program.addCommand(init).addCommand(add).addCommand(diff)
I created an example project on Github that demonstrates the usage of Commander.js, tsup and init command configuration in shadcn-ui/ui CLI package. These CLI options are parsed with zod before performing any further operations.
Want to learn how to build shadcn-ui/ui from scratch? Check outbuild-from-scratch
Hey, my name is Ramu Narasinga. I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.