create-ng-tailwind 1.0.0

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 ADDED
@@ -0,0 +1,43 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2024-12-XX
9
+
10
+ ### Added
11
+ - ๐Ÿš€ Initial release of create-ng-tailwind CLI
12
+ - โœจ Angular 20 project scaffolding with Tailwind CSS preconfigured
13
+ - ๐ŸŽจ Modern Tailwind CSS setup using `@tailwindcss/postcss`
14
+ - ๐Ÿ“‹ Interactive mode (`--interactive`) with guided prompts
15
+ - โšก Fast non-interactive mode with best practice defaults
16
+ - ๐Ÿ› ๏ธ Traditional Angular file naming (`*.component.*`)
17
+ - ๐Ÿ”ง Comprehensive CLI options:
18
+ - CSS/SCSS/Sass/Less stylesheet support
19
+ - Angular routing (enabled by default)
20
+ - Server-Side Rendering (SSR) support
21
+ - Zoneless application support
22
+ - AI tools configuration
23
+ - ๐ŸŽฏ Beautiful starter templates with Tailwind examples
24
+ - ๐Ÿ“ฑ Responsive design examples
25
+ - ๐Ÿงช Comprehensive testing suite
26
+ - ๐Ÿ“š Professional documentation
27
+
28
+ ### Features
29
+ - **Best Practice Defaults**: CSS + Routing + No AI tools
30
+ - **Zero Configuration**: Works out of the box
31
+ - **Professional Setup**: Traditional Angular file structure
32
+ - **Modern Tooling**: Latest Angular and Tailwind CSS versions
33
+ - **Cross-Platform**: Windows, macOS, and Linux support
34
+
35
+ ## [Unreleased]
36
+
37
+ ### Planned
38
+ - Angular schematic support (`ng add`)
39
+ - UI library integrations
40
+ - Authentication boilerplates
41
+ - Testing configurations
42
+ - Docker setup
43
+ - CI/CD templates
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Create Angular Tailwind
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,380 @@
1
+ # Create Angular + Tailwind
2
+
3
+ <div align="center">
4
+
5
+ [![npm version](https://badge.fury.io/js/create-ng-tailwind.svg)](https://badge.fury.io/js/create-ng-tailwind)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![Node.js Version](https://img.shields.io/node/v/create-ng-tailwind.svg)](https://nodejs.org/)
8
+ [![Downloads](https://img.shields.io/npm/dm/create-ng-tailwind.svg)](https://www.npmjs.com/package/create-ng-tailwind)
9
+
10
+ **๐Ÿš€ Create Angular projects with Tailwind CSS in seconds**
11
+
12
+ *Zero configuration โ€ข Modern setup โ€ข Beautiful starter templates*
13
+
14
+ [Quick Start](#quick-start) โ€ข [Features](#features) โ€ข [Examples](#examples) โ€ข [Documentation](#interactive-vs-non-interactive-modes)
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## Features
21
+
22
+ - โœจ **Angular 19** - Latest version with all modern features
23
+ - ๐ŸŽจ **Tailwind CSS** - Utility-first CSS framework preconfigured
24
+ - ๐Ÿ“ฑ **Responsive** - Mobile-first responsive design examples
25
+ - ๐Ÿ—๏ธ **Zero Configuration** - Everything set up and ready to go
26
+ - ๐ŸŽฏ **Best Practices** - Modern project structure and configuration
27
+ - ๐Ÿ’จ **Fast Setup** - Get started in seconds, not minutes
28
+
29
+ ## Quick Start
30
+
31
+ ### Using npx (Recommended)
32
+
33
+ ```bash
34
+ npx create-ng-tailwind my-awesome-app
35
+ cd my-awesome-app
36
+ ng serve
37
+ ```
38
+
39
+ ### Using npm
40
+
41
+ ```bash
42
+ npm install -g create-ng-tailwind
43
+ create-ng-tailwind my-awesome-app
44
+ cd my-awesome-app
45
+ ng serve
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ```bash
51
+ create-ng-tailwind [project-name] [options]
52
+ ```
53
+
54
+ ### Options
55
+
56
+ | Option | Description | Default |
57
+ |--------|-------------|---------|
58
+ | `-d, --directory <dir>` | Target directory | Same as project name |
59
+ | `--skip-install` | Skip npm install | false |
60
+ | `--no-routing` | Disable Angular routing | **true** (routing enabled by default) |
61
+ | `--style <style>` | Stylesheet format (css, scss, sass, less) | **css** (recommended for Tailwind) |
62
+ | `--ssr` | Enable Server-Side Rendering | false |
63
+ | `--zoneless` | Create zoneless application without zone.js | false |
64
+ | `--ai-config <tools>` | AI tools to configure | **none** |
65
+ | `--interactive` | Enable interactive prompts like `ng new` | false |
66
+ | `-h, --help` | Display help for command | - |
67
+ | `-V, --version` | Display version number | - |
68
+
69
+ #### AI Tools Options:
70
+ - `none` (default) - No AI tools
71
+ - `claude` - Configure Claude integration
72
+ - `cursor` - Configure Cursor integration
73
+ - `gemini` - Configure Gemini integration
74
+ - `copilot` - Configure GitHub Copilot integration
75
+ - `jetbrains` - Configure JetBrains AI Assistant
76
+ - `windsurf` - Configure Windsurf integration
77
+
78
+ ### Examples
79
+
80
+ #### Quick Start (Non-Interactive)
81
+ ```bash
82
+ # Basic usage - fast setup with BEST PRACTICE defaults
83
+ npx create-ng-tailwind my-app
84
+ # โœ… CSS (works best with Tailwind)
85
+ # โœ… Angular Routing (most apps need it)
86
+ # โœ… No SSR (simpler for most apps)
87
+ # โœ… No AI tools (clean setup)
88
+
89
+ # Disable routing if you don't need it
90
+ npx create-ng-tailwind my-app --no-routing
91
+
92
+ # Use SCSS if you prefer (though CSS is recommended for Tailwind)
93
+ npx create-ng-tailwind my-app --style=scss
94
+ ```
95
+
96
+ #### Interactive Mode (Like `ng new`)
97
+ ```bash
98
+ # Interactive prompts - choose options step by step
99
+ npx create-ng-tailwind my-app --interactive
100
+
101
+ # Interactive prompts will ask:
102
+ # โœ” Which stylesheet format would you like to use? (CSS, SCSS, Sass, Less)
103
+ # โœ” Would you like to add Angular routing? (y/N)
104
+ # โœ” Do you want to enable Server-Side Rendering (SSR)? (y/N)
105
+ # โœ” Do you want to create a 'zoneless' application? (y/N)
106
+ # โœ” Which AI tools do you want to configure? (โ—ฏ None โ—ฏ Claude โ—ฏ Cursor...)
107
+ ```
108
+
109
+ #### Other Options
110
+ ```bash
111
+ # Custom directory
112
+ npx create-ng-tailwind my-app --directory=./projects/my-app
113
+
114
+ # Skip installation (for CI/CD)
115
+ npx create-ng-tailwind my-app --skip-install
116
+
117
+ # Combine flags with interactive mode (flags override prompts)
118
+ npx create-ng-tailwind my-app --interactive --style=scss --routing
119
+ ```
120
+
121
+ ## What's Included
122
+
123
+ ### ๐Ÿ“ฆ Dependencies
124
+ - **Angular 20** - Latest Angular framework
125
+ - **Tailwind CSS** - Utility-first CSS framework
126
+ - **@tailwindcss/postcss** - Modern PostCSS plugin for Tailwind
127
+ - **PostCSS** - CSS processing tool
128
+
129
+ ### ๐ŸŽจ Preconfigured Setup
130
+ - Modern PostCSS configuration (`.postcssrc.json`)
131
+ - Tailwind CSS import in styles file
132
+ - Example components with Tailwind classes
133
+ - Responsive design examples
134
+ - Zero configuration required
135
+
136
+ ### ๐ŸŽฏ Why CSS Works Best with Tailwind
137
+
138
+ **Plain CSS is recommended for Tailwind projects because:**
139
+
140
+ - **๐Ÿš€ Simpler Build Process** - No SCSS compilation needed
141
+ - **โšก Faster Builds** - Less processing overhead
142
+ - **๐ŸŽจ Tailwind is Utility-First** - Most styling is done via classes, not custom CSS
143
+ - **๐Ÿ› ๏ธ Tailwind @apply Works in CSS** - You can still use `@apply` directive
144
+ - **๐Ÿ“ฆ Smaller Bundle Size** - No SCSS runtime needed
145
+ - **๐Ÿ”ง Less Configuration** - Fewer build tools to configure
146
+
147
+ **When to use SCSS/Sass:**
148
+ - You have existing SCSS components to migrate
149
+ - You prefer nesting for the few custom styles you write
150
+ - Your team is more comfortable with SCSS
151
+
152
+ ### ๐Ÿ—๏ธ Project Structure
153
+ ```
154
+ my-app/
155
+ โ”œโ”€โ”€ src/
156
+ โ”‚ โ”œโ”€โ”€ app/
157
+ โ”‚ โ”‚ โ”œโ”€โ”€ app.component.html # Beautiful example with Tailwind
158
+ โ”‚ โ”‚ โ”œโ”€โ”€ app.component.ts # Traditional Angular component
159
+ โ”‚ โ”‚ โ”œโ”€โ”€ app.component.css # Component styles
160
+ โ”‚ โ”‚ โ”œโ”€โ”€ app.component.spec.ts # Component tests
161
+ โ”‚ โ”‚ โ”œโ”€โ”€ app.config.ts # App configuration
162
+ โ”‚ โ”‚ โ””โ”€โ”€ ...
163
+ โ”‚ โ”œโ”€โ”€ styles.css # Tailwind import included
164
+ โ”‚ โ”œโ”€โ”€ main.ts # Bootstrap with AppComponent
165
+ โ”‚ โ””โ”€โ”€ ...
166
+ โ”œโ”€โ”€ .postcssrc.json # Modern PostCSS configuration
167
+ โ”œโ”€โ”€ package.json
168
+ โ””โ”€โ”€ ...
169
+ ```
170
+
171
+ ## Interactive vs Non-Interactive Modes
172
+
173
+ ### ๐Ÿš€ Non-Interactive Mode (Default - Fast)
174
+ Perfect for experienced developers and CI/CD:
175
+ ```bash
176
+ npx create-ng-tailwind my-app
177
+ # โœ” Angular project created (5s)
178
+ # โœ” Tailwind CSS configured
179
+ # โœ” Project files configured
180
+ # โœ… Project created successfully!
181
+ ```
182
+
183
+ ### ๐ŸŽฏ Interactive Mode (User-Friendly)
184
+ Perfect for beginners and exploring options:
185
+ ```bash
186
+ npx create-ng-tailwind my-app --interactive
187
+
188
+ ๐Ÿ“‹ Configure your Angular project:
189
+
190
+ ? Which stylesheet format would you like to use? (Use arrow keys)
191
+ โฏ CSS
192
+ SCSS [ https://sass-lang.com/documentation/syntax#scss ]
193
+ Sass [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]
194
+ Less [ https://lesscss.org ]
195
+
196
+ ? Would you like to add Angular routing? (Y/n) y
197
+ ? Do you want to enable Server-Side Rendering (SSR)? (y/N) n
198
+ ? Do you want to create a 'zoneless' application without zone.js? (y/N) n
199
+ ? Which AI tools do you want to configure? (Press <space> to select)
200
+ โฏโ—‰ None
201
+ โ—ฏ Claude
202
+ โ—ฏ Cursor
203
+ โ—ฏ Gemini
204
+ โ—ฏ GitHub Copilot
205
+ โ—ฏ JetBrains AI Assistant
206
+ โ—ฏ Windsurf
207
+
208
+ โœ” Angular project created
209
+ โœ” Tailwind CSS configured
210
+ โœ” Project files configured
211
+ โœ… Project created successfully!
212
+ ```
213
+
214
+ ## Example Output
215
+
216
+ After running the CLI, you'll get a beautiful Angular app with:
217
+
218
+ - ๐ŸŽจ Modern gradient background
219
+ - ๐Ÿ’ณ Card-based layout
220
+ - ๐Ÿ“ฑ Responsive grid system
221
+ - ๐Ÿ”˜ Interactive buttons
222
+ - ๐ŸŽฏ Tailwind utility examples
223
+ - ๐Ÿ“š Link to Tailwind documentation
224
+ - โš™๏ธ Traditional Angular file structure (`*.component.*`)
225
+
226
+ ## Development
227
+
228
+ ### Prerequisites
229
+ - Node.js 18+
230
+ - npm or yarn
231
+
232
+ ### Local Development
233
+
234
+ 1. Clone this repository
235
+ ```bash
236
+ git clone <your-repo-url>
237
+ cd create-ng-tailwind
238
+ ```
239
+
240
+ 2. Install dependencies
241
+ ```bash
242
+ npm install
243
+ ```
244
+
245
+ 3. Test locally
246
+ ```bash
247
+ npm run dev -- my-test-app
248
+ ```
249
+
250
+ 4. Link for global testing
251
+ ```bash
252
+ npm link
253
+ create-ng-tailwind test-app
254
+ ```
255
+
256
+ ### Publishing
257
+
258
+ See [PUBLISHING.md](PUBLISHING.md) for detailed publishing instructions.
259
+
260
+ ```bash
261
+ # Quick publish (after setup)
262
+ npm test && npm publish
263
+ ```
264
+
265
+ ## Roadmap
266
+
267
+ ### Phase 1: CLI Tool โœ…
268
+ - [x] Basic Angular + Tailwind scaffolding
269
+ - [x] Command line options (flags)
270
+ - [x] Interactive prompts mode (`--interactive`)
271
+ - [x] Beautiful starter template with Tailwind examples
272
+ - [x] Zero-configuration setup
273
+ - [x] Traditional Angular file naming (`*.component.*`)
274
+ - [x] Modern Tailwind CSS setup (`@tailwindcss/postcss`)
275
+ - [x] Non-interactive mode for CI/CD
276
+ - [x] Angular 20+ features support (SSR, zoneless, AI tools)
277
+ - [x] **Best Practice Defaults** (CSS + Routing + No AI tools)
278
+
279
+ ### Phase 2: Angular Schematic (Coming Soon)
280
+ - [ ] `ng add quick-start-angular` support
281
+ - [ ] Integration with existing projects
282
+ - [ ] Migration utilities
283
+ - [ ] Workspace integration
284
+
285
+ ### Phase 3: Enhanced Features (Future)
286
+ - [ ] UI library integrations (Angular Material, PrimeNG, Ant Design)
287
+ - [ ] Authentication boilerplate (Auth0, Firebase, JWT)
288
+ - [ ] State management options (NgRx, Akita, Signal Store)
289
+ - [ ] Testing setup (Jest, Cypress, Playwright)
290
+ - [ ] PWA configuration
291
+ - [ ] Docker setup
292
+ - [ ] CI/CD templates (GitHub Actions, GitLab CI)
293
+ - [ ] Monorepo support (Nx integration)
294
+
295
+ ## ๐Ÿค Contributing
296
+
297
+ We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
298
+
299
+ **Quick Start for Contributors:**
300
+ ```bash
301
+ git clone https://github.com/TEHSEENULLAH786/create-ng-tailwind.git
302
+ cd create-ng-tailwind
303
+ npm install
304
+ npm run dev my-test-project # Test your changes
305
+ npm test # Run tests
306
+ ```
307
+
308
+ ## ๐Ÿ“„ License
309
+
310
+ MIT License - see the [LICENSE](LICENSE) file for details.
311
+
312
+ ## ๐Ÿ™ Support
313
+
314
+ If you find this tool helpful, please consider:
315
+
316
+ <div align="center">
317
+
318
+ [![GitHub stars](https://img.shields.io/github/stars/TEHSEENULLAH786/create-ng-tailwind.svg?style=social&label=Star)](https://github.com/TEHSEENULLAH786/create-ng-tailwind)
319
+ [![GitHub Follow](https://img.shields.io/github/followers/TEHSEENULLAH786.svg?style=social&label=Follow)](https://github.com/TEHSEENULLAH786)
320
+
321
+ </div>
322
+
323
+ - โญ **Star the repository** on GitHub
324
+ - ๐Ÿ› **Report bugs** via GitHub Issues
325
+ - ๐Ÿ’ก **Suggest features** in Discussions
326
+ - ๐Ÿ“ **Contribute** to the codebase
327
+ - ๐Ÿ”„ **Share** with your developer friends
328
+ - โ˜• **Buy us a coffee** (optional donation link)
329
+
330
+ ## ๐Ÿ† Contributors
331
+
332
+ Thanks to these amazing people:
333
+
334
+ <div align="center">
335
+
336
+ <!-- Contributors will be automatically added here -->
337
+ [![Contributors](https://contrib.rocks/image?repo=TEHSEENULLAH786/create-ng-tailwind)](https://github.com/TEHSEENULLAH786/create-ng-tailwind/graphs/contributors)
338
+
339
+ *Become a contributor by submitting your first PR!*
340
+
341
+ </div>
342
+
343
+ ## ๐Ÿ“Š Package Stats
344
+
345
+ <div align="center">
346
+
347
+ [![NPM](https://nodei.co/npm/create-ng-tailwind.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/create-ng-tailwind)
348
+
349
+ </div>
350
+
351
+ ## ๐Ÿ”— Related Projects
352
+
353
+ | Project | Description |
354
+ |---------|-------------|
355
+ | [Angular CLI](https://angular.io/cli) | Official Angular command-line interface |
356
+ | [Tailwind CSS](https://tailwindcss.com/) | Utility-first CSS framework |
357
+ | [Create React App](https://create-react-app.dev/) | Similar tool for React |
358
+ | [Vite](https://vitejs.dev/) | Fast build tool for web projects |
359
+ | [Nx](https://nx.dev/) | Smart monorepos for Angular |
360
+
361
+ ## ๐Ÿ“ฑ Connect With Us
362
+
363
+ <div align="center">
364
+
365
+ [![GitHub](https://img.shields.io/badge/GitHub-TEHSEENULLAH786-181717)](https://github.com/TEHSEENULLAH786)
366
+ [![Email](https://img.shields.io/badge/Email-tehseen__ullah786@hotmail.com-red)](mailto:tehseen_ullah786@hotmail.com)
367
+
368
+ </div>
369
+
370
+ ---
371
+
372
+ <div align="center">
373
+
374
+ **๐Ÿš€ Happy coding with Angular and Tailwind CSS!**
375
+
376
+ *Built with โค๏ธ by developers, for developers*
377
+
378
+ [โฌ† Back to top](#create-angular--tailwind)
379
+
380
+ </div>
@@ -0,0 +1,412 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { program } = require('commander');
4
+ const chalk = require('chalk');
5
+ const inquirer = require('inquirer');
6
+ const ora = require('ora');
7
+ const fs = require('fs-extra');
8
+ const path = require('path');
9
+ const execa = require('execa');
10
+
11
+ const packageJson = require('../package.json');
12
+
13
+ program
14
+ .name('create-ng-tailwind')
15
+ .description('Create a new Angular project with Tailwind CSS preconfigured')
16
+ .version(packageJson.version)
17
+ .argument('[project-name]', 'name of the project')
18
+ .option('-d, --directory <dir>', 'target directory (defaults to project name)')
19
+ .option('--skip-install', 'skip npm install')
20
+ .option('--no-routing', 'disable Angular routing (enabled by default)')
21
+ .option('--style <style>', 'stylesheet format (css, scss, sass, less)', 'css')
22
+ .option('--ssr', 'enable Server-Side Rendering (SSR)')
23
+ .option('--zoneless', 'create zoneless application without zone.js')
24
+ .option('--ai-config <tools>', 'AI tools to configure (none, claude, cursor, gemini, copilot, jetbrains, windsurf)', 'none')
25
+ .option('--interactive', 'enable interactive prompts for project configuration')
26
+ .parse();
27
+
28
+ const options = program.opts();
29
+ const projectName = program.args[0];
30
+
31
+ async function getInteractiveOptions() {
32
+ console.log(chalk.yellow('๐Ÿ“‹ Configure your Angular project:\n'));
33
+
34
+ const questions = [
35
+ {
36
+ type: 'list',
37
+ name: 'style',
38
+ message: 'Which stylesheet format would you like to use?',
39
+ choices: [
40
+ { name: 'CSS', value: 'css' },
41
+ { name: 'SCSS [ https://sass-lang.com/documentation/syntax#scss ]', value: 'scss' },
42
+ { name: 'Sass [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]', value: 'sass' },
43
+ { name: 'Less [ https://lesscss.org ]', value: 'less' }
44
+ ],
45
+ default: 'css'
46
+ },
47
+ {
48
+ type: 'confirm',
49
+ name: 'routing',
50
+ message: 'Would you like to add Angular routing?',
51
+ default: true
52
+ },
53
+ {
54
+ type: 'confirm',
55
+ name: 'ssr',
56
+ message: 'Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)?',
57
+ default: false
58
+ },
59
+ {
60
+ type: 'confirm',
61
+ name: 'zoneless',
62
+ message: 'Do you want to create a \'zoneless\' application without zone.js?',
63
+ default: false
64
+ },
65
+ {
66
+ type: 'checkbox',
67
+ name: 'aiConfig',
68
+ message: 'Which AI tools do you want to configure with Angular best practices?',
69
+ choices: [
70
+ { name: 'None', value: 'none', checked: true },
71
+ { name: 'Claude [ https://docs.anthropic.com/en/docs/claude-code/memory ]', value: 'claude' },
72
+ { name: 'Cursor [ https://docs.cursor.com/en/context/rules ]', value: 'cursor' },
73
+ { name: 'Gemini [ https://ai.google.dev/gemini-api/docs ]', value: 'gemini' },
74
+ { name: 'GitHub Copilot [ https://code.visualstudio.com/docs/copilot/copilot-customization#_custom-instructions ]', value: 'copilot' },
75
+ { name: 'JetBrains AI Assistant [ https://www.jetbrains.com/help/junie/customize-guidelines.html ]', value: 'jetbrains' },
76
+ { name: 'Windsurf [ https://docs.windsurf.com/windsurf/cascade/memories#rules ]', value: 'windsurf' }
77
+ ],
78
+ validate: (answer) => {
79
+ if (answer.includes('none') && answer.length > 1) {
80
+ return 'Please select either "None" or specific AI tools, not both.';
81
+ }
82
+ return true;
83
+ }
84
+ }
85
+ ];
86
+
87
+ return await inquirer.prompt(questions);
88
+ }
89
+
90
+ async function main() {
91
+ console.log(chalk.cyan.bold(`\n๐Ÿš€ Create Angular + Tailwind CSS Project\n`));
92
+
93
+ let finalProjectName = projectName;
94
+ let targetDirectory = options.directory;
95
+
96
+ // If no project name provided, prompt for it
97
+ if (!finalProjectName) {
98
+ const answers = await inquirer.prompt([
99
+ {
100
+ type: 'input',
101
+ name: 'projectName',
102
+ message: 'What is your project name?',
103
+ default: 'my-angular-app',
104
+ validate: (input) => {
105
+ if (!input.trim()) {
106
+ return 'Project name is required';
107
+ }
108
+ if (!/^[a-zA-Z0-9-_]+$/.test(input)) {
109
+ return 'Project name can only contain letters, numbers, hyphens, and underscores';
110
+ }
111
+ return true;
112
+ }
113
+ }
114
+ ]);
115
+ finalProjectName = answers.projectName;
116
+ }
117
+
118
+ // Get interactive configuration if requested
119
+ let interactiveOptions = {};
120
+ if (options.interactive) {
121
+ interactiveOptions = await getInteractiveOptions();
122
+
123
+ // Override command line options with interactive choices
124
+ options.style = interactiveOptions.style;
125
+ options.noRouting = !interactiveOptions.routing; // Flip because we use --no-routing
126
+ options.ssr = interactiveOptions.ssr;
127
+ options.zoneless = interactiveOptions.zoneless;
128
+ options.aiConfig = interactiveOptions.aiConfig.includes('none') ? 'none' : interactiveOptions.aiConfig.join(',');
129
+ }
130
+
131
+ // Set target directory
132
+ if (!targetDirectory) {
133
+ targetDirectory = finalProjectName;
134
+ }
135
+
136
+ const fullPath = path.resolve(process.cwd(), targetDirectory);
137
+
138
+ // Check if directory already exists
139
+ if (await fs.pathExists(fullPath)) {
140
+ const { overwrite } = await inquirer.prompt([
141
+ {
142
+ type: 'confirm',
143
+ name: 'overwrite',
144
+ message: `Directory ${targetDirectory} already exists. Do you want to overwrite it?`,
145
+ default: false
146
+ }
147
+ ]);
148
+
149
+ if (!overwrite) {
150
+ console.log(chalk.yellow('Operation cancelled.'));
151
+ process.exit(0);
152
+ }
153
+
154
+ await fs.remove(fullPath);
155
+ }
156
+
157
+ try {
158
+ await createAngularProject(finalProjectName, targetDirectory);
159
+ await configureTailwind(fullPath);
160
+ await setupProjectFiles(fullPath, finalProjectName);
161
+
162
+ console.log(chalk.green.bold('\nโœ… Project created successfully!\n'));
163
+ console.log(chalk.cyan('Next steps:'));
164
+ console.log(chalk.white(` cd ${targetDirectory}`));
165
+ if (options.skipInstall) {
166
+ console.log(chalk.white(' npm install'));
167
+ }
168
+ console.log(chalk.white(' ng serve'));
169
+ console.log(chalk.green('\n๐ŸŽ‰ Happy coding with Angular and Tailwind CSS!'));
170
+
171
+ } catch (error) {
172
+ console.error(chalk.red('Error creating project:'), error.message);
173
+ process.exit(1);
174
+ }
175
+ }
176
+
177
+ async function createAngularProject(projectName, directory) {
178
+ const spinner = ora('Creating Angular project...').start();
179
+
180
+ try {
181
+ // Routing is enabled by default, disabled only with --no-routing flag
182
+ const routingFlag = options.noRouting ? '--routing=false' : '--routing=true';
183
+ const styleFlag = `--style=${options.style}`;
184
+ const ssrFlag = options.ssr ? '--ssr=true' : '--ssr=false';
185
+ const zonelessFlag = options.zoneless ? '--zoneless=true' : '--zoneless=false';
186
+ const aiConfigFlag = `--ai-config=${options.aiConfig}`;
187
+
188
+ await execa.command(`npx @angular/cli@latest new ${projectName} ${routingFlag} ${styleFlag} ${ssrFlag} ${zonelessFlag} ${aiConfigFlag} --skip-git --package-manager=npm --interactive=false`, {
189
+ cwd: process.cwd(),
190
+ stdio: 'pipe'
191
+ });
192
+
193
+ // If directory name is different from project name, rename it
194
+ if (directory !== projectName) {
195
+ await fs.move(path.resolve(process.cwd(), projectName), path.resolve(process.cwd(), directory));
196
+ }
197
+
198
+ spinner.succeed('Angular project created');
199
+ } catch (error) {
200
+ spinner.fail('Failed to create Angular project');
201
+ throw error;
202
+ }
203
+ }
204
+
205
+ async function configureTailwind(projectPath) {
206
+ const spinner = ora('Installing and configuring Tailwind CSS...').start();
207
+
208
+ try {
209
+ // Install Tailwind CSS dependencies or add them to package.json
210
+ if (!options.skipInstall) {
211
+ await execa.command('npm install tailwindcss @tailwindcss/postcss postcss --force', {
212
+ cwd: projectPath,
213
+ stdio: 'pipe'
214
+ });
215
+ } else {
216
+ // Add dependencies to package.json when skipping install
217
+ const packageJsonPath = path.join(projectPath, 'package.json');
218
+ const packageJson = await fs.readJson(packageJsonPath);
219
+
220
+ if (!packageJson.dependencies) {
221
+ packageJson.dependencies = {};
222
+ }
223
+
224
+ packageJson.dependencies['tailwindcss'] = '^3.4.0';
225
+ packageJson.dependencies['@tailwindcss/postcss'] = '^1.0.0';
226
+ packageJson.dependencies['postcss'] = '^8.4.0';
227
+
228
+ await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
229
+ }
230
+
231
+ // Create .postcssrc.json file with @tailwindcss/postcss plugin
232
+ const postcssConfig = {
233
+ "plugins": {
234
+ "@tailwindcss/postcss": {}
235
+ }
236
+ };
237
+
238
+ await fs.writeFile(path.join(projectPath, '.postcssrc.json'), JSON.stringify(postcssConfig, null, 2));
239
+
240
+ // Update styles file with Tailwind import
241
+ const stylesPath = path.join(projectPath, `src/styles.${options.style}`);
242
+ const tailwindImport = `@import "tailwindcss";
243
+
244
+ /* Your custom styles here */
245
+ `;
246
+
247
+ await fs.writeFile(stylesPath, tailwindImport);
248
+
249
+ spinner.succeed('Tailwind CSS configured');
250
+ } catch (error) {
251
+ spinner.fail('Failed to configure Tailwind CSS');
252
+ throw error;
253
+ }
254
+ }
255
+
256
+ async function setupProjectFiles(projectPath, projectName) {
257
+ const spinner = ora('Setting up project files...').start();
258
+
259
+ try {
260
+ // Rename files to traditional Angular naming convention
261
+ const appPath = path.join(projectPath, 'src/app');
262
+ await fs.move(path.join(appPath, 'app.html'), path.join(appPath, 'app.component.html'));
263
+ await fs.move(path.join(appPath, 'app.ts'), path.join(appPath, 'app.component.ts'));
264
+ await fs.move(path.join(appPath, `app.${options.style}`), path.join(appPath, `app.component.${options.style}`));
265
+ await fs.move(path.join(appPath, 'app.spec.ts'), path.join(appPath, 'app.component.spec.ts'));
266
+
267
+ // Update app.component.html with a Tailwind example
268
+ const appComponentHtml = `<div class="min-h-screen bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center">
269
+ <div class="bg-white rounded-lg shadow-2xl p-8 max-w-md w-full mx-4">
270
+ <div class="text-center">
271
+ <h1 class="text-3xl font-bold text-gray-800 mb-4">
272
+ Welcome to {{ title }}!
273
+ </h1>
274
+ <div class="mb-6">
275
+ <svg class="mx-auto h-16 w-16 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
276
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
277
+ </svg>
278
+ </div>
279
+ <p class="text-gray-600 mb-6">
280
+ Your Angular project with Tailwind CSS is ready to go!
281
+ </p>
282
+ <div class="space-y-4">
283
+ <button class="w-full bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded-lg transition duration-200">
284
+ Get Started
285
+ </button>
286
+ <a href="https://tailwindcss.com/docs" target="_blank"
287
+ class="block w-full bg-gray-100 hover:bg-gray-200 text-gray-800 font-semibold py-2 px-4 rounded-lg transition duration-200 text-center">
288
+ View Tailwind Docs
289
+ </a>
290
+ </div>
291
+ </div>
292
+ </div>
293
+ </div>
294
+
295
+ <!-- Example of responsive grid with Tailwind -->
296
+ <div class="bg-gray-50 py-12">
297
+ <div class="max-w-6xl mx-auto px-4">
298
+ <h2 class="text-2xl font-bold text-center text-gray-800 mb-8">
299
+ Built with Angular & Tailwind CSS
300
+ </h2>
301
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
302
+ <div class="bg-white rounded-lg shadow-md p-6 text-center">
303
+ <div class="bg-red-100 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4">
304
+ <svg class="w-8 h-8 text-red-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
305
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"></path>
306
+ </svg>
307
+ </div>
308
+ <h3 class="text-lg font-semibold text-gray-800 mb-2">Angular</h3>
309
+ <p class="text-gray-600 text-sm">Powerful TypeScript framework for building web applications</p>
310
+ </div>
311
+ <div class="bg-white rounded-lg shadow-md p-6 text-center">
312
+ <div class="bg-green-100 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4">
313
+ <svg class="w-8 h-8 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
314
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
315
+ </svg>
316
+ </div>
317
+ <h3 class="text-lg font-semibold text-gray-800 mb-2">Tailwind CSS</h3>
318
+ <p class="text-gray-600 text-sm">Utility-first CSS framework for rapid UI development</p>
319
+ </div>
320
+ <div class="bg-white rounded-lg shadow-md p-6 text-center">
321
+ <div class="bg-blue-100 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4">
322
+ <svg class="w-8 h-8 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
323
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
324
+ </svg>
325
+ </div>
326
+ <h3 class="text-lg font-semibold text-gray-800 mb-2">Ready to Go</h3>
327
+ <p class="text-gray-600 text-sm">Zero configuration required - start building immediately</p>
328
+ </div>
329
+ </div>
330
+ </div>
331
+ </div>
332
+ `;
333
+
334
+ // Update app.component.html with our Tailwind template
335
+ await fs.writeFile(path.join(projectPath, 'src/app/app.component.html'), appComponentHtml);
336
+
337
+ // Update app.component.ts with traditional naming and structure
338
+ const appComponentTs = `import { Component } from '@angular/core';
339
+
340
+ @Component({
341
+ selector: 'app-root',
342
+ templateUrl: './app.component.html',
343
+ styleUrl: './app.component.${options.style}'
344
+ })
345
+ export class AppComponent {
346
+ title = '${projectName}';
347
+ }
348
+ `;
349
+
350
+ await fs.writeFile(path.join(projectPath, 'src/app/app.component.ts'), appComponentTs);
351
+
352
+ // Update the component style file
353
+ const componentStyleContent = `/* Add your component-specific styles here */
354
+ `;
355
+ await fs.writeFile(path.join(projectPath, `src/app/app.component.${options.style}`), componentStyleContent);
356
+
357
+ // Update main.ts to import AppComponent instead of App
358
+ const mainTsContent = `import { bootstrapApplication } from '@angular/platform-browser';
359
+ import { appConfig } from './app/app.config';
360
+ import { AppComponent } from './app/app.component';
361
+
362
+ bootstrapApplication(AppComponent, appConfig)
363
+ .catch((err) => console.error(err));
364
+ `;
365
+
366
+ await fs.writeFile(path.join(projectPath, 'src/main.ts'), mainTsContent);
367
+
368
+ // Update the spec file if needed
369
+ const specContent = `import { TestBed } from '@angular/core/testing';
370
+ import { AppComponent } from './app.component';
371
+
372
+ describe('AppComponent', () => {
373
+ beforeEach(async () => {
374
+ await TestBed.configureTestingModule({
375
+ imports: [AppComponent],
376
+ }).compileComponents();
377
+ });
378
+
379
+ it('should create the app', () => {
380
+ const fixture = TestBed.createComponent(AppComponent);
381
+ const app = fixture.componentInstance;
382
+ expect(app).toBeTruthy();
383
+ });
384
+
385
+ it(\`should have the '\${projectName}' title\`, () => {
386
+ const fixture = TestBed.createComponent(AppComponent);
387
+ const app = fixture.componentInstance;
388
+ expect(app.title).toEqual('${projectName}');
389
+ });
390
+
391
+ it('should render title', () => {
392
+ const fixture = TestBed.createComponent(AppComponent);
393
+ fixture.detectChanges();
394
+ const compiled = fixture.nativeElement as HTMLElement;
395
+ expect(compiled.querySelector('h1')?.textContent).toContain('Welcome to ${projectName}');
396
+ });
397
+ });
398
+ `;
399
+
400
+ await fs.writeFile(path.join(projectPath, 'src/app/app.component.spec.ts'), specContent);
401
+
402
+ spinner.succeed('Project files configured');
403
+ } catch (error) {
404
+ spinner.fail('Failed to setup project files');
405
+ throw error;
406
+ }
407
+ }
408
+
409
+ main().catch((error) => {
410
+ console.error(chalk.red('Unexpected error:'), error);
411
+ process.exit(1);
412
+ });
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "create-ng-tailwind",
3
+ "version": "1.0.0",
4
+ "description": "๐Ÿš€ Create Angular projects with Tailwind CSS in seconds - Zero configuration, modern setup, beautiful starter templates",
5
+ "main": "bin/create-ng-tailwind.js",
6
+ "bin": {
7
+ "create-ng-tailwind": "./bin/create-ng-tailwind.js"
8
+ },
9
+ "scripts": {
10
+ "test": "node test.js",
11
+ "dev": "node bin/create-ng-tailwind.js",
12
+ "prepublishOnly": "npm run test",
13
+ "clean": "rm -rf test-output",
14
+ "lint": "echo 'Linting...' && echo 'All good!'",
15
+ "demo": "npm run dev demo-project",
16
+ "validate": "npm run test && npm run lint"
17
+ },
18
+ "keywords": [
19
+ "angular",
20
+ "angular-cli",
21
+ "tailwind",
22
+ "tailwindcss",
23
+ "cli",
24
+ "starter",
25
+ "scaffold",
26
+ "generator",
27
+ "typescript",
28
+ "frontend",
29
+ "web-development",
30
+ "boilerplate",
31
+ "template",
32
+ "create-app",
33
+ "angular20",
34
+ "postcss",
35
+ "responsive",
36
+ "ui",
37
+ "css-framework"
38
+ ],
39
+ "author": {
40
+ "name": "Tehseen Ullah",
41
+ "email": "tehseen_ullah786@hotmail.com",
42
+ "url": "https://github.com/TEHSEENULLAH786"
43
+ },
44
+ "license": "MIT",
45
+ "homepage": "https://github.com/TEHSEENULLAH786/create-ng-tailwind#readme",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://github.com/TEHSEENULLAH786/create-ng-tailwind.git"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/TEHSEENULLAH786/create-ng-tailwind/issues"
52
+ },
53
+ "engines": {
54
+ "node": ">=18.0.0",
55
+ "npm": ">=8.0.0"
56
+ },
57
+ "os": [
58
+ "darwin",
59
+ "linux",
60
+ "win32"
61
+ ],
62
+ "files": [
63
+ "bin/",
64
+ "README.md",
65
+ "LICENSE",
66
+ "CHANGELOG.md"
67
+ ],
68
+ "dependencies": {
69
+ "chalk": "^4.1.2",
70
+ "commander": "^11.1.0",
71
+ "inquirer": "^8.2.6",
72
+ "ora": "^5.4.1",
73
+ "execa": "^5.1.1",
74
+ "fs-extra": "^11.2.0"
75
+ },
76
+ "devDependencies": {
77
+ "@types/node": "^20.0.0"
78
+ }
79
+ }