@dbbs/cli
v0.0.7
Published
DBBs CLI for code generation
Readme
@dbbs/cli
Introduction
@dbbs/cli is a command-line tool inspired by the NestJS CLI, designed to streamline the creation and management of Turborepo monorepos. It automates the setup of project structures, integrates pre-built business solutions from our DBBS Solutions Repository, and ensures best practices across your applications.
Features
- 🚀 Quick monorepo setup with Turborepo
- 📦 Pre-built configurations for ESLint and TypeScript
- 🔧 Automated project structure generation
- 🛠️ Git hooks setup with Husky
- 📝 Standardized configuration files
- 🔌 Easy integration of new packages and applications
- 🎯 Interactive CLI with guided package and application selection
- 🌐 Direct integration with DBBS Solutions Repository
Installation
Install @dbbs/cli globally using either yarn or npm:
Using yarn:
yarn global add @dbbs/cliUsing npm:
npm install -g @dbbs/cliCommands
Initialize Project
Creates a new Turborepo monorepo with all necessary configurations.
dbbs init <projectName>Parameters
| Parameter Name | Type | Required | Description | |----------------|--------|----------|--------------------------------------------------------------------------------------------------------------------| | projectName | string | Yes | The name of the new project to be initialized. This will be used for directory creation and project configuration. |
What This Command Does
- Creates a new Turborepo monorepo structure
- Sets up essential configuration files:
.gitignore.prettierrc.json.vscode/settings.json.yarnrc.ymlMakefile
- Configures Husky for Git hooks
- Creates a
package.jsonwith workspace configuration - Fetches and integrates pre-built configurations from DBBS Solutions
Add Package or Application
Adds a new package or application to your monorepo using an interactive menu.
dbbs add
# or
dbbs add package
# or
dbbs add applicationInteractive Menu Options
Adding Packages
- Choose from available packages in the DBBS Solutions Repository
- Select multiple packages to install at once
- Packages are automatically downloaded and configured
Adding Applications
- Choose from available application templates
- Application is generated using predefined generators
- All necessary configurations are automatically set up
Examples
# Start interactive menu for adding packages or applications
dbbs add
# Start interactive menu specifically for packages
dbbs add package
# Start interactive menu specifically for applications
dbbs add applicationProject Structure
When initialized, your monorepo will follow this structure:
📂 <app-name>/
│── 📄 package.json
│── 📄 tsconfig.json
│── 📄 .gitignore
│── 📄 .prettierrc.json
│── 📄 .yarnrc.yml
│── 📄 Makefile
│── 📂 .vscode/
│ ├── 📄 settings.json
│── 📂 .husky/
│ ├── 📄 pre-commit
│── 📂 typescript/
│ ├── 📂 apps/
│ ├── 📂 packages/
│ ├── 📂 eslint-config/
│ │ ├── 📄 package.json
│ │ ├── 📄 README.md
│ │ ├── 📄 node.js
│ │ ├── 📄 react.js
│ │ ├── 📄 react-native.js
│ ├── 📂 tsconfig/
│ ├── 📄 package.json
│ ├── 📄 README.md
│ ├── 📄 base.json
│ ├── 📄 react-spa.json
│ ├── 📄 react-native.jsonConfiguration Files
ESLint Configuration
The CLI sets up ESLint with pre-configured rules for:
- Node.js applications
- React applications
- React Native applications
TypeScript Configuration
Pre-built TypeScript configurations for:
- Base configuration
- React SPA
- React Native
Git Hooks
Husky is configured with pre-commit hooks to ensure code quality.
Best Practices
Project Naming
- Use kebab-case for project names
- Avoid special characters
- Use descriptive names that reflect the project's purpose
Package Management
- Use Yarn as the package manager
- Workspaces are automatically configured for monorepo management
Code Quality
- Pre-commit hooks ensure code quality
- ESLint and Prettier configurations are pre-set
- TypeScript configurations are optimized for different project types
Troubleshooting
Common Issues
Installation Fails
# Try clearing yarn cache yarn cache clean # Reinstall the CLI yarn global remove @dbbs/cli yarn global add @dbbs/cliPermission Issues
# Fix permissions for global installation sudo chown -R $USER:$GROUP ~/.config sudo chown -R $USER:$GROUP ~/.local
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
The DBBS CLI is open-source software licensed under the MIT License.
Authors and Maintainers
- Andrii Bilous
- Roman Bobrovskiy
External Dependencies
yargs- CLI argument parsingtypescript- TypeScript supportinquirer- Interactive command line interface
Related Projects
- DBBS Solutions Repository - Collection of pre-built solutions and templates
