-
shadcn/ui
A set of beautifully-designed, accessible components and a code distribution platform. Works with your favorite frameworks. Open Source. Open Code.
// source: https://github.com/shadcn-ui/ui/blob/main/packages/cli/src/index.ts #!/usr/bin/env node import { add } from "@/src/commands/add" import { diff } from "@/src/commands/diff" import { init } from "@/src/commands/init" import { Command } from "commander" import { getPackageInfo } from "./utils/get-package-info" process.on("SIGINT", () => process.exit(0)) process.on("SIGTERM", () => process.exit(0)) async function main() { const packageInfo = await getPackageInfo() const 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) program.parse() } main()
-
Sevalla
Deploy and host your apps and databases, now with $50 credit! Sevalla is the PaaS you have been looking for! Advanced deployment pipelines, usage-based pricing, preview apps, templates, human support by developers, and much more!
-
Commander is an npm package used here to enable CLI interactions.
-
Notice how there’s an enforced PackageJson type from type-fest. It is from the Legend, Sindre Sorhus. I see this guy’s name so often when I dig into open source.
-
fs.readJSONSync reads a JSON file and then parses it into an object. In this case, it is an object of type PackageJson.
Related posts
-
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 3.0
-
shadcn-ui/ui codebase analysis: How does shadcn-ui CLI work? — Part 2.8
-
Создаем React-компоненты иконок с помощью Figma API и SVGR. Часть 1.
-
The minimal setup to package and reuse your React components
-
How to make automated backups of your Ghost blog with node.js