UNPKG

ngx-crafter

Version:
203 lines (153 loc) โ€ข 6.93 kB
# ![logo](https://github.com/ErwanHeschung/ngx-crafter/blob/master/logo.png) ngx-crafter > **Craft your Angular projects like a pro!** โ›๏ธ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://img.shields.io/npm/v/ngx-crafter.svg)](https://www.npmjs.com/package/ngx-crafter) [![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org/) [![Angular](https://img.shields.io/badge/Angular-17+-red.svg)](https://angular.io/) A powerful CLI tool that helps you **craft** Angular projects with pre-configured folder structures and essential packages. Think of it as your personal **crafting table** for Angular development! ๐Ÿงฐ ## ๐ŸŒŸ Features - **๐Ÿ—๏ธ Smart Project Generation**: Creates Angular projects with optimized folder structures - **๐Ÿ“ฆ Package Management**: Automatically installs commonly used packages (Tailwind CSS, Angular Material, NgRx, ESLint) - **๐Ÿ”ง Dev Utilities**: Git hooks and development tools (Husky) - **๐ŸŽจ Tailwind CSS Integration**: Pre-configured utility-first CSS framework with PostCSS - **๐ŸŽฏ Custom Structures**: Support for custom folder structure configurations - **๐Ÿ”Œ Plugin System**: Extensible plugin architecture for additional features (auth, i18n, PWA, etc.) - **โšก Fast Setup**: Get your project ready in seconds, not minutes - **๐Ÿ”ง Angular 17-20 Support**: Compatible with the latest Angular versions ## ๐Ÿš€ Quick Start ### Prerequisites Before you start crafting, make sure you have: - **Node.js** (v18 or higher) ๐Ÿ“ฆ - **Angular CLI** (v17-20) โšก ```bash npm install -g @angular/cli ``` ### Installation ```bash npm install -g ngx-crafter ``` ### Usage ```bash # Basic usage with interactive prompts ngx-crafter # Use plugins for additional features (coming soon) ngx-crafter -- --with auth ngx-crafter -- --with auth,i18n,pwa # Plugin-specific options (coming soon) ngx-crafter -- --with auth --auth-provider firebase ngx-crafter -- --with pwa --pwa-name "My Awesome App" ``` That's it! The tool will guide you through the setup process with interactive prompts. ## ๐ŸŽฏ What You Get When you run `ngx-crafter`, you'll get a fully configured Angular project with: ### ๐Ÿ“ฆ Pre-configured Packages - **Tailwind CSS**: Automatically configured with PostCSS and ready to use - **Angular Material**: UI components and theming setup - **NgRx**: State management with store, effects, and devtools ### ๐Ÿ› ๏ธ Development Utilities - **Husky**: Git hooks configured with lint-staged for pre-commit code quality checks - **ESLint**: Code linting and formatting rules - **Prettier**: Code formatting and style consistency ### ๐Ÿ“ Default Folder Structure ``` src/ โ”œโ”€โ”€ app/ โ”‚ โ”œโ”€โ”€ core/ # Core application logic โ”‚ โ”‚ โ”œโ”€โ”€ services/ # Application services โ”‚ โ”‚ โ”œโ”€โ”€ guards/ # Route guards โ”‚ โ”‚ โ”œโ”€โ”€ interceptors/ # HTTP interceptors โ”‚ โ”‚ โ”œโ”€โ”€ models/ # Data models โ”‚ โ”‚ โ””โ”€โ”€ utils/ # Utility functions โ”‚ โ”œโ”€โ”€ shared/ # Shared components & services โ”‚ โ”‚ โ”œโ”€โ”€ components/ # Reusable components โ”‚ โ”‚ โ”œโ”€โ”€ directives/ # Custom directives โ”‚ โ”‚ โ”œโ”€โ”€ pipes/ # Custom pipes โ”‚ โ”‚ โ”œโ”€โ”€ models/ # Shared models โ”‚ โ”‚ โ””โ”€โ”€ services/ # Shared services โ”‚ โ”œโ”€โ”€ features/ # Feature modules โ”‚ โ”œโ”€โ”€ layouts/ # Layout components โ”‚ โ””โ”€โ”€ assets/ # Static assets โ”‚ โ”œโ”€โ”€ images/ # Image files โ”‚ โ”œโ”€โ”€ icons/ # Icon files โ”‚ โ””โ”€โ”€ fonts/ # Font files โ””โ”€โ”€ environments/ # Environment configurations ``` ### ๐Ÿ”Œ Available Plugins - **๐Ÿ” Auth**: Authentication setup with Angular Fire and Firebase (coming soon) - **๐ŸŒ i18n**: Internationalization with ngx-translate (coming soon) - **๐Ÿ“ฑ PWA**: Progressive Web App setup with Angular PWA (coming soon) - **๐Ÿ“Š CRUD**: CRUD operations setup (coming soon) - **๐Ÿงช Testing**: Enhanced testing setup (coming soon) - **๐Ÿ“š Storybook**: Storybook integration (coming soon) Plugin system infrastructure is ready! You can create your own plugins now. Provided plugins will be available in future versions. Meanwhile, check out demo-plugin as an example. ### ๐Ÿ› ๏ธ Interactive Setup The tool will ask you: 1. **Project Name**: What should we call your masterpiece? 2. **Package Selection**: Which packages do you want to include? - **Angular Material**: UI component library - **Tailwind CSS**: Utility-first CSS framework - **NgRx**: State management library 3. **Dev Utilities**: Which development utilities do you want to add? - **Husky**: Git hooks with lint-staged for pre-commit code quality - **ESLint**: Code linting and formatting - **Prettier**: Code formatting and style consistency 4. **Folder Structure**: Use default or custom structure? ## ๐ŸŽจ Custom Structures Want to craft your own folder structure? Create a JSON file like this: ```json { "src": { "app": { "core": { "services": {}, "guards": {}, "models": {} }, "features": { "auth": {}, "dashboard": {} } } } } ``` Then reference it during setup! ## ๐Ÿงฐ Development ### Building the Project ```bash npm run build ``` ### Development Mode ```bash npm run dev ``` ### Project Structure ``` ngx-crafter/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ cli.ts # Main CLI entry point โ”‚ โ”œโ”€โ”€ default-structure.json # Default folder structure โ”‚ โ””โ”€โ”€ utils/ # Utility functions โ”‚ โ”œโ”€โ”€ checkAngularCLI.ts # Angular CLI version checker โ”‚ โ”œโ”€โ”€ createFolders.ts # Folder creation logic โ”‚ โ”œโ”€โ”€ createProject.ts # Project creation logic โ”‚ โ””โ”€โ”€ prompt.ts # Interactive prompts โ”œโ”€โ”€ test/ # Test files โ”œโ”€โ”€ package.json # Project configuration โ””โ”€โ”€ tsconfig.json # TypeScript configuration ``` ## ๐Ÿค Contributing Want to help improve ngx-crafter? Here's how you can contribute: 1. **Fork** the repository ๐Ÿด 2. **Create** a feature branch (`git checkout -b feature/amazing-feature`) 3. **Commit** your changes (`git commit -m 'Add amazing feature'`) 4. **Push** to the branch (`git push origin feature/amazing-feature`) 5. **Open** a Pull Request ๐Ÿš€ ## ๐Ÿ“ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. <div align="center"> **Happy Crafting!** โ›๏ธโœจ *Built with โค๏ธ by [TOROIMERA](https://github.com/ErwanHeschung)* </div>