🚀 Modern CLI Tool for Streamlined Development
This is a modern CLI tool designed to simplify the development process. With just a few simple commands, you can quickly initialize projects, manage configurations, and execute common tasks.
🚀 Quick Start
Installation
npm install -g my-cli
After installation, you can invoke the tool using the command my-cli from any directory.
Initialize a New Project
my-cli init
This command creates a basic project structure and configures core dependencies.
✨ Features
Installation and Global Availability
npm install -g my-cli
Once installed, the my-cli command is available globally.
Initialize a New Project
my-cli init
This creates a basic project structure and sets up core dependencies.
📦 Installation
Basic Configuration
- Install dependencies:
npm install
- Initialize the database connection:
npm run db:init
- Start the development server:
npm start
Environment Variable Management
It is recommended to use the .env file to manage environment configurations. Create a .env file and add the following content:
PORT=3000
DB_HOST=localhost
DB_PORT=5432
Then load these environment variables in config.js:
const config = {
port: process.env.PORT || 3000,
db: {
host: process.env.DB_HOST,
port: process.env.DB_PORT
}
};
💻 Usage Examples
Create a New Project
my-cli init --name my-new-project
This creates a new directory named my-new-project and initializes the project structure inside it.
Configure Custom Endpoints
Add custom routes in app.js:
const express = require('express');
const app = express();
app.get('/api/custom', (req, res) => {
res.send({ message: 'Custom endpoint' });
});
app.listen(config.port, () => {
console.log(`Server running on port ${config.port}`);
});
Execute Database Migrations
npm run db:migrate
⚠️ Important Note
- Dependency Management: Use
package.jsonandyarn.lockto ensure all project members use the same dependency versions. - Environment Isolation: Use different
.envfiles for development and production environments to avoid configuration conflicts. - Code Style: Follow the project's code style guidelines, such as ESLint and Prettier.
🛠️ Integration with Other Tools
Type Checking
npm run typecheck
Unit Testing
npm test
🐞 Error Handling and Debugging
Common Issues
- Installation Failure:
- Ensure Node.js and npm are correctly installed.
- Check the network connection and avoid download failures due to mirror source issues.
- Startup Error:
- Check the console output for specific error messages.
- Ensure all dependencies are correctly installed and verify the configuration files.
Debugging Tips
Enable debug mode using the DEBUG environment variable:
DEBUG=my-cli npm start
🤝 Contributing
Fork the project and submit PRs! Before submitting code, make sure to pass unit tests and follow the project's code style.
📄 License
This project is licensed under the MIT License. For detailed information, please refer to the LICENSE file.
📧 Contact
If you have any questions or suggestions, please contact project@contact.com.













