create-ng-tailwind 1.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +209 -8
- package/CLAUDE.md +178 -0
- package/LICENSE +1 -1
- package/README.md +151 -246
- package/bin/create-ng-tailwind.js +5 -407
- package/lib/cli/index.js +222 -0
- package/lib/cli/interactive.js +26 -0
- package/lib/cli/validators.js +23 -0
- package/lib/config/defaults.js +7 -0
- package/lib/managers/ProjectManager.js +97 -0
- package/lib/managers/TailwindManager.js +100 -0
- package/lib/managers/TemplateManager.js +39 -0
- package/lib/templates/index.js +7 -0
- package/lib/templates/minimal/index.js +24 -0
- package/lib/templates/starter/advanced-features.js +528 -0
- package/lib/templates/starter/features.js +700 -0
- package/lib/templates/starter/index.js +4117 -0
- package/lib/templates/starter/ui-features.js +437 -0
- package/lib/utils/ai-config.js +606 -0
- package/lib/utils/constants.js +14 -0
- package/lib/utils/helpers.js +60 -0
- package/lib/utils/logger.js +109 -0
- package/package.json +6 -15
package/CHANGELOG.md
CHANGED
|
@@ -5,39 +5,240 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [2.0.0] - 2025-01-20
|
|
9
|
+
|
|
10
|
+
**Major Release with Breaking Changes** - This release includes significant updates to the CLI architecture, template system, and development workflow. Review the breaking changes and migration guide below before upgrading.
|
|
11
|
+
|
|
12
|
+
### 📈 Release Highlights
|
|
13
|
+
|
|
14
|
+
- ✨ **Professional Starter Template** with 20+ production-ready features (i18n, auth UI, interceptors, services)
|
|
15
|
+
- 🎨 **Simplified CSS-Only Approach** aligned with Tailwind v4 official recommendations
|
|
16
|
+
- 🎯 **Enhanced User Experience** with interactive mode by default (like `ng new`)
|
|
17
|
+
- 🔒 **Private Repository Model** focused on quality and stability
|
|
18
|
+
- 🤖 **Advanced AI Integration** supporting 6 different AI development tools
|
|
19
|
+
- 🎮 **Interactive UI Components** including Toast notifications, Modal dialogs, and custom directives
|
|
20
|
+
|
|
21
|
+
### 🚨 BREAKING CHANGES
|
|
22
|
+
|
|
23
|
+
- **CSS-Only Approach**: Removed SCSS/Sass/Less support - CSS is now the only stylesheet option (aligns with Tailwind v4 official recommendations)
|
|
24
|
+
- **Template System Redesign**: Changed template option from "none" to "minimal" for better clarity
|
|
25
|
+
- **Interactive Mode is Default**: Removed `--interactive` flag - interactive mode is now default behavior (like `ng new`)
|
|
26
|
+
- **Repository Now Private**: No longer accepting public contributions - package remains available on npm
|
|
27
|
+
|
|
28
|
+
### 🎉 Major New Features
|
|
29
|
+
|
|
30
|
+
- 🤖 **AI Configuration Files (Tool-Specific)**
|
|
31
|
+
|
|
32
|
+
- Creates `.claude/claude.md` if Claude is selected
|
|
33
|
+
- Creates `.cursorrules` if Cursor is selected
|
|
34
|
+
- Creates `.windsurfrules` if Windsurf is selected
|
|
35
|
+
- Each config file includes comprehensive Angular + Tailwind guidelines
|
|
36
|
+
- Includes project structure, tech stack, coding patterns, and examples
|
|
37
|
+
- Works with Claude Code, Cursor, Copilot, Windsurf, Gemini, and JetBrains
|
|
38
|
+
- ~400 lines of context for AI assistants
|
|
39
|
+
|
|
40
|
+
- ⚡ **HTTP Interceptors (Starter Template)**
|
|
41
|
+
|
|
42
|
+
- **Auth Interceptor** - Automatically adds JWT tokens to requests
|
|
43
|
+
- **Error Interceptor** - Global error handling with toast notifications
|
|
44
|
+
- **Loading Interceptor** - Shows/hides loading state automatically
|
|
45
|
+
- **Caching Interceptor** - Caches GET requests (5min TTL)
|
|
46
|
+
- All interceptors pre-configured in `app.config.ts`
|
|
47
|
+
|
|
48
|
+
- 🔔 **Toast/Notification System (Starter Template)**
|
|
49
|
+
|
|
50
|
+
- `ToastService` with success, error, warning, info methods
|
|
51
|
+
- Animated toast component with auto-dismiss
|
|
52
|
+
- Queue management for multiple toasts
|
|
53
|
+
- Fully integrated in root app component
|
|
54
|
+
|
|
55
|
+
- 💬 **Modal/Dialog System (Starter Template)**
|
|
56
|
+
|
|
57
|
+
- `ModalService` with confirm, alert, and custom modal support
|
|
58
|
+
- Promise-based API for easy async handling
|
|
59
|
+
- Configurable sizes (sm, md, lg, xl, full)
|
|
60
|
+
- Gray semi-transparent backdrop (bg-opacity-30) for better visibility
|
|
61
|
+
- Backdrop click and ESC key support
|
|
62
|
+
- Full keyboard accessibility (ARIA roles, tabindex)
|
|
63
|
+
|
|
64
|
+
- 🔧 **Truncate Pipe (Starter Template)**
|
|
65
|
+
|
|
66
|
+
- `TruncatePipe` - Text truncation with word boundaries and custom ellipsis
|
|
67
|
+
|
|
68
|
+
- 🎮 **Interactive Examples on Home Page (Starter Template)**
|
|
69
|
+
|
|
70
|
+
- Live Toast notification examples (Success, Error, Warning, Info)
|
|
71
|
+
- Modal dialog demonstrations (Confirm, Alert)
|
|
72
|
+
- Practical code examples showing ToastService and ModalService usage
|
|
73
|
+
- Helps users understand how to use included services
|
|
74
|
+
|
|
75
|
+
- ✨ **Custom Directives (Starter Template)**
|
|
76
|
+
|
|
77
|
+
- `ClickOutsideDirective` - Detect clicks outside element
|
|
78
|
+
- `TooltipDirective` - Beautiful tooltips with positioning
|
|
79
|
+
|
|
80
|
+
- 🛠️ **Supporting Services (Starter Template)**
|
|
81
|
+
- `LoadingService` - Reactive loading state with signals
|
|
82
|
+
- `CacheService` - HTTP response caching with TTL
|
|
83
|
+
|
|
84
|
+
### 🔧 Changed
|
|
85
|
+
|
|
86
|
+
- **Template Renamed**: "none" → "minimal" for better clarity
|
|
87
|
+
- **Interactive Mode is Default**: CLI now prompts for all configuration options by default (like `ng new`)
|
|
88
|
+
- **Repository Visibility**: Changed from public to private repository
|
|
89
|
+
- **Package Structure**: Simplified to focus on core CLI functionality
|
|
90
|
+
- **Documentation**: Updated all documentation to reflect private repository model
|
|
91
|
+
|
|
92
|
+
### 🗑️ Removed
|
|
93
|
+
|
|
94
|
+
- **Test Suite**: Removed `test.js` and all test-related infrastructure
|
|
95
|
+
- **Public Contributions**: Removed CONTRIBUTING.md and contribution workflow
|
|
96
|
+
- **GitHub Integration**: Removed repository URLs and issue tracking references
|
|
97
|
+
- **SCSS/Sass/Less Support**: Removed preprocessor support (CSS-only approach for Tailwind v4)
|
|
98
|
+
|
|
99
|
+
### 🐛 Fixed
|
|
100
|
+
|
|
101
|
+
- 🔧 **ESLint & TypeScript Compliance (Starter Template)**
|
|
102
|
+
|
|
103
|
+
- Created proper `ModalData` interface with typed properties
|
|
104
|
+
- Replaced `HttpResponse<any>` with `HttpResponse<unknown>` in CacheService
|
|
105
|
+
- Removed unused imports (createComponent, ApplicationRef, EnvironmentInjector)
|
|
106
|
+
- Fixed accessibility issues in ModalComponent (ARIA roles, keyboard handlers)
|
|
107
|
+
- Added helper methods (`getModalType()`, `getModalMessage()`) to avoid index signature issues
|
|
108
|
+
- Used `eslint-disable-next-line` for legitimate `any` use in Promise resolver
|
|
109
|
+
- **Fixed Angular v20 `app.ts` ESLint error** - Added "App" to allowed component class suffixes to support Angular v20's new naming convention
|
|
110
|
+
- All generated code now compiles and passes `ng lint` without errors
|
|
111
|
+
|
|
112
|
+
- 📝 **Template Renamed: "none" → "minimal"**
|
|
113
|
+
|
|
114
|
+
- Better clarity: "Minimal" describes clean Angular + Tailwind starter
|
|
115
|
+
- Updated CLI descriptions to show feature differences
|
|
116
|
+
- All documentation and prompts updated
|
|
117
|
+
|
|
118
|
+
- 🎨 **Starter Template Enhanced**
|
|
119
|
+
|
|
120
|
+
- Updated feature list in CLI with all new capabilities
|
|
121
|
+
- Now shows: "Professional foundation (routing, i18n, auth UI, components, services, interceptors)"
|
|
122
|
+
- Feature count increased from 15 to 20+ features
|
|
123
|
+
|
|
124
|
+
- 🎯 **CSS-Only Approach (Tailwind v4 Official)** 🚨 **BREAKING CHANGE**
|
|
125
|
+
|
|
126
|
+
- **Removed SCSS/Sass/Less support** - CSS is now the only stylesheet option
|
|
127
|
+
- Aligns with **Tailwind CSS v4 official recommendations** (v4 doesn't support preprocessors)
|
|
128
|
+
- Removed `--style` CLI option
|
|
129
|
+
- Removed stylesheet format prompt from interactive mode
|
|
130
|
+
- Always uses CSS with modern features (nesting, variables)
|
|
131
|
+
- Simpler, faster builds with PostCSS + LightningCSS
|
|
132
|
+
- Migration note: If you need SCSS, use Tailwind CSS v3 or migrate to modern CSS
|
|
133
|
+
|
|
134
|
+
- 🎯 **Interactive Mode is Now Default** (Like `ng new`)
|
|
135
|
+
- CLI now prompts for all configuration options by default
|
|
136
|
+
- Removed `--interactive` flag (interactive is now the default behavior)
|
|
137
|
+
- Questions asked in order:
|
|
138
|
+
1. Project name (if not provided)
|
|
139
|
+
2. Template (None or Starter)
|
|
140
|
+
3. Enable SSR? (Server-Side Rendering)
|
|
141
|
+
4. Enable Zoneless? (without zone.js)
|
|
142
|
+
5. AI tools to configure (None, Claude, Cursor, Gemini, Copilot, JetBrains, Windsurf) - **Multiple selection supported**
|
|
143
|
+
- All prompts can be skipped by providing values via CLI flags
|
|
144
|
+
- Example: `npx create-ng-tailwind my-app --template=starter`
|
|
145
|
+
|
|
146
|
+
### Added
|
|
147
|
+
|
|
148
|
+
- 🎨 **New CLI Options**:
|
|
149
|
+
- `--routing` / `--no-routing` - Enable/disable Angular routing
|
|
150
|
+
- `--ssr` - Enable Server-Side Rendering
|
|
151
|
+
- `--zoneless` - Create zoneless application
|
|
152
|
+
- `--ai-config <tools>` - Configure AI tools (delegated to Angular CLI)
|
|
153
|
+
- 🌍 **i18n Translation Support** (Starter template)
|
|
154
|
+
- Full English and Arabic translations
|
|
155
|
+
- Reactive language switcher in header (desktop & mobile)
|
|
156
|
+
- RTL (Right-to-Left) support for Arabic
|
|
157
|
+
- Auto-detects browser language
|
|
158
|
+
- Saves language preference to localStorage
|
|
159
|
+
- Uses `@ngx-translate` with HTTP loader
|
|
160
|
+
- Translation files in `public/assets/i18n/`
|
|
161
|
+
- All components, pages, and UI elements translated
|
|
162
|
+
- 📁 **Assets now in `public/assets/`** instead of `src/assets/`
|
|
163
|
+
- Translation files: `public/assets/i18n/`
|
|
164
|
+
- Images: `public/assets/images/`
|
|
165
|
+
- Removed empty `src/styles/` folder
|
|
166
|
+
|
|
167
|
+
### Improved
|
|
168
|
+
|
|
169
|
+
- Better user experience: Interactive prompts guide users through setup like `ng new`
|
|
170
|
+
- More discoverable: Users see all available options during setup
|
|
171
|
+
- Proper Angular project structure with assets in public folder
|
|
172
|
+
- Fast mode available for CI/CD by providing all options via flags
|
|
173
|
+
- AI configuration delegated to Angular CLI for native support and updates
|
|
174
|
+
|
|
175
|
+
### 📊 Migration Guide from v1.x to v2.0
|
|
176
|
+
|
|
177
|
+
#### Breaking Changes Impact:
|
|
178
|
+
|
|
179
|
+
1. **CSS-Only Approach**:
|
|
180
|
+
- **Before (v1.x)**: `--style` flag supported css, scss, sass, less
|
|
181
|
+
- **After (v2.0)**: Only CSS is supported (--style flag removed)
|
|
182
|
+
- **Migration**: If you need SCSS, continue using v1.x or migrate to modern CSS
|
|
183
|
+
|
|
184
|
+
2. **Template Names**:
|
|
185
|
+
- **Before (v1.x)**: `--template=none`
|
|
186
|
+
- **After (v2.0)**: `--template=minimal`
|
|
187
|
+
- **Migration**: Update scripts to use `minimal` instead of `none`
|
|
188
|
+
|
|
189
|
+
3. **Interactive Mode**:
|
|
190
|
+
- **Before (v1.x)**: Non-interactive by default, `--interactive` flag to enable
|
|
191
|
+
- **After (v2.0)**: Interactive by default, provide all flags to skip prompts
|
|
192
|
+
- **Migration**: Add all required flags to CI/CD scripts for non-interactive mode
|
|
193
|
+
|
|
194
|
+
4. **Repository & Support**:
|
|
195
|
+
- **Before (v1.x)**: Public repository accepting contributions
|
|
196
|
+
- **After (v2.0)**: Private repository, email-based support only
|
|
197
|
+
- **Migration**: Contact via email for support (tehseen_ullah786@hotmail.com)
|
|
198
|
+
|
|
199
|
+
#### Recommended Update Command:
|
|
200
|
+
```bash
|
|
201
|
+
# Update to v2.0.0
|
|
202
|
+
npx create-ng-tailwind@latest my-app --template=minimal
|
|
203
|
+
|
|
204
|
+
# Or with starter template (recommended)
|
|
205
|
+
npx create-ng-tailwind@latest my-app --template=starter
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## [1.0.0] - 2025-09-03
|
|
9
211
|
|
|
10
212
|
### Added
|
|
213
|
+
|
|
11
214
|
- 🚀 Initial release of create-ng-tailwind CLI
|
|
12
|
-
- ✨ Angular 20 project scaffolding with Tailwind
|
|
13
|
-
- 🎨 Modern Tailwind
|
|
215
|
+
- ✨ Angular 20 project scaffolding with Tailwind preconfigured
|
|
216
|
+
- 🎨 Modern Tailwind setup using `@tailwindcss/postcss`
|
|
14
217
|
- 📋 Interactive mode (`--interactive`) with guided prompts
|
|
15
218
|
- ⚡ Fast non-interactive mode with best practice defaults
|
|
16
219
|
- 🛠️ Traditional Angular file naming (`*.component.*`)
|
|
17
220
|
- 🔧 Comprehensive CLI options:
|
|
18
|
-
- CSS/SCSS/Sass/Less stylesheet support
|
|
19
221
|
- Angular routing (enabled by default)
|
|
20
222
|
- Server-Side Rendering (SSR) support
|
|
21
223
|
- Zoneless application support
|
|
22
224
|
- AI tools configuration
|
|
23
225
|
- 🎯 Beautiful starter templates with Tailwind examples
|
|
24
226
|
- 📱 Responsive design examples
|
|
25
|
-
- 🧪 Comprehensive testing suite
|
|
26
227
|
- 📚 Professional documentation
|
|
27
228
|
|
|
28
229
|
### Features
|
|
230
|
+
|
|
29
231
|
- **Best Practice Defaults**: CSS + Routing + No AI tools
|
|
30
232
|
- **Zero Configuration**: Works out of the box
|
|
31
233
|
- **Professional Setup**: Traditional Angular file structure
|
|
32
|
-
- **Modern Tooling**: Latest Angular and Tailwind
|
|
234
|
+
- **Modern Tooling**: Latest Angular and Tailwind versions
|
|
33
235
|
- **Cross-Platform**: Windows, macOS, and Linux support
|
|
34
236
|
|
|
35
237
|
## [Unreleased]
|
|
36
238
|
|
|
37
239
|
### Planned
|
|
240
|
+
|
|
38
241
|
- Angular schematic support (`ng add`)
|
|
39
242
|
- UI library integrations
|
|
40
243
|
- Authentication boilerplates
|
|
41
|
-
- Testing configurations
|
|
42
244
|
- Docker setup
|
|
43
|
-
- CI/CD templates
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
`create-ng-tailwind` is a CLI tool that scaffolds Angular projects with Tailwind CSS preconfigured. It wraps the Angular CLI (`ng new`) and adds Tailwind v4 setup, templates, and best practices. The tool operates in two modes:
|
|
8
|
+
|
|
9
|
+
1. **Interactive Mode (Default)**: Prompts users for configuration like `ng new` does
|
|
10
|
+
2. **Fast Mode**: Accepts all options via CLI flags for CI/CD workflows
|
|
11
|
+
|
|
12
|
+
## Architecture
|
|
13
|
+
|
|
14
|
+
The codebase follows a modular architecture with clear separation of concerns:
|
|
15
|
+
|
|
16
|
+
### Core Components
|
|
17
|
+
|
|
18
|
+
1. **CLI Layer** (`lib/cli/`)
|
|
19
|
+
- `index.js`: Main CLI handler - parses arguments, orchestrates interactive prompts, delegates to ProjectManager
|
|
20
|
+
- `interactive.js`: Interactive prompt logic
|
|
21
|
+
- `validators.js`: Input validation utilities
|
|
22
|
+
|
|
23
|
+
2. **Manager Layer** (`lib/managers/`)
|
|
24
|
+
- `ProjectManager.js`: Orchestrates project creation - wraps `ng new`, coordinates TailwindManager and TemplateManager
|
|
25
|
+
- `TailwindManager.js`: Handles Tailwind v4 installation and PostCSS configuration
|
|
26
|
+
- `TemplateManager.js`: Applies selected template to the project
|
|
27
|
+
|
|
28
|
+
3. **Template System** (`lib/templates/`)
|
|
29
|
+
- `minimal/`: Minimal template (just Angular + Tailwind)
|
|
30
|
+
- `starter/`: Professional foundation with components, routing, i18n, auth UI, services, interceptors, etc.
|
|
31
|
+
- Templates export an `apply(config)` async function that modifies the generated Angular project
|
|
32
|
+
|
|
33
|
+
4. **Utilities** (`lib/utils/`)
|
|
34
|
+
- `logger.js`: Styled CLI output with ora spinners
|
|
35
|
+
- `helpers.js`: Shared utility functions
|
|
36
|
+
- `constants.js`: Configuration constants
|
|
37
|
+
|
|
38
|
+
### Key Workflow
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
bin/create-ng-tailwind.js → lib/cli/index.js → lib/managers/ProjectManager.js
|
|
42
|
+
├─> lib/managers/TailwindManager.js
|
|
43
|
+
└─> lib/managers/TemplateManager.js
|
|
44
|
+
└─> lib/templates/{minimal|starter}/index.js
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Development Commands
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Test locally during development
|
|
51
|
+
npm run dev my-test-app
|
|
52
|
+
|
|
53
|
+
# Test with CLI flags (skip prompts for fast testing)
|
|
54
|
+
npm run dev my-app -- --template=starter
|
|
55
|
+
|
|
56
|
+
# Test interactive mode (will prompt for all options)
|
|
57
|
+
npm run dev my-app
|
|
58
|
+
|
|
59
|
+
# Quick demo
|
|
60
|
+
npm run demo
|
|
61
|
+
|
|
62
|
+
# Link for global testing
|
|
63
|
+
npm link
|
|
64
|
+
create-ng-tailwind test-app
|
|
65
|
+
|
|
66
|
+
# Unlink when done testing
|
|
67
|
+
npm unlink -g create-ng-tailwind
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Key Technical Details
|
|
71
|
+
|
|
72
|
+
### Tailwind v4 Setup
|
|
73
|
+
|
|
74
|
+
The tool uses Tailwind v4's modern PostCSS plugin approach:
|
|
75
|
+
- `.postcssrc.json` with `@tailwindcss/postcss` plugin
|
|
76
|
+
- `styles.css` with `@import "tailwindcss";` directive
|
|
77
|
+
- Dependencies: `tailwindcss`, `@tailwindcss/postcss`, `postcss`
|
|
78
|
+
|
|
79
|
+
### Angular CLI Integration
|
|
80
|
+
|
|
81
|
+
The tool passes configuration to `ng new`:
|
|
82
|
+
- `--routing`: Enable/disable routing (default: true)
|
|
83
|
+
- `--style=css`: Always uses CSS (Tailwind v4 official approach, no preprocessors)
|
|
84
|
+
- `--ssr`: Server-Side Rendering
|
|
85
|
+
- `--zoneless`: Create zoneless app
|
|
86
|
+
- `--ai-config`: AI tool configurations (multiple flags supported)
|
|
87
|
+
- Always uses: `--skip-git --package-manager=npm --interactive=false`
|
|
88
|
+
|
|
89
|
+
### Starter Template Features
|
|
90
|
+
|
|
91
|
+
The starter template (`lib/templates/starter/`) includes:
|
|
92
|
+
- Standalone Angular 20+ architecture with signals
|
|
93
|
+
- **i18n System**: Full internationalization with English/Arabic translations
|
|
94
|
+
- RTL (Right-to-Left) support for Arabic
|
|
95
|
+
- Language switcher in header (desktop & mobile)
|
|
96
|
+
- Uses `@ngx-translate/core` and `@ngx-translate/http-loader`
|
|
97
|
+
- Translation files in `public/assets/i18n/`
|
|
98
|
+
- Auto-detects browser language with localStorage persistence
|
|
99
|
+
- **Layout System**:
|
|
100
|
+
- Main layout (header with navigation + footer)
|
|
101
|
+
- Auth layout (for login/register pages)
|
|
102
|
+
- **Shared Components**: Button, Card, LoadingSpinner (with Tailwind styling)
|
|
103
|
+
- **Auth UI Pages**: Login, Register, Forgot Password (with form validation)
|
|
104
|
+
- **Example Pages**: Home, About, Contact (with reactive forms and validation)
|
|
105
|
+
- **Core Services**: API service, Auth service, i18n service, Translation service
|
|
106
|
+
- **Routing**: Auth guards, lazy loading examples
|
|
107
|
+
- **TypeScript**: Models, interfaces, strongly-typed services
|
|
108
|
+
- **Assets**: Organized in `public/assets/` (images, i18n, icons)
|
|
109
|
+
- **Path Aliases**: `@core`, `@shared`, `@features` configured in tsconfig.json
|
|
110
|
+
|
|
111
|
+
## File Locations
|
|
112
|
+
|
|
113
|
+
- **CLI entry point**: `bin/create-ng-tailwind.js` - Minimal wrapper that instantiates CLIHandler
|
|
114
|
+
- **Main package config**: `package.json`
|
|
115
|
+
- **Library code**: `lib/` (modular architecture)
|
|
116
|
+
- `lib/cli/index.js` - Main CLIHandler class
|
|
117
|
+
- `lib/managers/` - ProjectManager, TailwindManager, TemplateManager
|
|
118
|
+
- `lib/templates/` - Template definitions (minimal, starter)
|
|
119
|
+
- `lib/utils/` - Logger, helpers, constants
|
|
120
|
+
- **Generated projects**: Use `public/assets/` for assets (Angular 17+ convention, not `src/assets/`)
|
|
121
|
+
|
|
122
|
+
## Publishing
|
|
123
|
+
|
|
124
|
+
Before publishing:
|
|
125
|
+
1. Update version in `package.json`
|
|
126
|
+
2. Update `CHANGELOG.md`
|
|
127
|
+
3. Run `npm publish`
|
|
128
|
+
|
|
129
|
+
See `PUBLISHING.md` for detailed publishing instructions.
|
|
130
|
+
|
|
131
|
+
## Common Development Patterns
|
|
132
|
+
|
|
133
|
+
### Adding a New Template
|
|
134
|
+
|
|
135
|
+
1. Create `lib/templates/your-template/index.js`
|
|
136
|
+
2. Export an object with an `apply(config)` async function:
|
|
137
|
+
```javascript
|
|
138
|
+
module.exports = {
|
|
139
|
+
async apply(config) {
|
|
140
|
+
// config contains: projectName, template, style (always "css"), routing, ssr, zoneless, aiConfig, skipInstall, fullPath
|
|
141
|
+
// Modify the generated Angular project here
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
```
|
|
145
|
+
3. Register in `lib/templates/index.js`
|
|
146
|
+
4. Update CLI prompt choices in `lib/cli/index.js:getTemplateChoice()`
|
|
147
|
+
|
|
148
|
+
### Modifying Angular CLI Behavior
|
|
149
|
+
|
|
150
|
+
Edit `lib/managers/ProjectManager.js:createAngularProject()` to adjust the `ng new` command construction. The method builds a command string with flags based on config options.
|
|
151
|
+
|
|
152
|
+
### Changing Tailwind Configuration
|
|
153
|
+
|
|
154
|
+
- **PostCSS setup**: Edit `lib/managers/TailwindManager.js:createPostCSSConfig()`
|
|
155
|
+
- **Stylesheet imports**: Edit `lib/managers/TailwindManager.js:updateStyles()`
|
|
156
|
+
- **Version/dependencies**: Edit `TailwindManager.js:addTailwindToPackageJson()`
|
|
157
|
+
|
|
158
|
+
### Adding CLI Options
|
|
159
|
+
|
|
160
|
+
1. Add option to `lib/cli/index.js:parseOptions()` using commander
|
|
161
|
+
2. Add prompt in appropriate method (e.g., `getConfigurationOptions()`)
|
|
162
|
+
3. Include in config object in `buildConfiguration()`
|
|
163
|
+
4. Use in managers or templates via `config` parameter
|
|
164
|
+
|
|
165
|
+
## Important Constraints and Best Practices
|
|
166
|
+
|
|
167
|
+
- **Node.js 18+** required (specified in package.json engines)
|
|
168
|
+
- **Angular CLI**: Relies on `@angular/cli@latest` being available via npx
|
|
169
|
+
- **Module System**: Uses CommonJS (not ESM) for Node.js compatibility
|
|
170
|
+
- **Tailwind v4 Dependencies**: Must be in `dependencies`, NOT `devDependencies` (required at runtime)
|
|
171
|
+
- **CSS-Only Approach**: Only CSS is supported (Tailwind v4 no longer supports SCSS/Sass/Less preprocessors due to LightningCSS)
|
|
172
|
+
- **CLI Output**: All user-facing messages must use the Logger utility (`lib/utils/logger.js`) for consistent styling with chalk, ora spinners, and inquirer prompts
|
|
173
|
+
- **Stylesheet Format**: Always uses CSS (`config.style` is always `"css"`) - `TailwindManager.js:updateStyles()` writes to `styles.css`
|
|
174
|
+
- **Interactive Mode**: Default behavior - CLI prompts for options not provided via flags
|
|
175
|
+
- **Fast Mode**: All prompts can be skipped by providing complete CLI flags
|
|
176
|
+
- **AI Config**: Handled by Angular CLI's `--ai-config` flag, our CLI just passes it through (supports multiple tools)
|
|
177
|
+
- **Assets Location**: Generated projects use `public/assets/` (Angular 17+ convention), not `src/assets/`
|
|
178
|
+
- **Angular v20 ESLint Fix**: The starter template's ESLint config includes `"suffixes": ["Component", "App"]` for the `@angular-eslint/component-class-suffix` rule to support Angular v20's new `app.ts` naming convention (class `App` instead of `AppComponent`)
|
package/LICENSE
CHANGED