Skip to content

rajatsandeepsen/create-mcmd-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCMD Starter Template

This project was created using bun create mcmd-app in Bun. Bun is a fast all-in-one JavaScript runtime.

Installation

bun install

Usage

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

Folder Structure

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

Coding

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

Final Build

bun run build

# or
# bunx mcmd build

Publish CLI

// package.json
{
    "name": "my-cli",
    "version": "0.0.0",
    "bin": "./dist/cli.js",
    "files": ["dist/**/*"],
    ...
}
bun publish

Enjoy CLI

bunx my-cli --name Rajat

References

About

Starter Template for MCMD - Meta framework for building CLI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published