@trapar-waves/cli-template
v1.1.20
Published
A CLI template with TypeScript, tsup, consola, destr, and picocolors, offering efficient builds, logging, data parsing, and colorful output, with ESLint for quality.
Maintainers
Readme
@trapar-waves/cli-template
中文 | 日本語 | Русский язык
A CLI development template powered by modern tooling, integrating TypeScript, tsup for builds, consola for logging, and other core components to accelerate high-quality CLI project setup.
✨ Features
- CLI Toolchain: Integrates
ts-node(for direct TypeScript execution during development) andtsup(for production-grade builds), supporting the full workflow from debugging to deployment. - TypeScript Support: Full TypeScript configuration (including
tsconfig.json) with type checking and auto-completion to ensure code maintainability. - Structured Logging: Implements leveled logging (info/warn/error), custom formatting, and context-aware messages via
consolato enhance debugging efficiency. - Data Parsing: Built-in
destrfor safe parsing of JSON-like data (e.g., CLI arguments, config files), preventing exceptions fromJSON.parse. - Terminal Styling: Uses lightweight
picocolorsfor cross-platform terminal color support (160+ color codes) and styles (bold/underline) to improve CLI interactivity. - Code Quality: Integrated ESLint (based on
@antfu/eslint-config) for automated code style checks, error detection, and best practice enforcement. - Rapid Builds:
tsupdefault configuration supports ESM output, source maps, and type declaration generation, with 30%+ faster build times compared to traditional tools.
💻 Tech Stack
- Language:
TypeScript: Typed superset of JavaScript with static type checking and modern syntax. - Build Tool:
tsup: Fast bundler based on esbuild, supporting ESM, CommonJS, and type declaration outputs. - Logging:
consola: Structured logging library with leveled messages, custom themes, and context support. - Data Handling:
destr: Safe parser for JSON-like strings (e.g., CLI arguments) to preventJSON.parseerrors. - Terminal Styling:
picocolors: Lightweight cross-platform terminal color library with 160+ color codes and styles (bold/underline). - Code Linting:
ESLint+@antfu/eslint-config: Modern JavaScript/TypeScript linting rules with auto-fix for style and error issues. - Package Manager:
pnpm: Content-addressable package manager with faster installs and reduced disk usage (seepnpm-lock.yaml).
See the package.json for a full list of dependencies.
🚀 Getting Started
Follow these instructions to get the project running locally.
Prerequisites
Ensure you have the following installed:
- Node.js (>= 18.x recommended)
- Package manager (npm, yarn, or pnpm)
node -v
npm -vInstallation
Using create-trapar-waves to scaffold a new project:
pnpm create trapar-wavesOr, if you prefer to manually set up the template:
- Clone the repository:
git clone https://github.com/Trapar-waves/cli-template.git cd cli-template - Install dependencies:
pnpm install # or npm install # or yarn install
Development
To run the CLI in development mode with ts-node:
pnpm start
# or
npm run startBuilding
To build the CLI for production with tsup:
pnpm build
# or
npm run buildThis will output the compiled JavaScript to the dist directory.
🤝 Contributing
Contributions are welcome and greatly appreciated! Please follow these steps to contribute:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your code adheres to the project's linting rules by running pnpm lint before committing.
👤 Author
- Rikka: ([email protected])
- GitHub Profile: Muromi-Rikka
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
