https://github.com/phukon/setup-cli-app
📦The easiest way to start a modern cli application with best practices and DX in mind.
https://github.com/phukon/setup-cli-app
cli developer-experience developer-tool scaffold
Last synced: 7 months ago
JSON representation
📦The easiest way to start a modern cli application with best practices and DX in mind.
- Host: GitHub
- URL: https://github.com/phukon/setup-cli-app
- Owner: phukon
- License: mit
- Created: 2024-03-01T21:55:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-02T00:37:19.000Z (over 1 year ago)
- Last Synced: 2025-02-28T04:59:14.019Z (7 months ago)
- Topics: cli, developer-experience, developer-tool, scaffold
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/setup-cli-app
- Size: 114 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
📦 Setup CLI App
The easiest way to set up a modern CLI app by running one command.
Features ·
Usage ·
Commands ·
The easiest way to start a modern cli app. It supercharges your development workflow, allowing you to quickly scaffold resources for your cli application with best practices in mind.
## Features
- **Efficient CLI Setup**: Start building your CLI app within minutes with a well-structured template and easy-to-use commands.
- **Scoped Debug Logs**: Debug logs are scoped to their names: bin, config:mgr and commands:start.
- **Modular Architecture**: Built with a modular architecture, allowing for easy customization and extension as your project grows.
- **Configuration Management**: Manage your application configurations effortlessly. Customize your app's behavior by modifying the configuration settings.
- **Error Handling**: Robust error handling mechanisms ensure smooth execution and graceful recovery from unexpected errors.
- **Build scripts**: Integrated build scripts for easy development workflow management.
- `clean`: Removes the 'dist' directory.
- `prebuild`: Executes 'clean' script before the build.
- `build`: Builds the application using 'tsup'.
- `preversion`: Executes 'build' script before versioning.
- `postversion`: Pushes tags to the repository after versioning.## 🏎️ Usage
1. Run npx setup-cli-app init. Follow the instructions. This scaffolds your project.
2. Set your config and schema at src/config. (check schema.json)
Upon building this TypeScript project, priority is given to configurations specified within the `package.json` file. Consequently, removing configurations from `package.json` will prompt the tool to adopt the new settings from the tool.config.js file.> It looks for a config file in the dir of the user who installs/uses it.
```
{
// Default configuration
"properties": {
"port": {
"type": "number"
}
}
}
```Therefore, the user, who installs or utilizes the CLI tool, must include the following property within their `package.json`:
```
// package.json
"tool": {
"port": 9999
}
```In the event that it is not specified in `package.json`, the user must provide a separate file named tool.config.js.
3. To see debug logs. Set a `DEBUG` environment variable.
4. On bumping the package version. The project is build automatically and tags are pushed to remote repo.
Or build manually with `pnpm build`
5. Run with args `setup-cli-app --start`.## Commands
All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------- | :-------------------- |
| `pnpm install` | Installs dependencies |**Under the Hood:**
- **`arg`:** Handles command-line arguments intuitively.
- **`cosmiconfig`:** Simplifies configuration management from various sources, including the current directory, user's home directory, and project-specific locations.
- **`Ajv`:** Ensures robust data validation with JSON schema support.
- **`better-ajv-errors`:** Provides clear and actionable error messages when encountering configuration issues.
- **`chalk`:** Enhances the user experience with colorful command-line output.
- **`tsup`:** Efficient and fast TypeScript module bundler for building your CLI app.
- **`rimraf`:** Cross-platform utility to remove files and directories, commonly used for cleaning build artifacts before rebuilding.