This project was created using bun create mcmd-app
in Bun. Bun is a fast all-in-one JavaScript runtime.
bun install
Transpile the code (dev mode)
bun run transpile
# or
# bunx mcmd transpile
Run the CLI (dev mode)
bun run cli --name Rajat
# or
# bun run ./.mcmd/cli.ts
Build the CLI
bun run build
# or
# bunx mcmd build
root
├── .mcmd
├── node_modules
│
├─┬ app
│ ├── index.ts # npx my-cli
│ ├─┬ init
│ │ ├── something.ts # npx my-cli init something
│ │ └── index.ts # npx my-cli init
│ └── login.ts # npx my-cli login
│
├── package.json
├── build.ts
├── .gitignore
├── README.md
└── tsconfig.json
Don't need to import zod
or Command
, we'll handle everything for you.
// app/index.ts
export const options = z.object({
name: z.string()
});
export default Command((data) => {
const { name } = data;
console.log("Hi", name);
});
// npx my-cli --name Rajat
// app/init.ts
export default () => {
console.log("Done Init");
};
// npx my-cli init
bun run build
# or
# bunx mcmd build
// package.json
{
"name": "my-cli",
"version": "0.0.0",
"bin": "./dist/cli.js",
"files": ["dist/**/*"],
...
}
bun publish
bunx my-cli --name Rajat