@jatinmourya/ng-init 1.2.9 → 1.2.11

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.
Files changed (3) hide show
  1. package/README.md +25 -152
  2. package/dist/cli.js +72 -235
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -19,14 +19,6 @@ A comprehensive command-line interface (CLI) tool designed to automate and strea
19
19
 
20
20
  ### Advanced Features
21
21
 
22
- - **🎨 Pre-configured Project Templates**
23
- - Basic SPA (Minimal setup)
24
- - Enterprise (NgRx, Material, ESLint)
25
- - PWA Ready (Service workers, offline support)
26
- - Material Design (Angular Material components)
27
- - Testing Ready (Jest, Testing Library)
28
- - Standalone Components (Modern Angular)
29
-
30
22
  - **🔍 Interactive Library Search & Installation**
31
23
  - Real-time npm package search with autocomplete
32
24
  - Package validation and metadata display
@@ -41,41 +33,6 @@ A comprehensive command-line interface (CLI) tool designed to automate and strea
41
33
  - Displays compatibility warnings
42
34
  - Caches npm responses for performance
43
35
 
44
- - **📦 Popular Library Bundles**
45
- - UI Framework Bundle (Material + CDK + Flex Layout)
46
- - State Management Bundle (NgRx suite)
47
- - Form & Validation Bundle
48
- - Testing Bundle (Jest + Testing Library)
49
- - Performance Bundle (Universal + optimization)
50
- - Authentication Bundle (Firebase integration)
51
- - Utilities Bundle (Lodash, date-fns, RxJS)
52
- - HTTP & API Bundle
53
-
54
- - **🔧 Configuration Presets**
55
- - TypeScript strict mode
56
- - ESLint + Prettier setup
57
- - Husky pre-commit hooks
58
- - Custom configurations
59
-
60
- - **📁 Project Structure Generator**
61
- - Standard Angular structure (core, shared, features)
62
- - Domain-driven structure
63
- - Automatic folder and file generation
64
-
65
- - **🔐 Environment Configuration**
66
- - Environment file templates
67
- - Configuration management
68
-
69
- - **🚀 Git Integration**
70
- - Initialize repository
71
- - Create .gitignore with Angular-specific entries
72
- - Initial commit creation
73
-
74
- - **📚 Documentation Generation**
75
- - Auto-generate README.md
76
- - CHANGELOG.md template
77
- - Project structure documentation
78
-
79
36
  - **💾 Profile Management**
80
37
  - Save configurations as reusable profiles
81
38
  - Load saved profiles for quick setup
@@ -121,10 +78,8 @@ This starts the interactive CLI that guides you through:
121
78
  2. Angular version selection
122
79
  3. Node.js compatibility check and resolution
123
80
  4. Project configuration
124
- 5. Template selection
125
- 6. Library search and installation
126
- 7. Additional features setup
127
- 8. Profile saving option
81
+ 5. Library search and installation
82
+ 6. Profile saving option
128
83
 
129
84
  ### Check System Versions
130
85
 
@@ -184,16 +139,14 @@ ng-init examples
184
139
 
185
140
  ## 🎯 Usage Examples
186
141
 
187
- ### Example 1: Create Enterprise Project with Material
142
+ ### Example 1: Create Project with Libraries
188
143
 
189
144
  1. Run `ng-init`
190
145
  2. Select Angular version 17
191
- 3. Choose "Enterprise" template
146
+ 3. Configure project options (routing, style, etc.)
192
147
  4. Select "Interactive search" for libraries
193
- 5. Search and add additional packages
194
- 6. Enable Git initialization
195
- 7. Enable README generation
196
- 8. Save as profile for future use
148
+ 5. Search and add packages like @angular/material, @ngrx/store
149
+ 6. Save as profile for future use
197
150
 
198
151
  ### Example 2: Quick Setup with Saved Profile
199
152
 
@@ -203,15 +156,13 @@ ng-init examples
203
156
  4. Confirm configuration
204
157
  5. Project is created automatically
205
158
 
206
- ### Example 3: PWA Project with Testing
159
+ ### Example 3: Quick Project Setup
207
160
 
208
161
  1. Run `ng-init`
209
162
  2. Select latest Angular version
210
- 3. Choose "PWA Ready" template
211
- 4. Select "Testing Bundle" from bundles
212
- 5. Enable ESLint + Prettier
213
- 6. Enable Husky hooks
214
- 7. Project created with complete testing setup
163
+ 3. Configure project options
164
+ 4. Skip library installation
165
+ 5. Project created with basic Angular setup
215
166
 
216
167
  ## 📊 CLI Application Flow Diagram
217
168
 
@@ -269,26 +220,15 @@ flowchart TB
269
220
  BB -->|"Custom"| DD["Enter custom path"]
270
221
  CC --> EE["Project path confirmed"]
271
222
  DD --> EE
272
- end
273
-
274
- subgraph TEMPLATE["🎨 Template Selection"]
275
- EE --> FF{"Select template"}
276
- FF -->|"Basic SPA"| GG["Minimal setup"]
277
- FF -->|"Enterprise"| HH["NgRx + Material + ESLint"]
278
- FF -->|"PWA Ready"| II["Service workers + offline"]
279
- FF -->|"Material Design"| JJ["Angular Material components"]
280
- FF -->|"Testing Ready"| KK["Jest + Testing Library"]
281
- FF -->|"Standalone"| LL["Modern standalone components"]
282
- FF -->|"Custom"| MM["Configure manually"]
283
- MM --> NN["Enable routing?"]
284
- NN --> OO["Select stylesheet format"]
285
- OO --> PP["Enable strict mode?"]
286
- PP --> QQ["Use standalone components?"]
287
- GG & HH & II & JJ & KK & LL & QQ --> RR["Template configured"]
223
+ EE --> FF["Enable routing?"]
224
+ FF --> GG["Select stylesheet format"]
225
+ GG --> HH["Enable strict mode?"]
226
+ HH --> II["Use standalone components?"]
227
+ II --> JJ["Project configuration complete"]
288
228
  end
289
229
 
290
230
  subgraph LIBRARY["📚 Library Selection"]
291
- RR --> SS{"Library selection method?"}
231
+ JJ --> SS{"Library selection method?"}
292
232
  SS -->|"Interactive Search"| TT["Search npm packages"]
293
233
  TT --> UU["Select package"]
294
234
  UU --> VV["Choose version method"]
@@ -303,26 +243,11 @@ flowchart TB
303
243
  SS -->|"Manual Input"| CCC["Enter package names"]
304
244
  CCC --> BBB
305
245
 
306
- SS -->|"Library Bundles"| DDD["Select predefined bundles"]
307
- DDD --> EEE["UI Framework / State Mgmt /<br/>Forms / Testing / etc."]
308
- EEE --> BBB
309
-
310
246
  SS -->|"Skip"| BBB
311
247
  end
312
248
 
313
- subgraph FEATURES["⚙️ Additional Features"]
314
- BBB --> FFF["Select features"]
315
- FFF --> GGG["☑️ Git initialization"]
316
- FFF --> HHH["☑️ Project structure"]
317
- FFF --> III["☑️ README.md"]
318
- FFF --> JJJ["☐ CHANGELOG.md"]
319
- FFF --> KKK["☐ ESLint + Prettier"]
320
- FFF --> LLL["☐ Husky hooks"]
321
- GGG & HHH & III & JJJ & KKK & LLL --> MMM["Features configured"]
322
- end
323
-
324
249
  subgraph SAVE["💾 Save Profile"]
325
- MMM --> NNN{"Save as profile?"}
250
+ BBB --> NNN{"Save as profile?"}
326
251
  NNN -->|"Yes"| OOO["Enter profile name"]
327
252
  OOO --> PPP["Profile saved"]
328
253
  PPP --> QQQ["Display configuration summary"]
@@ -340,29 +265,7 @@ flowchart TB
340
265
  UUU --> VVV["Resolve library versions"]
341
266
  VVV --> WWW["Install additional libraries"]
342
267
  WWW --> XXX["Run npm install"]
343
- XXX --> YYY{"Structure enabled?"}
344
- YYY -->|"Yes"| ZZZ["Create project folders & files"]
345
- YYY -->|"No"| AAAA
346
- ZZZ --> AAAA{"Git enabled?"}
347
- AAAA -->|"Yes"| BBBB["Initialize Git repo"]
348
- BBBB --> CCCC["Create .gitignore"]
349
- AAAA -->|"No"| DDDD
350
- CCCC --> DDDD{"README enabled?"}
351
- DDDD -->|"Yes"| EEEE["Generate README.md"]
352
- DDDD -->|"No"| FFFF
353
- EEEE --> FFFF{"Changelog enabled?"}
354
- FFFF -->|"Yes"| GGGG["Generate CHANGELOG.md"]
355
- FFFF -->|"No"| HHHH
356
- GGGG --> HHHH{"ESLint enabled?"}
357
- HHHH -->|"Yes"| IIII["Setup ESLint + Prettier"]
358
- HHHH -->|"No"| JJJJ
359
- IIII --> JJJJ{"Husky enabled?"}
360
- JJJJ -->|"Yes"| KKKK["Setup Husky hooks"]
361
- JJJJ -->|"No"| LLLL
362
- KKKK --> LLLL{"Git enabled?"}
363
- LLLL -->|"Yes"| MMMM["Create initial commit"]
364
- LLLL -->|"No"| NNNN
365
- MMMM --> NNNN["🎉 Success!"]
268
+ XXX --> NNNN["🎉 Success!"]
366
269
  end
367
270
 
368
271
  subgraph END["🏁 Complete"]
@@ -377,9 +280,7 @@ flowchart TB
377
280
  style ANGULAR fill:#fff3e0
378
281
  style NODE fill:#ffebee
379
282
  style PROJECT fill:#e8f5e9
380
- style TEMPLATE fill:#fce4ec
381
283
  style LIBRARY fill:#e0f2f1
382
- style FEATURES fill:#fff8e1
383
284
  style SAVE fill:#f3e5f5
384
285
  style CONFIRM fill:#e8eaf6
385
286
  style CREATE fill:#e3f2fd
@@ -396,13 +297,11 @@ flowchart TB
396
297
  | 4 | **Angular Version** | Three-tier selection: Major → Minor → Patch version |
397
298
  | 5 | **Node.js Check** | Validates and resolves Node.js compatibility |
398
299
  | 6 | **Project Setup** | Configure project name and location |
399
- | 7 | **Template** | Choose from 6 pre-configured templates or custom setup |
400
- | 8 | **Libraries** | Interactive search, manual input, or bundled packages |
401
- | 9 | **Features** | Select Git, structure, docs, linting, hooks |
402
- | 10 | **Save Profile** | Optionally save configuration for reuse |
403
- | 11 | **Confirm** | Review summary and confirm creation |
404
- | 12 | **Create** | Execute all selected operations |
405
- | 13 | **Complete** | Display success message and next steps |
300
+ | 7 | **Libraries** | Interactive search or manual input |
301
+ | 8 | **Save Profile** | Optionally save configuration for reuse |
302
+ | 9 | **Confirm** | Review summary and confirm creation |
303
+ | 10 | **Create** | Execute all selected operations |
304
+ | 11 | **Complete** | Display success message and next steps |
406
305
 
407
306
  ## 🏗️ Project Structure
408
307
 
@@ -419,39 +318,13 @@ ng-init/
419
318
  │ │ ├── prompt-handler.js # Interactive prompts
420
319
  │ │ ├── file-utils.js # File operations
421
320
  │ │ └── profile-manager.js # Profile management
422
- │ └── templates/ # Project templates
423
- │ └── templates.js # Template definitions
321
+ │ └── templates/ # Configuration templates (disabled)
322
+ │ └── templates.js # Template definitions (all features disabled)
424
323
  ├── build.js # Build script for production
425
324
  ├── package.json
426
325
  └── README.md
427
326
  ```
428
327
 
429
- ## 🔧 Configuration
430
-
431
- ### Project Templates
432
-
433
- The CLI includes several pre-configured templates:
434
-
435
- - **basic**: Minimal Angular setup with routing
436
- - **enterprise**: Complete setup with NgRx, Material, ESLint
437
- - **pwa**: Progressive Web App ready
438
- - **material**: Angular Material UI components
439
- - **testing**: Jest and Testing Library setup
440
- - **standalone**: Modern standalone components
441
-
442
- ### Library Bundles
443
-
444
- Pre-configured library combinations for common use cases:
445
-
446
- - **uiFramework**: Angular Material suite
447
- - **stateManagement**: NgRx complete setup
448
- - **forms**: Form utilities and validators
449
- - **testing**: Complete testing stack
450
- - **performance**: Optimization tools
451
- - **authentication**: Auth integration
452
- - **utilities**: Common utility libraries
453
- - **http**: HTTP and API tools
454
-
455
328
  ## 🤝 Contributing
456
329
 
457
330
  Contributions are welcome! Please feel free to submit a Pull Request.
package/dist/cli.js CHANGED
@@ -1,244 +1,81 @@
1
1
  #!/usr/bin/env node
2
- var xe=Object.defineProperty;var s=(e,n)=>xe(e,"name",{value:n,configurable:!0});var mt=(e,n)=>()=>(e&&(n=e(e=0)),n);var ft=(e,n)=>{for(var t in n)xe(e,t,{get:n[t],enumerable:!0})};var Ae={};ft(Ae,{compareVersions:()=>ht,displaySystemVersions:()=>ie,getAngularCliVersion:()=>Se,getAvailableNodeVersions:()=>yt,getInstalledNodeVersions:()=>le,getNodeVersion:()=>Y,getNpmVersion:()=>je,getNvmVersion:()=>se,installNodeVersion:()=>ce,isNvmInstalled:()=>ae,satisfiesVersion:()=>wt,switchNodeVersion:()=>K});import{execa as N}from"execa";import P from"chalk";import Ce from"semver";async function Y(){try{let{stdout:e}=await N("node",["--version"]);return e.trim().replace("v","")}catch{return null}}async function je(){try{let{stdout:e}=await N("npm",["--version"]);return e.trim()}catch{return null}}async function se(){try{let{stdout:e}=await N("nvm",["--version"],{shell:!0});return e.trim()}catch{return null}}async function ae(){return await se()!==null}async function Se(){try{let{stdout:e}=await N("ng",["--version"],{shell:!0});return e.trim()||null}catch{return null}}async function ie(){console.log(P.bold.cyan(`
3
- \u{1F50D} System Environment Check
4
- `)),console.log(P.gray("\u2501".repeat(50)));let e=await Y(),n=await je(),t=await se(),r=await Se();return console.log(P.white("Node.js: ")+(e?P.green(`v${e}`):P.red("Not installed"))),console.log(P.white("npm: ")+(n?P.green(`v${n}`):P.red("Not installed"))),console.log(P.white("nvm: ")+(t?P.green(`v${t}`):P.yellow("Not installed"))),console.log(P.white("Angular CLI: ")+(r?P.green(`v${r}`):P.yellow("Not installed"))),console.log(P.gray("\u2501".repeat(50))+`
5
- `),{node:e,npm:n,nvm:t,angularCli:r}}async function yt(){try{let{stdout:e}=await N("nvm",["list","available"],{shell:!0}),n=[],t=e.split(`
6
- `);for(let r of t){let o=r.match(/(\d+\.\d+\.\d+)/);o&&n.push(o[1])}return n}catch{return[]}}async function le(){try{let{stdout:e}=await N("nvm",["list"],{shell:!0}),n=[],t=e.split(`
7
- `);for(let r of t){let o=r.match(/(\d+\.\d+\.\d+)/);o&&n.push(o[1])}return n}catch{return[]}}async function K(e){try{return await N("nvm",["use",e],{shell:!0,stdio:"inherit"}),!0}catch{return!1}}async function ce(e){try{return await N("nvm",["install",e],{shell:!0,stdio:"inherit"}),!0}catch{return!1}}function ht(e,n){return Ce.compare(e,n)}function wt(e,n){return Ce.satisfies(e,n)}var ue=mt(()=>{s(Y,"getNodeVersion");s(je,"getNpmVersion");s(se,"getNvmVersion");s(ae,"isNvmInstalled");s(Se,"getAngularCliVersion");s(ie,"displaySystemVersions");s(yt,"getAvailableNodeVersions");s(le,"getInstalledNodeVersions");s(K,"switchNodeVersion");s(ce,"installNodeVersion");s(ht,"compareVersions");s(wt,"satisfiesVersion")});import{Command as Ut}from"commander";ue();import{select as A,input as ke,confirm as E,checkbox as pt}from"@inquirer/prompts";import a from"chalk";import Lt from"path";import M from"axios";import vt from"lodash.debounce";var X="https://registry.npmjs.org",bt="https://registry.npmjs.org/-/v1/search",$t="https://api.npmjs.org/downloads/point/last-week";async function pe(e,n=10){try{return(await M.get(bt,{params:{text:e,size:n},timeout:5e3})).data.objects.map(r=>({name:r.package.name,version:r.package.version,description:r.package.description||"No description",author:r.package.publisher?.username||"Unknown",date:r.package.date,verified:r.package.publisher?.verified||!1}))}catch(t){return console.error("Error searching npm packages:",t.message),[]}}s(pe,"searchNpmPackages");async function kt(e){try{let n=await M.get(`${X}/${e}`,{timeout:5e3}),t=n.data["dist-tags"]?.latest,r=Object.keys(n.data.versions||{});return{name:n.data.name,description:n.data.description||"No description",latestVersion:t,versions:r,homepage:n.data.homepage,repository:n.data.repository,license:n.data.license,keywords:n.data.keywords||[]}}catch(n){if(n.response?.status===404)return null;throw n}}s(kt,"getPackageDetails");async function Pt(e){try{return(await M.get(`${$t}/${e}`,{timeout:5e3})).data.downloads}catch{return 0}}s(Pt,"getPackageDownloads");async function Ne(e){try{let[n,t]=await Promise.all([kt(e),Pt(e)]);return n?{...n,weeklyDownloads:t}:null}catch(n){return console.error(`Error getting package info for ${e}:`,n.message),null}}s(Ne,"getEnhancedPackageInfo");function de(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}s(de,"formatDownloads");var on=vt(async(e,n)=>{if(!e||e.length<2){n([]);return}let t=await pe(e,10);n(t)},300);async function Ie(){try{let e=await M.get(`${X}/@angular/cli`,{timeout:1e4}),n=Object.keys(e.data.versions||{}).filter(r=>!r.includes("rc")&&!r.includes("beta")&&!r.includes("next")).sort((r,o)=>{let l=r.split(".").map(Number),i=o.split(".").map(Number);for(let c=0;c<Math.max(l.length,i.length);c++){let $=l[c]||0,p=i[c]||0;if($!==p)return p-$}return 0}),t=e.data["dist-tags"]||{};return{versions:n,latest:t.latest,lts:t.lts}}catch(e){return console.error("Error fetching Angular versions:",e.message),{versions:[],latest:null,lts:null}}}s(Ie,"getAngularVersions");function Q(e){let n=new Set;return e.forEach(t=>{let r=t.split(".")[0];n.add(r)}),Array.from(n).sort((t,r)=>Number(r)-Number(t))}s(Q,"getMajorVersions");function Z(e,n){let t=new Set;return e.filter(r=>r.startsWith(`${n}.`)).forEach(r=>{let o=r.split("."),l=`${o[0]}.${o[1]}`;t.add(l)}),Array.from(t).sort((r,o)=>{let l=r.split(".").map(Number),i=o.split(".").map(Number);for(let c=0;c<Math.max(l.length,i.length);c++){let $=l[c]||0,p=i[c]||0;if($!==p)return p-$}return 0})}s(Z,"getMinorVersionsForMajor");function ee(e,n){return e.filter(t=>t.startsWith(`${n}.`)).sort((t,r)=>{let o=t.split(".").map(Number),l=r.split(".").map(Number);for(let i=0;i<Math.max(o.length,l.length);i++){let c=o[i]||0,$=l[i]||0;if(c!==$)return $-c}return 0})}s(ee,"getPatchVersionsForMinor");async function Ee(e){try{let n=await M.get(`${X}/${e}`,{timeout:1e4}),t=Object.keys(n.data.versions||{}).filter(o=>!o.includes("rc")&&!o.includes("beta")&&!o.includes("next")&&!o.includes("alpha")).sort((o,l)=>{let i=o.split(".").map(Number),c=l.split(".").map(Number);for(let $=0;$<Math.max(i.length,c.length);$++){let p=i[$]||0,k=c[$]||0;if(p!==k)return k-p}return 0}),r=n.data["dist-tags"]||{};return{versions:t,latest:r.latest,lts:r.lts}}catch(n){return console.error(`Error fetching versions for ${e}:`,n.message),{versions:[],latest:null,lts:null}}}s(Ee,"getPackageVersions");async function Ve(e){try{return((await M.get(`${X}/@angular/cli/${e}`,{timeout:5e3})).data.engines||{}).node||"^18.13.0 || ^20.9.0"}catch{let t=parseInt(e.split(".")[0]);return t>=19?"^18.19.1 || ^20.11.1 || ^22.0.0":t>=17?"^18.13.0 || ^20.9.0":t>=16?"^16.14.0 || ^18.10.0":t>=15?"^14.20.0 || ^16.13.0 || ^18.10.0":t>=14?"^14.15.0 || ^16.10.0":"^14.0.0 || ^16.0.0 || ^18.0.0"}}s(Ve,"getNodeRequirementsForAngular");import F from"semver";import j from"chalk";import De from"axios";var Le="https://registry.npmjs.org",U=new Map,xt=300*1e3,Ct=100;function Re(e,n){try{return{compatible:F.satisfies(e,n),current:e,required:n}}catch(t){return{compatible:!1,current:e,required:n,error:t.message}}}s(Re,"checkNodeCompatibility");function Me(e){return console.log(j.bold.cyan(`
8
- \u{1F4CB} Compatibility Check
9
- `)),console.log(j.gray("\u2501".repeat(50))),console.log(j.white("Current Node.js: ")+j.cyan(`v${e.current}`)),console.log(j.white("Required Node.js: ")+j.cyan(e.required)),e.compatible?console.log(j.white("Status: ")+j.green("\u2713 Compatible")):console.log(j.white("Status: ")+j.red("\u2717 Incompatible")),console.log(j.gray("\u2501".repeat(50))+`
10
- `),e.compatible}s(Me,"displayCompatibilityStatus");function Fe(e,n){try{return e.filter(t=>{try{return F.satisfies(t,n)}catch{return!1}}).sort((t,r)=>F.rcompare(t,r))}catch{return[]}}s(Fe,"findCompatibleVersions");function Te(e){try{let n=e.split("||").map(t=>t.trim());for(let t of n){let r=t.match(/(\d+)\./);if(r){let o=parseInt(r[1]);if(o===20)return"20.11.0";if(o===18)return"18.19.0";if(o===16)return"16.20.2";if(o===14)return"14.21.3"}}return"18.19.0"}catch{return"18.19.0"}}s(Te,"getRecommendedNodeVersion");async function Oe(e){let n=e,t=U.get(n);if(t&&Date.now()-t.timestamp<xt)return t.data;try{let o=(await De.get(`${Le}/${encodeURIComponent(e)}`,{timeout:1e4})).data;if(U.size>=Ct){let l=U.keys().next().value;U.delete(l)}return U.set(n,{data:o,timestamp:Date.now()}),o}catch(r){return console.error(j.gray(`Could not fetch package data for ${e}: ${r.message}`)),null}}s(Oe,"fetchPackageData");async function jt(e,n){try{return(await De.get(`${Le}/${encodeURIComponent(e)}/${n}`,{timeout:5e3})).data}catch{return null}}s(jt,"fetchPackageVersionData");async function St(e,n){return(await jt(e,n))?.peerDependencies||{}}s(St,"getPackagePeerDependencies");async function T(e,n,t){let r=await St(e,n),o=r["@angular/core"]||r["@angular/common"];if(!o)return{compatible:!0,reason:"No Angular peer dependency"};try{let l=F.satisfies(t,o);return{compatible:l,peerDependency:o,reason:l?`Angular ${t} satisfies ${o}`:`Angular ${t} does not satisfy ${o}`}}catch{let i=t.split(".")[0],$=[`^${i}.`,`~${i}.`,`>=${i}.`,`${i}.`].some(p=>o.includes(p));return{compatible:$,peerDependency:o,reason:$?`Peer dependency appears compatible with Angular ${i}`:`Peer dependency ${o} may not support Angular ${i}`}}}s(T,"isVersionCompatibleWithAngular");async function At(e,n,t=!0){let r=await Oe(e);if(!r)return{version:"latest",source:"fallback",reason:"Could not fetch package data"};let o=parseInt(n.split(".")[0]),l=Object.keys(r.versions||{}).filter(p=>!p.includes("rc")&&!p.includes("beta")&&!p.includes("alpha")&&!p.includes("next")).sort((p,k)=>F.rcompare(p,k));if(e.startsWith("@angular/")){let p=l.filter(k=>parseInt(k.split(".")[0])===o);if(p.length>0)return{version:`^${p[0]}`,source:"dynamic",reason:`Matched Angular major version ${o}`}}let i=[],c=l.slice(0,20);for(let p of c){let k=await T(e,p,n);if(k.compatible&&(i.push({version:p,peerDependency:k.peerDependency}),t))return{version:`^${p}`,source:"dynamic",reason:k.reason,peerDependency:k.peerDependency}}if(i.length>0){let p=i[0];return{version:`^${p.version}`,source:"dynamic",reason:`Found ${i.length} compatible version(s)`,peerDependency:p.peerDependency}}let $=r["dist-tags"]?.latest;return{version:$?`^${$}`:"latest",source:"fallback",reason:"No version with compatible Angular peer dependency found",warning:!0}}s(At,"findCompatibleLibraryVersion");async function _e(e,n){let t=[];for(let r of e){let o=r.version||"latest";if(o==="latest"){let l=await At(r.name,n);t.push({...r,version:l.version,originalVersion:o,adjusted:l.source==="dynamic",source:l.source,reason:l.reason,warning:l.warning||!1})}else{let l=await T(r.name,o.replace(/[\^~]/,""),n);t.push({...r,adjusted:!1,compatible:l.compatible,reason:l.reason,warning:!l.compatible})}}return t}s(_e,"resolveLibraryVersionsAsync");async function Ge(e,n,t=10){let r=await Oe(e);if(!r)return[];let o=Object.keys(r.versions||{}).filter(i=>!i.includes("rc")&&!i.includes("beta")&&!i.includes("alpha")&&!i.includes("next")).sort((i,c)=>F.rcompare(i,c)),l=[];for(let i of o){if(l.length>=t)break;let c=await T(e,i,n);c.compatible&&l.push({version:i,peerDependency:c.peerDependency,reason:c.reason})}return l}s(Ge,"getAllCompatibleVersions");import{execa as O}from"execa";import te from"ora";import d from"chalk";import{platform as Nt}from"os";async function Ue(e="LTS"){let n=te("Installing Node.js with winget...").start();try{return await O("winget",["install",e==="LTS"?"OpenJS.NodeJS.LTS":"OpenJS.NodeJS"],{stdio:"inherit"}),n.succeed("Node.js installed successfully"),!0}catch(t){return n.fail("Failed to install Node.js"),console.error(d.red(t.message)),!1}}s(Ue,"installNodeWithWinget");function It(){switch(Nt()){case"win32":return{os:"Windows",download:"https://github.com/coreybutler/nvm-windows/releases",steps:["Download nvm-setup.exe","Run the installer","Restart your terminal"]};case"darwin":return{os:"macOS",repo:"https://github.com/nvm-sh/nvm",install:"curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash",postInstall:["Restart terminal","If using zsh: source ~/.zshrc","If using bash: source ~/.bash_profile"],steps:["Run the install command","Reload your shell configuration","Verify: nvm --version","Install Node: nvm install node"]};default:return{os:"Linux",repo:"https://github.com/nvm-sh/nvm",install:"curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash",alternative:"wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash",steps:["Run install command","Restart terminal or run: source ~/.bashrc","Verify: nvm --version","Install Node: nvm install node"]}}}s(It,"getNvmInstallInstructions");function Je(){let e=It();console.log(d.bold.yellow(`
11
- \u{1F4DA} NVM Installation Guide
12
- `)),console.log(d.gray("\u2501".repeat(50))),console.log(d.white("OS: ")+d.cyan(e.os)),e.download&&console.log(d.white("Download: ")+d.blue(e.download)),e.repo&&console.log(d.white("Repository: ")+d.blue(e.repo)),e.install&&(console.log(d.white(`
13
- Install Command:`)),console.log(d.green(` ${e.install}`))),e.alternative&&(console.log(d.white(`
14
- Alternative Command:`)),console.log(d.green(` ${e.alternative}`))),Array.isArray(e.steps)&&(console.log(d.white(`
15
- Steps:`)),e.steps.forEach((n,t)=>{console.log(d.gray(` ${t+1}. ${n}`))})),Array.isArray(e.postInstall)&&(console.log(d.white(`
16
- Post-Install:`)),e.postInstall.forEach((n,t)=>{console.log(d.gray(` ${t+1}. ${n}`))})),console.log(d.gray("\u2501".repeat(50))),console.log(d.yellow(`
17
- \u{1F4A1} Why use NVM?`)),console.log(d.gray(" \u2022 Manage multiple Node.js versions")),console.log(d.gray(" \u2022 Switch instantly")),console.log(d.gray(" \u2022 No sudo/admin required")),console.log(d.gray(` \u2022 Per-project Node versions
18
- `))}s(Je,"displayNvmInstallGuide");async function J(e,n,t=!1){let r=te(`Installing ${e.length} package(s)...`).start();try{let o=["install"];return t&&o.push("--save-dev"),o.push(...e),await O("npm",o,{cwd:n}),r.succeed("Packages installed successfully"),!0}catch{r.warn("Failed with strict dependencies, retrying with --legacy-peer-deps...");try{let l=["install","--legacy-peer-deps"];return t&&l.push("--save-dev"),l.push(...e),await O("npm",l,{cwd:n}),r.succeed("Packages installed successfully with --legacy-peer-deps"),console.log(d.yellow("\u26A0\uFE0F Note: Installed with --legacy-peer-deps flag due to peer dependency conflicts")),!0}catch(l){return r.fail("Failed to install packages"),console.error(d.red(l.message)),console.log(d.yellow(`
19
- \u{1F4A1} Tip: You can try installing manually with:`)),console.log(d.cyan(` cd ${n}`)),console.log(d.cyan(` npm install ${e.join(" ")} --force`)),!1}}}s(J,"installPackages");async function We(e){let n=te("Installing dependencies...").start();try{return await O("npm",["install"],{cwd:e}),n.succeed("Dependencies installed successfully"),!0}catch{n.warn("Failed with strict dependencies, retrying with --legacy-peer-deps...");try{return await O("npm",["install","--legacy-peer-deps"],{cwd:e}),n.succeed("Dependencies installed successfully with --legacy-peer-deps"),console.log(d.yellow("\u26A0\uFE0F Note: Installed with --legacy-peer-deps flag due to peer dependency conflicts")),!0}catch(r){return n.fail("Failed to install dependencies"),console.error(d.red(r.message)),console.log(d.yellow(`
20
- \u{1F4A1} Tip: You can try installing manually with:`)),console.log(d.cyan(` cd ${e}`)),console.log(d.cyan(" npm install --force")),!1}}}s(We,"runNpmInstall");async function ze(e,n,t={}){let r=te(`Creating Angular project: ${e}...`).start();try{let o=["new",e];t.skipInstall&&o.push("--skip-install"),t.routing!==void 0&&o.push(`--routing=${t.routing}`),t.style&&o.push(`--style=${t.style}`),t.strict!==void 0&&o.push(`--strict=${t.strict}`),t.standalone!==void 0&&o.push(`--standalone=${t.standalone}`);let l=n?`@angular/cli@${n}`:"@angular/cli";return await O("npx",[l,...o],{stdio:"inherit"}),r.succeed(`Angular project ${e} created successfully`),!0}catch(o){return r.fail("Failed to create Angular project"),console.error(d.red(o.message)),!1}}s(ze,"createAngularProject");import{search as Et,select as _,input as ge,confirm as W}from"@inquirer/prompts";import y from"chalk";async function Be(e=null){let n=[],t=!0;for(console.log(y.bold.cyan(`
2
+ var Pe=Object.defineProperty;var o=(t,e)=>Pe(t,"name",{value:e,configurable:!0});var h=(t,e)=>()=>(t&&(e=t(t=0)),e);var _=(t,e)=>{for(var n in e)Pe(t,n,{get:e[n],enumerable:!0})};var Ce={};_(Ce,{printKeyValue:()=>y,printObjectList:()=>g,printSimpleTable:()=>Pt});import Ne from"cli-table3";import W from"chalk";function ke(t,e){t&&console.log(W.bold.cyan(`
3
+ ${t}
4
+ `)),console.log(e.toString()+`
5
+ `)}function Y(t){return t==null?"":String(t)}function y(t,e=[]){if(e.length===0){console.log(W.yellow(`No ${t||"items"} to display.`));return}let n=new Ne({head:["Field","Value"],style:je});for(let[r,s]of e)n.push([Y(r),Y(s)]);ke(t,n)}function g(t,e=[],n=[]){if(!Array.isArray(e)||e.length===0){console.log(W.yellow(`No ${t||"items"} to display.`));return}let r=new Ne({head:n,style:je});for(let s of e)r.push(n.map(i=>Y(s[i])));ke(t,r)}function Pt(t,e=[]){if(!Array.isArray(e)||e.length===0){console.log(W.yellow(`No ${t||"items"} to display.`));return}g(t,e,Object.keys(e[0]))}var je,b=h(()=>{je={head:["cyan"]};o(ke,"render");o(Y,"toStr");o(y,"printKeyValue");o(g,"printObjectList");o(Pt,"printSimpleTable")});var Oe={};_(Oe,{compareVersions:()=>jt,displaySystemVersions:()=>te,getAngularCliVersion:()=>Le,getAvailableNodeVersions:()=>Nt,getInstalledNodeVersions:()=>ne,getNodeVersion:()=>z,getNpmVersion:()=>De,getNvmVersion:()=>Z,installNodeVersion:()=>re,isNvmInstalled:()=>ee,satisfiesVersion:()=>kt,switchNodeVersion:()=>J});import{execa as X}from"execa";import Ie from"semver";async function Q(t,e,n){try{let{stdout:r}=await X(t,e,n);return r.trim()||null}catch{return null}}async function U(t,e,n){let r=await Q(t,e,n);if(!r)return null;let s=r.match(Ve);return s?s[1]:null}function Ee(t){if(!t)return[];let e=[];for(let n of t.split(`
6
+ `)){let r=n.match(Ve);r&&e.push(r[1])}return e}function z(){return U("node",["--version"])}function De(){return U("npm",["--version"])}function Z(){return U("nvm",["--version"],k)}async function ee(){return await Z()!==null}function Le(){return U("ng",["version"],k)}async function te(){let[t,e,n,r]=await Promise.all([z(),De(),Z(),Le()]),s=o(i=>i??"Not installed","format");return g("\u{1F50D} System Environment Check",[{Tool:"Node.js",Version:s(t)},{Tool:"npm",Version:s(e)},{Tool:"nvm",Version:s(n)},{Tool:"Angular CLI",Version:s(r)}],["Tool","Version"]),{node:t,npm:e,nvm:n,angularCli:r}}async function Nt(){let t=await Q("nvm",["list","available"],k);return Ee(t)}async function ne(){let t=await Q("nvm",["list"],k);return Ee(t)}async function J(t){try{return await X("nvm",["use",t],{...k,stdio:"inherit"}),!0}catch{return!1}}async function re(t){try{return await X("nvm",["install",t],{...k,stdio:"inherit"}),!0}catch{return!1}}function jt(t,e){return Ie.compare(t,e)}function kt(t,e){return Ie.satisfies(t,e)}var Ve,k,oe=h(()=>{b();Ve=/(\d+\.\d+\.\d+)/;o(Q,"run");o(U,"runVersion");o(Ee,"extractVersionsFromOutput");k={shell:!0};o(z,"getNodeVersion");o(De,"getNpmVersion");o(Z,"getNvmVersion");o(ee,"isNvmInstalled");o(Le,"getAngularCliVersion");o(te,"displaySystemVersions");o(Nt,"getAvailableNodeVersions");o(ne,"getInstalledNodeVersions");o(J,"switchNodeVersion");o(re,"installNodeVersion");o(jt,"compareVersions");o(kt,"satisfiesVersion")});import Me from"axios";import Ct from"chalk";import{Agent as It}from"node:http";import{Agent as Vt}from"node:https";function Ft(t,e){let n=t.split(".").map(Number),r=e.split(".").map(Number);for(let s=0,i=Math.max(n.length,r.length);s<i;s++){let c=(n[s]||0)-(r[s]||0);if(c!==0)return c}return 0}function ae(t){return[...t].sort((e,n)=>Ft(n,e))}function Tt(t){return ae(t.filter(e=>!Rt.test(e)))}function ze({package:t}){return{name:t.name,version:t.version,description:t.description||"No description",author:t.publisher?.username||"Unknown",date:t.date,verified:t.publisher?.verified??!1}}function C(t){return Ue.dedupe(`abbr:${t}`,async()=>{let{data:e}=await Mt.get(`${ie}/${t}`);return e})}function _t(t){return Ue.dedupe(`full:${t}`,async()=>{let{data:e}=await G.get(`${ie}/${t}`);return e})}async function Je(t,e=10,{signal:n}={}){if(!t?.trim())return[];try{let{data:r}=await G.get(Fe,{params:{text:t,size:e},signal:n});return r.objects.map(ze)}catch(r){return r.name==="CanceledError"||n?.aborted?[]:(console.error("Error searching npm packages:",r.message),[])}}async function Wt(t){try{let e=await _t(t);return{name:e.name,description:e.description||"No description",latestVersion:e["dist-tags"]?.latest,versions:Object.keys(e.versions||{}),homepage:e.homepage,repository:e.repository,license:e.license,keywords:e.keywords||[]}}catch(e){if(e.response?.status===404)return null;throw e}}async function Ut(t){try{let{data:e}=await G.get(`${Et}/${t}`);return e.downloads}catch{return 0}}async function Ge(t){try{let[e,n]=await Promise.all([Wt(t),Ut(t)]);return e?{...e,weeklyDownloads:n}:null}catch(e){return console.error(`Error getting package info for ${t}:`,e.message),null}}function He(t){return t>=1e9?`${(t/1e9).toFixed(1)}B`:t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}function zt(t=300){let e=null,n=null;return o(function(s,i){if(e&&clearTimeout(e),n&&n.abort(),!s||s.length<2){i([]);return}let c=n=new AbortController;e=setTimeout(async()=>{try{let{data:l}=await G.get(Fe,{params:{text:s,size:10},signal:c.signal});c.signal.aborted||i(l.objects.map(ze))}catch{c.signal.aborted||i([])}},t)},"debouncedSearch")}async function le(t){try{let e=await C(t),n=Tt(Object.keys(e.versions||{})),r=e["dist-tags"]||{};return{versions:n,latest:r.latest??null,lts:r.lts??null}}catch(e){return console.error(`Error fetching versions for ${t}:`,e.message),{versions:[],latest:null,lts:null}}}function qe(){return le("@angular/cli")}function Be(t){return[...new Set(t.map(n=>n.split(".")[0]))].sort((n,r)=>Number(r)-Number(n))}function Ke(t,e){let n=`${e}.`,r=[...new Set(t.filter(s=>s.startsWith(n)).map(s=>s.split(".").slice(0,2).join(".")))];return ae(r)}function Ye(t,e){return ae(t.filter(n=>n.startsWith(`${e}.`)))}async function Xe(t){let e=parseInt(t.split(".")[0],10);try{let r=(await C("@angular/cli")).versions?.[t]?.engines?.node;return r||Re(e)}catch{return console.log(Ct.gray(`Unable to fetch Node requirements, deriving from Angular ${e}\u2026`)),Re(e)}}function Re(t){let e;return t>=15?e=Math.floor(t/2)*2:t>=10?e=Math.floor((t+2)/2)*2:e=Math.floor(t*1.5/2)*2,`^${e}.0.0 || ^${e+2}.0.0 || ^${e+4}.0.0`}var ie,Fe,Et,Dt,Lt,Ot,Rt,Te,_e,We,G,Mt,se,Ue,Gn,H=h(()=>{ie="https://registry.npmjs.org",Fe=`${ie}/-/v1/search`,Et="https://api.npmjs.org/downloads/point/last-week",Dt=5e3,Lt=1e4,Ot=5*6e4,Rt=/-(rc|beta|next|alpha|canary|dev|pre)/i,Te={keepAlive:!0,maxSockets:15,maxFreeSockets:5},_e=new It(Te),We=new Vt(Te),G=Me.create({timeout:Dt,httpAgent:_e,httpsAgent:We,headers:{"Accept-Encoding":"gzip, deflate, br"}}),Mt=Me.create({timeout:Lt,httpAgent:_e,httpsAgent:We,headers:{Accept:"application/vnd.npm.install-v1+json","Accept-Encoding":"gzip, deflate, br"}}),se=class{static{o(this,"TTLCache")}#e=new Map;#t=new Map;#n;constructor(e=Ot){this.#n=e}get(e){let n=this.#e.get(e);if(n){if(Date.now()>n.exp){this.#e.delete(e);return}return n.value}}set(e,n){return this.#e.set(e,{value:n,exp:Date.now()+this.#n}),this}async dedupe(e,n){let r=this.get(e);if(r!==void 0)return r;if(!this.#t.has(e)){let s=n().then(i=>(this.set(e,i),this.#t.delete(e),i)).catch(i=>{throw this.#t.delete(e),i});this.#t.set(e,s)}return this.#t.get(e)}clear(){this.#e.clear(),this.#t.clear()}},Ue=new se;o(Ft,"semverCompare");o(ae,"sortDesc");o(Tt,"stableSortedDesc");o(ze,"mapSearchResult");o(C,"fetchAbbreviated");o(_t,"fetchFull");o(Je,"searchNpmPackages");o(Wt,"getPackageDetails");o(Ut,"getPackageDownloads");o(Ge,"getEnhancedPackageInfo");o(He,"formatDownloads");o(zt,"createDebouncedSearch");Gn=zt();o(le,"getPackageVersions");o(qe,"getAngularVersions");o(Be,"getMajorVersions");o(Ke,"getMinorVersionsForMajor");o(Ye,"getPatchVersionsForMinor");o(Xe,"getNodeRequirementsForAngular");o(Re,"deriveNodeRequirement")});import w from"semver";import O from"chalk";function ce(t){for(let e of Jt)if(t[e])return t[e];return null}function Qe(t){return Object.keys(t.versions||{}).filter(e=>w.valid(e)&&!w.prerelease(e)).sort(w.rcompare)}function ue(t,e){try{return w.satisfies(t,e)}catch{let n=t.split(".")[0];return e.includes(`^${n}.`)||e.includes(`~${n}.`)||e.includes(`>=${n}.`)||e.includes(`${n}.x`)}}function Ht(t){return Gt.some(e=>t.startsWith(e))}function Ze(t,e){try{return{compatible:w.satisfies(t,e),current:t,required:e}}catch(n){return{compatible:!1,current:t,required:e,error:n.message}}}function et(t){return y("\u{1F4CB} Compatibility Check",[["Current Node.js",O.cyan(`v${t.current}`)],["Required Node.js",O.cyan(t.required)],["Status",t.compatible?O.green("\u2713 Compatible"):O.red("\u2717 Incompatible")]]),t.compatible}function tt(t,e){return t.filter(n=>{try{return w.satisfies(n,e)}catch{return!1}}).sort(w.rcompare)}function nt(t){try{let e=w.minVersion(t);if(e)return e.version}catch{}return console.log(O.yellow("\u26A0\uFE0F Could not parse Node version range. Please install the latest LTS version.")),null}async function q(t,e,n){try{let s=(await C(t)).versions?.[e]?.peerDependencies??{},i=ce(s);if(!i)return{compatible:!0,hasPeerDependency:!1,reason:"No Angular peer dependency found"};let c=ue(n,i);return{compatible:c,peerDependency:i,hasPeerDependency:!0,reason:c?`Angular ${n} satisfies ${i}`:`Angular ${n} does not satisfy ${i}`}}catch{return{compatible:!0,hasPeerDependency:!1,reason:"Could not verify compatibility"}}}async function rt(t,e,n=10){try{let r=await C(t),s=Qe(r),i=[];for(let c of s){if(i.length>=n)break;let l=r.versions[c]?.peerDependencies??{},u=ce(l);(!u||ue(e,u))&&i.push({version:c,peerDependency:u??"No Angular peer dependency",reason:u?`Satisfies ${u}`:"No peer dependency constraint"})}return i}catch{return[]}}async function qt(t,e){let n;try{n=await C(t)}catch{return{version:"latest",source:"fallback",reason:"Could not fetch package data",warning:!0,matchType:"fallback"}}let r=w.major(e),s=Qe(n),i=n["dist-tags"]?.latest;if(Ht(t)){let c=s.find(l=>parseInt(l.split(".")[0],10)===r);if(c)return{version:`^${c}`,source:"dynamic",reason:`Matched Angular major version ${r}`,matchType:"ecosystem"}}for(let c of s){let l=n.versions[c]?.peerDependencies??{},u=ce(l);if(!u)return{version:`^${c}`,source:"dynamic",reason:"No Angular peer dependency",matchType:"no-peer"};if(ue(e,u))return{version:`^${c}`,source:"dynamic",reason:`Angular ${e} satisfies ${u}`,peerDependency:u,matchType:"peer-dependency"}}return{version:i?`^${i}`:"latest",source:"fallback",reason:"No version with compatible Angular peer dependency found",warning:!0,matchType:"fallback"}}async function ot(t,e){return Promise.all(t.map(n=>Bt(n,e)))}async function Bt(t,e){let n=t.version||"latest";if(n==="latest"){let i=await qt(t.name,e);return{...t,version:i.version,originalVersion:n,adjusted:i.source==="dynamic",source:i.source,reason:i.reason,warning:i.warning||!1}}let r=n.replace(/^[\^~]/,""),s=await q(t.name,r,e);return{...t,adjusted:!1,compatible:s.compatible,reason:s.reason,warning:!s.compatible}}var Jt,Gt,pe=h(()=>{b();H();Jt=["@angular/core","@angular/common","@angular/platform-browser"],Gt=["@angular/","@ngrx/","@ngxs/","@ng-bootstrap/","@angular-eslint/"];o(ce,"findAngularPeerDep");o(Qe,"stableVersionsDesc");o(ue,"satisfiesSafe");o(Ht,"isEcosystemPackage");o(Ze,"checkNodeCompatibility");o(et,"displayCompatibilityStatus");o(tt,"findCompatibleVersions");o(nt,"getRecommendedNodeVersion");o(q,"isVersionCompatibleWithAngular");o(rt,"getAllCompatibleVersions");o(qt,"findCompatibleLibraryVersion");o(ot,"resolveLibraryVersionsAsync");o(Bt,"resolveLibrary")});import{execa as de}from"execa";import I from"ora";import v from"chalk";import{platform as Kt}from"os";async function it({args:t,cwd:e,spinner:n,successMsg:r,failMsg:s,manualHint:i=[]}){try{return await de("npm",t,{cwd:e}),n.succeed(r),!0}catch{}n.warn("Peer dependency conflict \u2014 retrying with --legacy-peer-deps\u2026");try{return await de("npm",[...t,"--legacy-peer-deps"],{cwd:e}),n.succeed(`${r} (with --legacy-peer-deps)`),console.log(v.yellow("\u26A0\uFE0F Note: Installed with --legacy-peer-deps due to peer dependency conflicts")),!0}catch(c){if(n.fail(s),console.error(v.red(c.message)),i.length>0){console.log(v.yellow(`
7
+ \u{1F4A1} Tip: You can try installing manually with:`));for(let l of i)console.log(v.cyan(` ${l}`))}return!1}}function Xt(t=[],{dev:e=!1}={}){let n=["install"];return e&&n.push("--save-dev"),t.length>0&&n.push(...t),n}async function at(t,e,{spinner:n,successMsg:r,failMsg:s}){n.stop();try{return await de(t,e,{stdio:"inherit"}),I().succeed(r),!0}catch(i){return I().fail(s),console.error(v.red(i.message)),!1}}async function lt(t="LTS"){let e=t==="LTS"?"OpenJS.NodeJS.LTS":"OpenJS.NodeJS",n=I("Installing Node.js with winget\u2026").start();return at("winget",["install",e],{spinner:n,successMsg:"Node.js installed successfully",failMsg:"Failed to install Node.js"})}function Qt(){return st[Yt]??st.linux}function ct(){let t=Qt();y("\u{1F4DA} NVM Installation Guide",[["OS",v.cyan(t.os)],["Download/Repo",v.blue(t.download??t.repo??"-")],["Install",t.install?v.green(t.install):"-"],["Alternative",t.alternative?v.green(t.alternative):"-"]]);let e=o(n=>n.map((r,s)=>({Step:`${s+1}`,Instruction:r})),"toRows");t.steps&&g("Steps",e(t.steps),["Step","Instruction"]),t.postInstall&&g("Post-Install",e(t.postInstall),["Step","Instruction"]),g("Why use NVM?",[{Benefit:"Manage multiple Node.js versions"},{Benefit:"Switch instantly"},{Benefit:"No sudo/admin required"},{Benefit:"Per-project Node versions"}],["Benefit"])}function fe(t,e,n=!1){let r=`${t.length} ${n?"dev ":""}package(s)`,s=I(`Installing ${r}\u2026`).start();return it({args:Xt(t,{dev:n}),cwd:e,spinner:s,successMsg:`${r} installed successfully`,failMsg:`Failed to install ${r}`,manualHint:[`cd ${e}`,`npm install ${t.join(" ")}${n?" --save-dev":""} --force`]})}function ut(t){let e=I("Installing dependencies\u2026").start();return it({args:["install"],cwd:t,spinner:e,successMsg:"Dependencies installed successfully",failMsg:"Failed to install dependencies",manualHint:[`cd ${t}`,"npm install --force"]})}function Zt(t,e={}){let n=["new",t],r={skipInstall:"--skip-install",routing:"--routing",style:"--style",strict:"--strict",standalone:"--standalone"};for(let[s,i]of Object.entries(r)){let c=e[s];c!==void 0&&(c===!0&&i==="--skip-install"?n.push(i):c!==void 0&&n.push(`${i}=${c}`))}return n}async function pt(t,e,n={}){let r=e?`@angular/cli@${e}`:"@angular/cli",s=Zt(t,n),i=I(`Creating Angular project: ${t}\u2026`).start();return at("npx",[r,...s],{spinner:i,successMsg:`Angular project ${t} created successfully`,failMsg:"Failed to create Angular project"})}var Yt,st,dt=h(()=>{b();Yt=Kt();o(it,"npmExecWithRetry");o(Xt,"buildInstallArgs");o(at,"execInteractive");o(lt,"installNodeWithWinget");st={win32:{os:"Windows",download:"https://github.com/coreybutler/nvm-windows/releases",steps:["Download nvm-setup.exe","Run the installer","Restart your terminal"]},darwin:{os:"macOS",repo:"https://github.com/nvm-sh/nvm",install:"curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash",postInstall:["Restart terminal","If using zsh: source ~/.zshrc","If using bash: source ~/.bash_profile"],steps:["Run the install command","Reload your shell configuration","Verify: nvm --version","Install Node: nvm install node"]},linux:{os:"Linux",repo:"https://github.com/nvm-sh/nvm",install:"curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash",alternative:"wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash",steps:["Run install command","Restart terminal or run: source ~/.bashrc","Verify: nvm --version","Install Node: nvm install node"]}};o(Qt,"getNvmInstallInstructions");o(ct,"displayNvmInstallGuide");o(fe,"installPackages");o(ut,"runNpmInstall");o(Zt,"buildNgNewArgs");o(pt,"createAngularProject")});import{search as en,select as $,input as me,confirm as ge}from"@inquirer/prompts";import p from"chalk";async function he(t,e){let{versions:n,latest:r=null,lts:s=null}=e;if(n.length===0)return console.log(p.yellow(`No stable versions found for ${t}.`)),null;let i=Be(n),c=await $({message:`Select ${t} major version:`,choices:i.map(d=>({name:r?.startsWith(`${d}.`)?`${t} ${d} (latest)`:`${t} ${d}`,value:d})),pageSize:15}),l=Ke(n,c),u=await $({message:`Select ${t} ${c} minor version:`,choices:l.map(d=>({name:`v${d}.x`,value:d})),pageSize:15}),m=Ye(n,u);return $({message:`Select ${t} ${u} patch version:`,choices:m.map(d=>{let j=`v${d}`;return d===r&&(j+=" (latest)"),d===s&&(j+=" (LTS)"),{name:j,value:d}}),pageSize:15})}function tn(t){let e=t.verified?" \u2713":"",n=t.description.length>50?`${t.description.substring(0,50)}\u2026`:t.description;return`${t.name}${e} - ${n} (v${t.version})`}async function nn(t,e,n){console.log(p.cyan(`
8
+ \u{1F50D} Checking compatibility with Angular ${n}\u2026
9
+ `));let r=await q(t,e,n);if(r.compatible)return console.log(p.green(`\u2713 ${t}@${e} is compatible with Angular ${n}`)),r.peerDependency&&console.log(p.gray(` Peer dependency: ${r.peerDependency}
10
+ `)),{version:e,skip:!1};if(console.log(p.red(`\u2717 ${t}@${e} may not be compatible with Angular ${n}`)),console.log(p.gray(` ${r.reason}
11
+ `)),!await ge({message:"Would you like to see compatible versions?",default:!0}))return{version:e,skip:!1};console.log(p.cyan(`
12
+ \u{1F50D} Searching for compatible versions\u2026
13
+ `));let s=await rt(t,n,10);return s.length>0?{version:await $({message:"Select a compatible version:",choices:[...s.map(l=>({name:`${l.version}${l.peerDependency?` (peer: ${l.peerDependency})`:""}`,value:l.version})),{name:"Keep selected version anyway",value:e}],pageSize:12}),skip:!1}:(console.log(p.yellow("No compatible versions found automatically.")),await ge({message:"Continue with the selected version anyway?",default:!1})?{version:e,skip:!1}:{version:e,skip:!0})}async function ye(t){let e=await $({message:"What would you like to do next?",choices:[{name:"Add another library",value:"add"},{name:"Remove a library",value:"remove",disabled:t.count===0},{name:"Finish library selection",value:"finish"}],default:"add"});if(e!=="remove")return e;let n=await $({message:"Select library to remove:",choices:t.getAll().map(r=>({name:`${r.name}@${r.version}`,value:r.name}))});return t.remove(n),console.log(p.yellow(`
14
+ \u2713 Removed ${n}
15
+ `)),"add"}async function ft(t=null){let e=new B;console.log(p.bold.cyan(`
21
16
  \u{1F4E6} Interactive Library Search
22
- `)),e&&console.log(y.gray(`Angular version: ${e} (compatibility will be checked)
23
- `)),console.log(y.gray(`Type to search npm packages. Press Enter to select.
24
- `));t;)try{let r=await Et({message:"Search for a library:",source:s(async(o,{signal:l})=>!o||o.length<2?[]:(await pe(o,15)).map(c=>({name:Vt(c),value:c.name,description:c.description})),"source"),pageSize:10});if(r){let o=await Ne(r);if(o){console.log(y.green(`
25
- \u2713 Selected: ${o.name}`)),console.log(y.gray(` Description: ${o.description}`)),console.log(y.gray(` Latest version: ${o.latestVersion}`)),console.log(y.gray(` Weekly downloads: ${de(o.weeklyDownloads)}`));let l=await _({message:"How would you like to select the version?",choices:[{name:`Use latest (${o.latestVersion})`,value:"latest"},{name:"Choose specific version (major.minor.patch)",value:"specific"},{name:"Enter version manually",value:"manual"}],default:"latest"}),i=o.latestVersion;if(l==="specific"){console.log(y.cyan(`
26
- \u{1F4E6} Fetching versions for ${o.name}...
27
- `));let c=await Ee(o.name);if(c.versions.length===0)console.log(y.yellow("Could not fetch versions. Using latest version.")),i=o.latestVersion;else{let p=Q(c.versions).map(b=>{let V=`${o.name} ${b}`;return{name:c.latest&&c.latest.startsWith(`${b}.`)?`${V} (latest)`:V,value:b}}),k=await _({message:`Select ${o.name} major version:`,choices:p,pageSize:15}),g=Z(c.versions,k).map(b=>({name:`v${b}.x`,value:b})),w=await _({message:`Select ${o.name} ${k} minor version:`,choices:g,pageSize:15}),C=ee(c.versions,w).map(b=>{let V=`v${b}`;return b===c.latest&&(V+=" (latest)"),b===c.lts&&(V+=" (LTS)"),{name:V,value:b}});i=await _({message:`Select ${o.name} ${w} patch version:`,choices:C,pageSize:15})}}else l==="manual"&&(i=await ge({message:"Enter version:",default:o.latestVersion,validate:s(c=>c?!0:"Version is required","validate")}));if(e&&i!=="latest"){console.log(y.cyan(`
28
- \u{1F50D} Checking compatibility with Angular ${e}...
29
- `));let c=await T(o.name,i,e);if(c.compatible)console.log(y.green(`\u2713 ${o.name}@${i} is compatible with Angular ${e}`)),c.peerDependency&&console.log(y.gray(` Peer dependency: ${c.peerDependency}
30
- `));else if(console.log(y.red(`\u2717 ${o.name}@${i} may not be compatible with Angular ${e}`)),console.log(y.gray(` ${c.reason}
31
- `)),await W({message:"Would you like to see compatible versions?",default:!0})){console.log(y.cyan(`
32
- \u{1F50D} Dynamically searching for compatible versions...
33
- `));let p=await Ge(o.name,e,10);if(p.length>0){let k=p.map(u=>({name:`${u.version}${u.peerDependency?` (peer: ${u.peerDependency})`:""}`,value:u.version}));k.push({name:"Keep selected version anyway",value:i}),i=await _({message:"Select a compatible version:",choices:k,pageSize:12})}else if(console.log(y.yellow("No compatible versions found automatically.")),!await W({message:"Continue with the selected version anyway?",default:!1})){console.log(y.yellow(`Skipping this library.
34
- `)),t=await W({message:"Add another library?",default:!0});continue}}}n.push({name:o.name,version:i,description:o.description}),console.log(y.green(`\u2713 Added ${o.name}@${i} to installation queue
35
- `))}}t=await W({message:"Add another library?",default:!1})}catch(r){console.error(y.red("Error during library search:",r.message)),t=!1}return n}s(Be,"interactiveLibrarySearch");function Vt(e){let n=de(e.weeklyDownloads||0),t=e.verified?" \u2713":"",r=e.description.substring(0,50)+(e.description.length>50?"...":"");return`${e.name}${t} - ${r} (v${e.version}, \u2B07 ${n}/week)`}s(Vt,"formatPackageChoice");async function He(e=null){let n=[],t=!0;for(console.log(y.bold.cyan(`
17
+ `)),t&&console.log(p.gray(`Angular version: ${t} (compatibility will be checked)
18
+ `)),console.log(p.gray(`Type to search npm packages. Press Enter to select.
19
+ `));let n="add";for(;n==="add";)try{e.count>0&&e.display();let r=await en({message:"Search for a library:",source:o(async(u,{signal:m})=>{if(!u||u.length<2)return[];let d=await Je(u,15,{signal:m});if(m.aborted)return[];let j=d.filter(L=>!e.has(L.name));return j.length===0&&d.length>0?[{name:p.yellow("All matching libraries have already been selected"),value:null,disabled:!0}]:j.map(L=>({name:tn(L),value:L.name,description:L.description}))},"source"),pageSize:10});if(!r){if(!await ge({message:"Continue searching?",default:!1}))break;continue}let[s,i]=await Promise.all([Ge(r),le(r)]);if(!s){console.log(p.yellow(`Could not fetch info for ${r}. Skipping.
20
+ `));continue}y(`
21
+ Selected Package`,[["Name",p.green(s.name)],["Description",p.gray(s.description)],["Latest version",p.cyan(s.latestVersion)],["Weekly downloads",p.gray(He(s.weeklyDownloads))]]);let c=await $({message:"How would you like to select the version?",choices:[{name:`Use latest (${s.latestVersion})`,value:"latest"},{name:"Choose specific version (major.minor.patch)",value:"specific"},{name:"Enter version manually",value:"manual"}],default:"latest"}),l=s.latestVersion;if(c==="specific")if(i.versions.length===0)console.log(p.yellow("Could not fetch versions. Using latest."));else{let u=await he(s.name,i);u&&(l=u)}else c==="manual"&&(l=await me({message:"Enter version:",default:s.latestVersion,validate:o(u=>u?!0:"Version is required","validate")}));if(t&&l!=="latest"){let u=await nn(s.name,l,t);if(u.skip){console.log(p.yellow(`Skipping this library.
22
+ `)),n=await ye(e);continue}l=u.version}e.add({name:s.name,version:l,description:s.description}),console.log(p.green(`\u2713 Added ${s.name}@${l} to installation queue
23
+ `)),n=await ye(e)}catch(r){if(r.name==="ExitPromptError")break;console.error(p.red("Error during library search:"),r.message),n="finish"}return e.getAll()}async function mt(t=null){let e=new B;console.log(p.bold.cyan(`
36
24
  \u{1F4E6} Add Libraries
37
- `)),e&&console.log(y.gray(`Angular version: ${e} (compatibility will be checked)
38
- `));t;){let r=await ge({message:"Enter library name (or press Enter to skip):",validate:s(async l=>l?l.match(/^[@a-z0-9-~][a-z0-9-._~]*$/)?!0:"Invalid package name format":!0,"validate")});if(!r)break;let o=await ge({message:`Enter version for ${r} (or 'latest'):`,default:"latest"});if(e&&o!=="latest"){console.log(y.cyan(`
39
- \u{1F50D} Checking compatibility with Angular ${e}...
40
- `));let l=await T(r,o,e);l.compatible?(console.log(y.green(`\u2713 ${r}@${o} is compatible with Angular ${e}`)),l.peerDependency&&console.log(y.gray(` Peer dependency: ${l.peerDependency}
41
- `))):(console.log(y.red(`\u2717 ${r}@${o} may not be compatible with Angular ${e}`)),console.log(y.gray(` ${l.reason}
42
- `)),console.log(y.yellow(`\u26A0\uFE0F This may cause installation issues. Consider using a different version.
43
- `)))}n.push({name:r,version:o}),console.log(y.green(`\u2713 Added ${r}@${o}
44
- `)),t=await W({message:"Add another library?",default:!1})}return n}s(He,"simpleLibraryInput");async function qe(){return await _({message:"How would you like to add libraries?",choices:[{name:"Interactive search with autocomplete (Recommended)",value:"interactive"},{name:"Manual entry",value:"manual"},{name:"Choose from popular bundles",value:"bundles"},{name:"Skip for now",value:"skip"}],default:"interactive"})}s(qe,"askLibrarySearchPreference");var D={basic:{name:"Basic SPA",description:"Minimal setup with routing",options:{routing:!0,style:"css",strict:!1,standalone:!1},packages:[]},enterprise:{name:"Enterprise",description:"NgRx, Angular Material, strict mode, ESLint",options:{routing:!0,style:"scss",strict:!0,standalone:!1},packages:["@angular/material","@angular/cdk","@ngrx/store","@ngrx/effects","@ngrx/entity","@ngrx/store-devtools","eslint"],devPackages:["@typescript-eslint/eslint-plugin","@typescript-eslint/parser"]},pwa:{name:"PWA Ready",description:"Service workers, manifest, offline support",options:{routing:!0,style:"scss",strict:!0,standalone:!1},packages:["@angular/pwa","@angular/service-worker"]},material:{name:"Material Design",description:"Angular Material UI components",options:{routing:!0,style:"scss",strict:!1,standalone:!1},packages:["@angular/material","@angular/cdk"]},testing:{name:"Testing Ready",description:"Jest, Testing Library, Spectator",options:{routing:!0,style:"scss",strict:!0,standalone:!1},packages:["@testing-library/angular","@ngneat/spectator"],devPackages:["jest","@types/jest","jest-preset-angular"]},standalone:{name:"Standalone Components",description:"Modern Angular with standalone components",options:{routing:!0,style:"scss",strict:!0,standalone:!0},packages:[]}},me={uiFramework:{name:"UI Framework Bundle",description:"Angular Material + CDK",packages:[{name:"@angular/material",version:"latest"},{name:"@angular/cdk",version:"latest"}]},stateManagement:{name:"State Management Bundle",description:"NgRx + Entity + Effects + DevTools",packages:[{name:"@ngrx/store",version:"latest"},{name:"@ngrx/effects",version:"latest"},{name:"@ngrx/entity",version:"latest"},{name:"@ngrx/store-devtools",version:"latest"}]},forms:{name:"Form & Validation Bundle",description:"Reactive Forms utilities and validators",packages:[{name:"ngx-mask",version:"latest"},{name:"@angular/forms",version:"latest"}]},testing:{name:"Testing Bundle",description:"Jest + Testing Library + Spectator",packages:[],devPackages:[{name:"jest",version:"latest"},{name:"@types/jest",version:"latest"},{name:"jest-preset-angular",version:"latest"},{name:"@testing-library/angular",version:"latest"},{name:"@ngneat/spectator",version:"latest"}]},performance:{name:"Performance Bundle",description:"Angular Universal + optimization tools",packages:[{name:"@nguniversal/express-engine",version:"latest"}]},authentication:{name:"Authentication Bundle",description:"Auth utilities and Firebase",packages:[{name:"@angular/fire",version:"latest"},{name:"firebase",version:"latest"}]},utilities:{name:"Utilities Bundle",description:"Common utility libraries",packages:[{name:"lodash",version:"latest"},{name:"date-fns",version:"latest"},{name:"rxjs",version:"latest"}]},http:{name:"HTTP & API Bundle",description:"HTTP client and API tools",packages:[{name:"@angular/common",version:"latest"},{name:"axios",version:"latest"}]}},z={typescript:{name:"TypeScript Strict Mode",files:{"tsconfig.json":s(e=>({...e,compilerOptions:{...e.compilerOptions,strict:!0,noImplicitAny:!0,noImplicitReturns:!0,noFallthroughCasesInSwitch:!0,strictNullChecks:!0}}),"tsconfig.json")}},eslint:{name:"ESLint + Prettier",packages:["eslint","prettier","eslint-config-prettier","eslint-plugin-prettier"],files:{".eslintrc.json":{extends:["eslint:recommended","plugin:@typescript-eslint/recommended","prettier"],parser:"@typescript-eslint/parser",plugins:["@typescript-eslint","prettier"],rules:{"prettier/prettier":"error"}},".prettierrc":{semi:!0,singleQuote:!0,trailingComma:"es5",printWidth:100,tabWidth:2}}},husky:{name:"Husky Pre-commit Hooks",devPackages:["husky","lint-staged"],scripts:{prepare:"husky install","pre-commit":"lint-staged"},files:{".husky/pre-commit":`#!/bin/sh
45
- . "$(dirname "$0")/_/husky.sh"
46
-
47
- npx lint-staged`,"lint-staged.config.js":`module.exports = {
48
- '*.{js,ts}': ['eslint --fix', 'prettier --write'],
49
- '*.{json,md}': ['prettier --write']
50
- };`}}},fe={standard:{name:"Standard Structure",folders:["src/app/core","src/app/core/services","src/app/core/guards","src/app/core/interceptors","src/app/shared","src/app/shared/components","src/app/shared/directives","src/app/shared/pipes","src/app/features","src/app/models","src/assets/images","src/assets/styles","src/environments"],files:{"src/app/core/README.md":`# Core Module
51
-
52
- Singleton services, guards, and interceptors go here.`,"src/app/shared/README.md":`# Shared Module
53
-
54
- Reusable components, directives, and pipes go here.`,"src/app/features/README.md":`# Features
55
-
56
- Feature modules go here.`,"src/app/models/README.md":`# Models
57
-
58
- TypeScript interfaces and types go here.`}},domain:{name:"Domain-Driven Structure",folders:["src/app/core","src/app/shared","src/app/domains","src/app/infrastructure"]}},ye={gitignore:`# See http://help.github.com/ignore-files/ for more about ignoring files.
59
-
60
- # Compiled output
61
- /dist
62
- /tmp
63
- /out-tsc
64
- /bazel-out
65
-
66
- # Node
67
- /node_modules
68
- npm-debug.log
69
- yarn-error.log
70
-
71
- # IDEs and editors
72
- .idea/
73
- .project
74
- .classpath
75
- .c9/
76
- *.launch
77
- .settings/
78
- *.sublime-workspace
79
-
80
- # Visual Studio Code
81
- .vscode/*
82
- !.vscode/settings.json
83
- !.vscode/tasks.json
84
- !.vscode/launch.json
85
- !.vscode/extensions.json
86
- .history/*
87
-
88
- # Miscellaneous
89
- /.angular/cache
90
- .sass-cache/
91
- /connect.lock
92
- /coverage
93
- /libpeerconnection.log
94
- testem.log
95
- /typings
96
-
97
- # System files
98
- .DS_Store
99
- Thumbs.db
100
-
101
- # Environment
102
- .env
103
- .env.local
104
- `,initialCommitMessage:"Initial commit: Angular project setup"},he={readme:s((e,n)=>`# ${e}
105
-
106
- ${n||"An Angular application"}
107
-
108
- ## Description
109
-
110
- This project was generated with Angular CLI.
111
-
112
- ## Development server
113
-
114
- Run \`ng serve\` for a dev server. Navigate to \`http://localhost:4200/\`. The application will automatically reload if you change any of the source files.
115
-
116
- ## Code scaffolding
117
-
118
- Run \`ng generate component component-name\` to generate a new component. You can also use \`ng generate directive|pipe|service|class|guard|interface|enum|module\`.
119
-
120
- ## Build
121
-
122
- Run \`ng build\` to build the project. The build artifacts will be stored in the \`dist/\` directory.
123
-
124
- ## Running unit tests
125
-
126
- Run \`ng test\` to execute the unit tests via your test runner.
127
-
128
- ## Running end-to-end tests
129
-
130
- Run \`ng e2e\` to execute the end-to-end tests via a platform of your choice.
131
-
132
- ## Further help
133
-
134
- To get more help on the Angular CLI use \`ng help\` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
135
-
136
- ## Project Structure
137
-
138
- \`\`\`
139
- src/
140
- \u251C\u2500\u2500 app/
141
- \u2502 \u251C\u2500\u2500 core/ # Singleton services, guards
142
- \u2502 \u251C\u2500\u2500 shared/ # Common components, pipes, directives
143
- \u2502 \u251C\u2500\u2500 features/ # Feature modules
144
- \u2502 \u251C\u2500\u2500 models/ # TypeScript interfaces/types
145
- \u2502 \u2514\u2500\u2500 services/ # Business logic services
146
- \`\`\`
147
-
148
- ## Contributing
149
-
150
- 1. Fork the repository
151
- 2. Create your feature branch (\`git checkout -b feature/amazing-feature\`)
152
- 3. Commit your changes (\`git commit -m 'Add some amazing feature'\`)
153
- 4. Push to the branch (\`git push origin feature/amazing-feature\`)
154
- 5. Open a Pull Request
155
-
156
- ## License
157
-
158
- This project is licensed under the MIT License.
159
- `,"readme"),changelog:`# Changelog
160
-
161
- All notable changes to this project will be documented in this file.
162
-
163
- ## [Unreleased]
164
-
165
- ### Added
166
- - Initial project setup
167
-
168
- ### Changed
169
-
170
- ### Fixed
171
-
172
- ### Removed
173
- `};import I from"fs/promises";import L from"path";import x from"chalk";import{execa as we}from"execa";import ve from"ora";async function Ye(e){let n=ve("Initializing Git repository...").start();try{return await we("git",["init"],{cwd:e}),n.succeed("Git repository initialized"),!0}catch(t){return n.fail("Failed to initialize Git repository"),console.error(x.red(t.message)),!1}}s(Ye,"initGitRepo");async function Ke(e,n){try{let t=L.join(e,".gitignore");return await I.writeFile(t,n,"utf-8"),console.log(x.green("\u2713 Created .gitignore")),!0}catch(t){return console.error(x.red("Failed to create .gitignore:"),t.message),!1}}s(Ke,"createGitignore");async function Xe(e,n){let t=ve("Creating initial commit...").start();try{return await we("git",["add","."],{cwd:e}),await we("git",["commit","-m",n],{cwd:e}),t.succeed("Initial commit created"),!0}catch(r){return t.fail("Failed to create initial commit"),console.error(x.red(r.message)),!1}}s(Xe,"createInitialCommit");async function Qe(e,n){let t=ve("Creating project structure...").start();try{for(let r of n){let o=L.join(e,r);await I.mkdir(o,{recursive:!0})}return t.succeed("Project structure created"),!0}catch(r){return t.fail("Failed to create project structure"),console.error(x.red(r.message)),!1}}s(Qe,"createProjectFolders");async function be(e,n){try{for(let[t,r]of Object.entries(n)){let o=L.join(e,t),l=L.dirname(o);await I.mkdir(l,{recursive:!0});let i=typeof r=="string"?r:JSON.stringify(r,null,2);await I.writeFile(o,i,"utf-8")}return console.log(x.green(`\u2713 Created ${Object.keys(n).length} file(s)`)),!0}catch(t){return console.error(x.red("Failed to create project files:"),t.message),!1}}s(be,"createProjectFiles");async function Ze(e,n){try{let t=L.join(e,"README.md");return await I.writeFile(t,n,"utf-8"),console.log(x.green("\u2713 Created README.md")),!0}catch(t){return console.error(x.red("Failed to create README.md:"),t.message),!1}}s(Ze,"createReadme");async function et(e,n){try{let t=L.join(e,"CHANGELOG.md");return await I.writeFile(t,n,"utf-8"),console.log(x.green("\u2713 Created CHANGELOG.md")),!0}catch(t){return console.error(x.red("Failed to create CHANGELOG.md:"),t.message),!1}}s(et,"createChangelog");function tt(e){return/[<>:"|?*\x00-\x1f]/.test(e)?"Directory name contains invalid characters":["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"].includes(e.toUpperCase())?"Directory name is reserved":e.length===0?"Directory name cannot be empty":e.length>255?"Directory name is too long":e.endsWith(" ")||e.endsWith(".")?"Directory name cannot end with a space or period":!0}s(tt,"validateDirectoryName");async function nt(e,n){try{let t=L.join(e,"package.json"),r=JSON.parse(await I.readFile(t,"utf-8"));return r.scripts={...r.scripts,...n},await I.writeFile(t,JSON.stringify(r,null,2),"utf-8"),console.log(x.green("\u2713 Updated package.json scripts")),!0}catch(t){return console.error(x.red("Failed to update package.json:"),t.message),!1}}s(nt,"updatePackageJsonScripts");import B from"fs/promises";import rt from"path";import{homedir as Dt}from"os";import h from"chalk";var ot=rt.join(Dt(),".ng-init"),st=rt.join(ot,"profiles.json");async function at(){try{return await B.mkdir(ot,{recursive:!0}),!0}catch(e){return console.error(h.red("Failed to create profiles directory:"),e.message),!1}}s(at,"ensureProfilesDirectory");async function ne(){try{await at();let e=await B.readFile(st,"utf-8");return JSON.parse(e)}catch{return{}}}s(ne,"loadProfiles");async function it(e){try{return await at(),await B.writeFile(st,JSON.stringify(e,null,2),"utf-8"),!0}catch(n){return console.error(h.red("Failed to save profiles:"),n.message),!1}}s(it,"saveProfiles");async function $e(e,n){let t=await ne();t[e]={...n,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};let r=await it(t);return r&&console.log(h.green(`\u2713 Profile "${e}" saved successfully`)),r}s($e,"saveProfile");async function H(e){return(await ne())[e]||null}s(H,"loadProfile");async function lt(e){let n=await ne();if(!n[e])return console.log(h.yellow(`Profile "${e}" not found`)),!1;delete n[e];let t=await it(n);return t&&console.log(h.green(`\u2713 Profile "${e}" deleted successfully`)),t}s(lt,"deleteProfile");async function re(){let e=await ne();return Object.keys(e)}s(re,"listProfiles");async function ct(e,n){let t=await H(e);if(!t)return console.log(h.red(`Profile "${e}" not found`)),!1;try{let r={name:e,profile:t,exportedAt:new Date().toISOString(),version:"1.0.0"};return await B.writeFile(n,JSON.stringify(r,null,2),"utf-8"),console.log(h.green(`\u2713 Profile exported to ${n}`)),!0}catch(r){return console.error(h.red("Failed to export profile:"),r.message),!1}}s(ct,"exportProfile");async function ut(e){try{let n=await B.readFile(e,"utf-8"),t=JSON.parse(n);if(!t.name||!t.profile)return console.log(h.red("Invalid profile file format")),!1;let r=await $e(t.name,t.profile);return r&&console.log(h.green(`\u2713 Profile "${t.name}" imported successfully`)),r}catch(n){return console.error(h.red("Failed to import profile:"),n.message),!1}}s(ut,"importProfile");function oe(e,n){console.log(h.bold.cyan(`
174
- \u{1F4CB} Profile: ${e}
175
- `)),console.log(h.gray("\u2501".repeat(50))),n.angularVersion&&console.log(h.white("Angular Version: ")+h.green(n.angularVersion)),n.template&&console.log(h.white("Template: ")+h.cyan(n.template)),n.libraries&&n.libraries.length>0&&(console.log(h.white("Libraries: ")+h.cyan(n.libraries.length)),n.libraries.slice(0,5).forEach(t=>{console.log(h.gray(` \u2022 ${t.name}@${t.version}`))}),n.libraries.length>5&&console.log(h.gray(` ... and ${n.libraries.length-5} more`))),n.options&&(console.log(h.white("Options:")),Object.entries(n.options).forEach(([t,r])=>{console.log(h.gray(` \u2022 ${t}: ${r}`))})),n.createdAt&&console.log(h.white("Created: ")+h.gray(new Date(n.createdAt).toLocaleString())),console.log(h.gray("\u2501".repeat(50))+`
176
- `)}s(oe,"displayProfileInfo");import{readFileSync as Rt}from"fs";import{fileURLToPath as Mt}from"url";import{dirname as Ft,join as Tt}from"path";var Ot=Mt(import.meta.url),_t=Ft(Ot),Gt=JSON.parse(Rt(Tt(_t,"../package.json"),"utf-8"));async function dt(){try{console.log(a.bold.cyan(`
177
- \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557`)),console.log(a.bold.cyan(`\u2551 Angular Project Automation CLI v${Gt.version.padEnd(13)}\u2551`)),console.log(a.bold.cyan(`\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
178
- `));let e=await ie(),n=await E({message:"Would you like to use a saved profile?",default:!1}),t={};if(n){let u=await re();if(u.length===0)console.log(a.yellow(`No saved profiles found. Continuing with manual setup...
179
- `));else{let g=await A({message:"Select a profile:",choices:u.map(C=>({name:C,value:C}))}),w=await H(g);oe(g,w),await E({message:"Use this profile?",default:!0})&&(t=w)}}if(!t.angularVersion){console.log(a.bold.cyan(`
180
- \u{1F4E6} Fetching Angular versions...
181
- `));let u=await Ie();u.versions.length===0&&(console.log(a.red("Failed to fetch Angular versions. Please check your internet connection.")),process.exit(1));let w=Q(u.versions).map(S=>{let R=`Angular ${S}`;return{name:u.latest&&u.latest.startsWith(`${S}.`)?`${R} (latest)`:R,value:S}}),v=await A({message:"Select Angular major version:",choices:w,pageSize:15}),f=Z(u.versions,v).map(S=>({name:`v${S}.x`,value:S})),b=await A({message:`Select Angular ${v} minor version:`,choices:f,pageSize:15}),Pe=ee(u.versions,b).map(S=>{let R=`v${S}`;return S===u.latest&&(R+=" (latest)"),S===u.lts&&(R+=" (LTS)"),{name:R,value:S}}),gt=await A({message:`Select Angular ${b} patch version:`,choices:Pe,pageSize:15});t.angularVersion=gt}console.log(a.green(`
182
- \u2713 Selected Angular version: ${t.angularVersion}
183
- `));let r=await Ve(t.angularVersion),o=await Y(),l=Re(o,r);if(Me(l),!l.compatible)if(console.log(a.yellow(`\u26A0\uFE0F Node.js version incompatibility detected!
184
- `)),await ae()){console.log(a.cyan(`\u2713 nvm detected on your system
185
- `));let g=await le(),w=Fe(g,r);if(w.length>0){console.log(a.green(`Found ${w.length} compatible Node version(s) installed:
186
- `));let v=await A({message:"Select Node version to switch to:",choices:w.map(f=>({name:`v${f}`,value:f}))});console.log(a.cyan(`
187
- Switching to Node.js v${v}...
188
- `)),await K(v)||(console.log(a.red("Failed to switch Node version. Please try manually.")),process.exit(1)),console.log(a.green(`\u2713 Node version switched successfully
189
- `))}else{console.log(a.yellow(`No compatible Node versions installed.
190
- `));let v=Te(r);await E({message:`Install Node.js v${v}?`,default:!0})?(await ce(v)||(console.log(a.red("Failed to install Node version.")),process.exit(1)),console.log(a.green(`\u2713 Node.js installed successfully
191
- `)),await K(v)):(console.log(a.red("Cannot proceed without compatible Node.js version.")),process.exit(1))}}else{console.log(a.yellow(`\u26A0\uFE0F nvm is not installed on your system
192
- `));let g=await A({message:"How would you like to proceed?",choices:[{name:"Install nvm (Recommended)",value:"nvm"},{name:"Install Node.js directly (Windows only)",value:"direct"},{name:"Exit and install manually",value:"exit"}]});g==="nvm"?(Je(),console.log(a.yellow(`
25
+ `)),t&&console.log(p.gray(`Angular version: ${t} (compatibility will be checked)
26
+ `));let n="add";for(;n==="add";){e.count>0&&e.display();let r=await me({message:"Enter library name (or press Enter to skip):",validate:o(i=>i?/^[@a-z0-9-~][a-z0-9-._~]*$/.test(i)?e.has(i)?`${i} has already been selected`:!0:"Invalid package name format":!0,"validate")});if(!r)break;let s=await me({message:`Enter version for ${r} (or 'latest'):`,default:"latest"});if(t&&s!=="latest"){let i=await q(r,s,t);i.compatible?(console.log(p.green(`\u2713 ${r}@${s} is compatible with Angular ${t}`)),i.peerDependency&&console.log(p.gray(` Peer dependency: ${i.peerDependency}
27
+ `))):(console.log(p.red(`\u2717 ${r}@${s} may not be compatible with Angular ${t}`)),console.log(p.gray(` ${i.reason}
28
+ `)),console.log(p.yellow(`\u26A0\uFE0F This may cause installation issues.
29
+ `)))}e.add({name:r,version:s}),console.log(p.green(`\u2713 Added ${r}@${s}
30
+ `)),n=await ye(e)}return e.getAll()}function gt(){return $({message:"How would you like to add libraries?",choices:[{name:"Interactive search with autocomplete (Recommended)",value:"interactive"},{name:"Manual entry",value:"manual"},{name:"Skip for now",value:"skip"}],default:"interactive"})}var B,yt=h(()=>{H();pe();b();o(he,"selectVersionInteractively");B=class{static{o(this,"LibraryTracker")}#e=new Map;add(e){this.#e.set(e.name,e)}remove(e){this.#e.delete(e)}has(e){return this.#e.has(e)}getAll(){return[...this.#e.values()]}get count(){return this.#e.size}display(){if(this.#e.size===0){console.log(p.gray(` No libraries selected yet.
31
+ `));return}g("\u{1F4E6} Currently Selected Libraries",this.getAll().map(e=>({Library:e.name,Version:e.version,Description:(e.description??"").substring(0,70)})),["Library","Version","Description"])}};o(tn,"formatPackageChoice");o(nn,"resolveCompatibleVersion");o(ye,"askNextAction");o(ft,"interactiveLibrarySearch");o(mt,"simpleLibraryInput");o(gt,"askLibrarySearchPreference")});import gr from"chalk";import{execa as hr}from"execa";import vr from"ora";function ht(t){return!t||t.length===0?"Directory name cannot be empty":t.length>255?"Directory name is too long":rn.test(t)?"Directory name contains invalid characters":on.has(t.toUpperCase())?"Directory name is reserved":t.endsWith(" ")||t.endsWith(".")?"Directory name cannot end with a space or period":!0}var rn,on,wt=h(()=>{rn=/[<>:"|?*\x00-\x1f]/,on=new Set(["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"]);o(ht,"validateDirectoryName")});var E={};_(E,{clearCache:()=>fn,deleteProfile:()=>cn,displayProfileInfo:()=>xe,exportProfile:()=>pn,getProfileDetails:()=>un,importProfile:()=>dn,listProfiles:()=>be,loadProfile:()=>M,loadProfiles:()=>ln,saveProfile:()=>$e});import R from"fs/promises";import vt from"path";import{homedir as sn}from"os";import f from"chalk";function xt(){return we??=R.mkdir(bt,{recursive:!0}).catch(t=>{throw console.error(f.red("Failed to create profiles directory:"),t.message),t}),we}async function V(){if(A!==null)return A;await xt();try{let t=await R.readFile($t,"utf-8");A=JSON.parse(t)}catch{A={}}return A}async function ve(t){await xt();try{return await R.writeFile($t,JSON.stringify(t,null,2),"utf-8"),A=t,!0}catch(e){return console.error(f.red("Failed to save profiles:"),e.message),!1}}function ln(){return V()}async function M(t){return(await V())[t]??null}async function be(){let t=await V();return Object.keys(t)}async function $e(t,e){let n=await V(),r=new Date().toISOString();n[t]={...e,createdAt:n[t]?.createdAt??r,updatedAt:r};let s=await ve(n);return s&&console.log(f.green(`\u2713 Profile "${t}" saved successfully`)),s}async function cn(t){let e=await V();if(!e[t])return console.log(f.yellow(`Profile "${t}" not found`)),!1;delete e[t];let n=await ve(e);return n&&console.log(f.green(`\u2713 Profile "${t}" deleted successfully`)),n}async function un(t){let e=await M(t);return e?{name:t,angularVersion:e.angularVersion,libraries:e.libraries?.length??0,createdAt:e.createdAt,updatedAt:e.updatedAt}:null}function xe(t,e){let n=[];e.angularVersion&&n.push(["Angular Version",f.green(e.angularVersion)]),e.template&&n.push(["Template",f.gray(`${e.template} (deprecated)`)]),n.push(["Libraries",f.cyan(String(e.libraries?.length??0))]),e.createdAt&&n.push(["Created",f.gray(new Date(e.createdAt).toLocaleString())]),e.updatedAt&&n.push(["Updated",f.gray(new Date(e.updatedAt).toLocaleString())]),y(`\u{1F4CB} Profile: ${t}`,n);let r=e.libraries;if(r?.length>0){let s=r.slice(0,K).map(i=>({Library:i.name,Version:i.version,Description:i.description??""}));g(`Libraries (showing up to ${K})`,s,["Library","Version","Description"]),r.length>K&&console.log(f.gray(` \u2026 and ${r.length-K} more`))}e.options&&g("Options",Object.entries(e.options).map(([s,i])=>({Option:s,Value:String(i)})),["Option","Value"])}async function pn(t,e){let n=await M(t);if(!n)return console.log(f.red(`Profile "${t}" not found`)),!1;try{let r={name:t,profile:n,exportedAt:new Date().toISOString(),version:an};return await R.writeFile(e,JSON.stringify(r,null,2),"utf-8"),console.log(f.green(`\u2713 Profile exported to ${e}`)),!0}catch(r){return console.error(f.red("Failed to export profile:"),r.message),!1}}async function dn(t){let e;try{let i=await R.readFile(t,"utf-8");e=JSON.parse(i)}catch(i){return console.error(f.red("Failed to read profile file:"),i.message),!1}if(!e.name||!e.profile)return console.log(f.red("Invalid profile file format")),!1;let n=await V(),r=new Date().toISOString();n[e.name]={...e.profile,createdAt:e.profile.createdAt??r,updatedAt:r};let s=await ve(n);return s&&console.log(f.green(`\u2713 Profile "${e.name}" imported successfully`)),s}function fn(){A=null,we=null}var bt,$t,an,K,we,A,P=h(()=>{b();bt=vt.join(sn(),".ng-init"),$t=vt.join(bt,"profiles.json"),an="1.0.0",K=50,we=null;o(xt,"ensureDir");A=null;o(V,"readProfiles");o(ve,"writeProfiles");o(ln,"loadProfiles");o(M,"loadProfile");o(be,"listProfiles");o($e,"saveProfile");o(cn,"deleteProfile");o(un,"getProfileDetails");o(xe,"displayProfileInfo");o(pn,"exportProfile");o(dn,"importProfile");o(fn,"clearCache")});var St={};_(St,{runCli:()=>wn});import{select as F,input as Se,confirm as x}from"@inquirer/prompts";import a from"chalk";import Ae from"path";import{readFileSync as mn}from"fs";import{fileURLToPath as gn}from"url";async function wn(){try{vn(),await te();let t=qe(),e={};if(await x({message:"Would you like to use a saved profile?",default:!1})&&(e=await bn()),!e.angularVersion){console.log(a.bold.cyan(`
32
+ \u{1F4E6} Fetching Angular versions\u2026
33
+ `));let u=await t;u.versions.length===0&&(console.log(a.red("Failed to fetch Angular versions. Check your internet connection.")),process.exit(1));let m=await he("Angular",u);m||(console.log(a.red("No version selected.")),process.exit(1)),e.angularVersion=m}console.log(a.green(`
34
+ \u2713 Selected Angular version: ${e.angularVersion}
35
+ `));let[n,r]=await Promise.all([Xe(e.angularVersion),z()]),s=Ze(r,n);if(et(s),s.compatible||await xn(n),e.projectName||(e.projectName=await Se({message:"Enter project name:",validate:o(u=>{if(!u)return"Project name is required";let m=ht(u);return m===!0?!0:m},"validate")})),!e.location){let u=await F({message:"Where would you like to create the project?",choices:[{name:"Current directory",value:"current"},{name:"Specify custom directory",value:"custom"}]});e.location=u==="custom"?await Se({message:"Enter directory path:",default:process.cwd()}):process.cwd()}let i=Ae.join(e.location,e.projectName);if(e.options||(e.options=await $n()),!e.libraries){let u=await gt();e.libraries=u==="interactive"?await ft(e.angularVersion):u==="manual"?await mt(e.angularVersion):[]}if(e.features=[],await x({message:"Save this configuration as a profile?",default:!1})){let u=await Se({message:"Enter profile name:",validate:o(m=>m?!0:"Profile name is required","validate")});await $e(u,e)}y("\u{1F4CB} Project Configuration Summary",[["Project Name",a.green(e.projectName)],["Location",a.cyan(i)],["Angular Version",a.green(e.angularVersion)],["Style",a.cyan(e.options.style)],["Routing",a.cyan(e.options.routing?"Yes":"No")],["Strict Mode",a.cyan(e.options.strict?"Yes":"No")],["Standalone",a.cyan(e.options.standalone?"Yes":"No")],["Libraries",a.cyan(String(e.libraries.length))]]),await x({message:"Create project with this configuration?",default:!0})||(console.log(a.yellow(`Project creation cancelled.
36
+ `)),process.exit(0)),console.log(a.bold.cyan(`
37
+ \u{1F680} Creating Angular project\u2026
38
+ `));let[c,l]=await Promise.all([pt(e.projectName,e.angularVersion,{...e.options,skipInstall:!0}),e.libraries.length>0?ot(e.libraries,e.angularVersion):Promise.resolve([])]);c||(console.log(a.red("Failed to create Angular project.")),process.exit(1)),l.length>0&&await An(l,i),console.log(a.bold.cyan(`
39
+ \u{1F4E5} Installing dependencies\u2026
40
+ `)),await ut(i),Pn(e.projectName)}catch(t){t.name==="ExitPromptError"&&(console.log(a.yellow(`
41
+ Exited.
42
+ `)),process.exit(0)),console.error(a.red(`
43
+ \u274C Error:`),t.message),process.exit(1)}}function vn(){let t=`Angular Project Initialization Automation CLI v${hn.version}`,e=60,n=e-t.length,r="\u2550".repeat(e);console.log(a.cyan.bold(`
44
+ \u2554${r}\u2557
45
+ \u2551${" ".repeat(Math.floor(n/2))}${t}${" ".repeat(Math.ceil(n/2))}\u2551
46
+ \u255A${r}\u255D
47
+ `))}async function bn(){let t=await be();if(t.length===0)return console.log(a.yellow(`No saved profiles found. Continuing with manual setup\u2026
48
+ `)),{};let e=await F({message:"Select a profile:",choices:t.map(r=>({name:r,value:r}))}),n=await M(e);return xe(e,n),await x({message:"Use this profile?",default:!0})?n:{}}async function $n(){let t=await x({message:"Enable routing?",default:!0}),e=await F({message:"Select stylesheet format:",choices:["css","scss","sass","less"].map(s=>({name:s,value:s}))}),n=await x({message:"Enable strict mode?",default:!0}),r=await x({message:"Use standalone components?",default:!1});return{routing:t,style:e,strict:n,standalone:r}}async function xn(t){if(console.log(a.yellow(`\u26A0\uFE0F Node.js version incompatibility detected!
49
+ `)),await ee())return Sn(t);console.log(a.yellow(`\u26A0\uFE0F nvm is not installed on your system
50
+ `));let e=await F({message:"How would you like to proceed?",choices:[{name:"Install nvm (Recommended)",value:"nvm"},{name:"Install Node.js directly (Windows only)",value:"direct"},{name:"Exit and install manually",value:"exit"}]});e==="nvm"&&(ct(),console.log(a.yellow(`
193
51
  Please install nvm and run this CLI again.
194
- `)),process.exit(0)):g==="direct"?(process.platform!=="win32"&&(console.log(a.red("Direct installation is only supported on Windows.")),process.exit(1)),await Ue("LTS")||(console.log(a.red("Failed to install Node.js. Please install manually.")),process.exit(1)),console.log(a.yellow(`
52
+ `)),process.exit(0)),e==="direct"&&(process.platform!=="win32"&&(console.log(a.red("Direct installation is only supported on Windows.")),process.exit(1)),await lt("LTS")||(console.log(a.red("Failed to install Node.js. Please install manually.")),process.exit(1)),console.log(a.yellow(`
195
53
  Please restart your terminal and run this CLI again.
196
- `)),process.exit(0)):(console.log(a.yellow(`Exiting. Please install a compatible Node.js version manually.
197
- `)),process.exit(0))}t.projectName||(t.projectName=await ke({message:"Enter project name:",validate:s(u=>{if(!u)return"Project name is required";let g=tt(u);return g===!0?!0:g},"validate")})),t.location||(await A({message:"Where would you like to create the project?",choices:[{name:"Current directory",value:"current"},{name:"Specify custom directory",value:"custom"}]})==="custom"?t.location=await ke({message:"Enter directory path:",default:process.cwd()}):t.location=process.cwd());let i=Lt.join(t.location,t.projectName);if(!t.template)if(t.template=await A({message:"Select project template:",choices:[...Object.entries(D).map(([u,g])=>({name:`${g.name} - ${g.description}`,value:u})),{name:"Custom (configure manually)",value:"custom"}]}),t.template==="custom"){let u=await E({message:"Enable routing?",default:!0}),g=await A({message:"Select stylesheet format:",choices:[{name:"css",value:"css"},{name:"scss",value:"scss"},{name:"sass",value:"sass"},{name:"less",value:"less"}]}),w=await E({message:"Enable strict mode?",default:!0}),v=await E({message:"Use standalone components?",default:!1});t.options={routing:u,style:g,strict:w,standalone:v}}else t.options=D[t.template].options;if(!t.libraries){let u=await qe();if(t.libraries=[],u==="interactive")t.libraries=await Be(t.angularVersion);else if(u==="manual")t.libraries=await He(t.angularVersion);else if(u==="bundles"){let g=await pt({message:"Select library bundles:",choices:Object.entries(me).map(([w,v])=>({name:`${v.name} - ${v.description}`,value:w}))});for(let w of g){let v=me[w];v.packages&&t.libraries.push(...v.packages),v.devPackages&&t.libraries.push(...v.devPackages.map(C=>({...C,isDev:!0})))}}if(t.template!=="custom"&&D[t.template].packages){let g=D[t.template].packages.map(w=>({name:w,version:"latest"}));t.libraries.push(...g)}if(t.template!=="custom"&&D[t.template].devPackages){let g=D[t.template].devPackages.map(w=>({name:w,version:"latest",isDev:!0}));t.libraries.push(...g)}}if(t.features||(t.features=await pt({message:"Select additional features:",choices:[{name:"Git initialization",value:"git",checked:!0},{name:"Create project structure",value:"structure",checked:!0},{name:"Generate README.md",value:"readme",checked:!0},{name:"Generate CHANGELOG.md",value:"changelog",checked:!1},{name:"ESLint + Prettier setup",value:"eslint",checked:!1},{name:"Husky pre-commit hooks",value:"husky",checked:!1}]})),await E({message:"Save this configuration as a profile?",default:!1})){let u=await ke({message:"Enter profile name:",validate:s(g=>g?!0:"Profile name is required","validate")});await $e(u,t)}console.log(a.bold.cyan(`
198
- \u{1F4CB} Project Configuration Summary
199
- `)),console.log(a.gray("\u2501".repeat(50))),console.log(a.white("Project Name: ")+a.green(t.projectName)),console.log(a.white("Location: ")+a.cyan(i)),console.log(a.white("Angular Version: ")+a.green(t.angularVersion)),console.log(a.white("Template: ")+a.cyan(t.template)),console.log(a.white("Libraries: ")+a.cyan(t.libraries.length)),console.log(a.white("Features: ")+a.cyan(t.features.join(", "))),console.log(a.gray("\u2501".repeat(50))+`
200
- `),await E({message:"Create project with this configuration?",default:!0})||(console.log(a.yellow(`Project creation cancelled.
201
- `)),process.exit(0)),console.log(a.bold.cyan(`
202
- \u{1F680} Creating Angular project...
203
- `));let p={...t.options,skipInstall:!0};if(await ze(t.projectName,t.angularVersion,p)||(console.log(a.red("Failed to create Angular project.")),process.exit(1)),t.libraries.length>0){console.log(a.bold.cyan(`
204
- \u{1F4E6} Resolving library versions...
205
- `));let u=await _e(t.libraries,t.angularVersion),g=u.filter(f=>f.adjusted);g.length>0&&(console.log(a.green(`\u2713 Dynamically resolved compatible library versions:
206
- `)),g.forEach(f=>{console.log(a.gray(` ${f.name}: ${f.originalVersion} \u2192 ${f.version}`)),f.reason&&console.log(a.gray(` \u2514\u2500 ${f.reason}`))}),console.log(""));let w=u.filter(f=>f.warning);w.length>0&&(console.log(a.yellow(`\u26A0\uFE0F Potential compatibility warnings:
207
- `)),w.forEach(f=>{console.log(a.yellow(` ${f.name}@${f.version}`)),f.reason&&console.log(a.gray(` \u2514\u2500 ${f.reason}`))}),console.log(""));let v=u.filter(f=>!f.isDev),C=u.filter(f=>f.isDev);if(v.length>0){console.log(a.bold.cyan(`\u{1F4E6} Installing production libraries...
208
- `));let f=v.map(b=>b.version==="latest"?b.name:`${b.name}@${b.version}`);await J(f,i)}if(C.length>0){console.log(a.bold.cyan(`\u{1F4E6} Installing dev libraries...
209
- `));let f=C.map(b=>b.version==="latest"?b.name:`${b.name}@${b.version}`);await J(f,i,!0)}}if(console.log(a.bold.cyan(`
210
- \u{1F4E5} Installing dependencies...
211
- `)),await We(i),t.features.includes("structure")&&(console.log(a.bold.cyan(`
212
- \u{1F4C1} Creating project structure...
213
- `)),await Qe(i,fe.standard.folders),await be(i,fe.standard.files)),t.features.includes("git")&&(console.log(a.bold.cyan(`
214
- \u{1F527} Initializing Git repository...
215
- `)),await Ye(i),await Ke(i,ye.gitignore)),t.features.includes("readme")){console.log(a.bold.cyan(`
216
- \u{1F4DD} Generating README.md...
217
- `));let u=he.readme(t.projectName,"An Angular application created with Angular Project Automator");await Ze(i,u)}if(t.features.includes("changelog")&&await et(i,he.changelog),t.features.includes("eslint")){console.log(a.bold.cyan(`
218
- \u{1F527} Setting up ESLint + Prettier...
219
- `));let u=z.eslint.packages.map(g=>g);await J(u,i,!0),await be(i,z.eslint.files)}if(t.features.includes("husky")){console.log(a.bold.cyan(`
220
- \u{1F436} Setting up Husky...
221
- `));let u=z.husky.devPackages.map(g=>g);await J(u,i,!0),await nt(i,z.husky.scripts)}t.features.includes("git")&&(console.log(a.bold.cyan(`
222
- \u{1F4DD} Creating initial commit...
223
- `)),await Xe(i,ye.initialCommitMessage)),console.log(a.bold.green(`
54
+ `)),process.exit(0)),console.log(a.yellow(`Exiting. Please install a compatible Node.js version manually.
55
+ `)),process.exit(0)}async function Sn(t){console.log(a.cyan(`\u2713 nvm detected on your system
56
+ `));let e=await ne(),n=tt(e,t);if(n.length>0){console.log(a.green(`Found ${n.length} compatible Node version(s) installed:
57
+ `));let s=await F({message:"Select Node version to switch to:",choices:n.map(i=>({name:`v${i}`,value:i}))});console.log(a.cyan(`
58
+ Switching to Node.js v${s}\u2026
59
+ `)),await J(s)||(console.log(a.red("Failed to switch Node version. Please try manually.")),process.exit(1)),console.log(a.green(`\u2713 Node version switched successfully
60
+ `));return}console.log(a.yellow(`No compatible Node versions installed.
61
+ `));let r=nt(t);await x({message:`Install Node.js v${r}?`,default:!0})||(console.log(a.red("Cannot proceed without compatible Node.js version.")),process.exit(1)),await re(r)||(console.log(a.red("Failed to install Node version.")),process.exit(1)),console.log(a.green(`\u2713 Node.js installed successfully
62
+ `)),await J(r)}async function An(t,e){let n=t.filter(l=>l.adjusted);n.length>0&&(console.log(a.green(`
63
+ \u2713 Dynamically resolved compatible library versions:
64
+ `)),g("Resolved Library Versions",n.map(({name:l,originalVersion:u,version:m,reason:d})=>({Package:l,From:u,To:m,Reason:d||""})),["Package","From","To","Reason"]));let r=t.filter(l=>l.warning);r.length>0&&(console.log(a.yellow(`
65
+ \u26A0\uFE0F Potential compatibility warnings:
66
+ `)),g("Compatibility Warnings",r.map(({name:l,version:u,reason:m})=>({Package:l,Version:u,Reason:m||""})),["Package","Version","Reason"]));let s=o(l=>l.version==="latest"?l.name:`${l.name}@${l.version}`,"toSpec"),i=t.filter(l=>!l.isDev);i.length>0&&(console.log(a.bold.cyan(`
67
+ \u{1F4E6} Installing production libraries\u2026
68
+ `)),await fe(i.map(s),e));let c=t.filter(l=>l.isDev);c.length>0&&(console.log(a.bold.cyan(`
69
+ \u{1F4E6} Installing dev libraries\u2026
70
+ `)),await fe(c.map(s),e,!0))}function Pn(t){let e=a.gray("\u2501".repeat(50));console.log(a.bold.green(`
224
71
  \u2705 Project created successfully! \u{1F389}
225
72
  `)),console.log(a.bold.cyan(`\u{1F4CA} Next Steps:
226
- `)),console.log(a.gray("\u2501".repeat(50))),console.log(a.white("1. ")+a.cyan(`cd ${t.projectName}`)),console.log(a.white("2. ")+a.cyan("ng serve")),console.log(a.white("3. ")+a.cyan("Open http://localhost:4200 in your browser")),console.log(a.gray("\u2501".repeat(50))),console.log(a.bold.cyan(`
73
+ `)),console.log(e),console.log(a.white("1. ")+a.cyan(`cd ${t}`)),console.log(a.white("2. ")+a.cyan("ng serve")),console.log(a.white("3. ")+a.cyan("Open http://localhost:4200 in your browser")),console.log(e),console.log(a.bold.cyan(`
227
74
  \u{1F4A1} Useful Commands:
228
- `)),console.log(a.gray(" ng generate component <name> ")+a.white("Create a component")),console.log(a.gray(" ng generate service <name> ")+a.white("Create a service")),console.log(a.gray(" ng build ")+a.white("Build for production")),console.log(a.gray(" ng test ")+a.white("Run unit tests")),console.log(a.gray(" ng help ")+a.white(`Get more help
229
- `)),console.log(a.bold.green(`Happy coding! \u{1F680}
230
- `))}catch(e){console.error(a.red(`
231
- \u274C Error:`),e.message),process.exit(1)}}s(dt,"runCli");import m from"chalk";import{readFileSync as Jt}from"fs";import{fileURLToPath as Wt}from"url";import{dirname as zt,join as Bt}from"path";var Ht=Wt(import.meta.url),qt=zt(Ht),Yt=JSON.parse(Jt(Bt(qt,"../package.json"),"utf-8")),G=new Ut;G.name("ng-init").description("Angular project initializer with intelligent version management and automation").version(Yt.version);G.command("create",{isDefault:!0}).alias("new").description("Create a new Angular project with interactive setup").action(()=>{dt()});var q=G.command("profile").description("Manage configuration profiles");q.command("list").description("List all saved profiles").action(async()=>{try{let e=await re();if(e.length===0){console.log(m.yellow("No saved profiles found."));return}console.log(m.bold.cyan(`
232
- \u{1F4CB} Saved Profiles:
233
- `)),console.log(m.gray("\u2501".repeat(50))),e.forEach(n=>{console.log(m.white(" \u2022 ")+m.green(n))}),console.log(m.gray("\u2501".repeat(50))+`
234
- `)}catch(e){console.error(m.red("Error listing profiles:"),e.message)}});q.command("show <name>").description("Show details of a profile").action(async e=>{try{let n=await H(e);if(!n){console.log(m.red(`Profile "${e}" not found.`));return}oe(e,n)}catch(n){console.error(m.red("Error loading profile:"),n.message)}});q.command("delete <name>").description("Delete a profile").action(async e=>{try{await lt(e)}catch(n){console.error(m.red("Error deleting profile:"),n.message)}});q.command("export <name> <output>").description("Export a profile to a file").action(async(e,n)=>{try{await ct(e,n)}catch(t){console.error(m.red("Error exporting profile:"),t.message)}});q.command("import <file>").description("Import a profile from a file").action(async e=>{try{await ut(e)}catch(n){console.error(m.red("Error importing profile:"),n.message)}});G.command("check").description("Check system versions and compatibility").action(async()=>{try{let{displaySystemVersions:e}=await Promise.resolve().then(()=>(ue(),Ae));await e()}catch(e){console.error(m.red("Error checking versions:"),e.message)}});G.command("examples").description("Show usage examples").action(()=>{console.log(m.bold.cyan(`
75
+ `));let n=[["ng generate component <name>","Create a component"],["ng generate service <name>","Create a service"],["ng build","Build for production"],["ng test","Run unit tests"],["ng help","Get more help"]];for(let[r,s]of n)console.log(`${a.gray(` ${r.padEnd(34)}`)}${a.white(s)}`);console.log(a.bold.green(`
76
+ Happy coding! \u{1F680}
77
+ `))}var yn,hn,At=h(()=>{oe();H();pe();dt();yt();wt();P();b();yn=Ae.dirname(gn(import.meta.url)),hn=JSON.parse(mn(Ae.join(yn,"../package.json"),"utf-8"));o(wn,"runCli");o(vn,"displayBanner");o(bn,"handleProfileSelection");o($n,"promptProjectOptions");o(xn,"handleNodeIncompatibility");o(Sn,"handleNvmSwitch");o(An,"installResolvedLibraries");o(Pn,"displaySuccessMessage")});import{Command as Nn}from"commander";import S from"chalk";import{readFileSync as jn}from"fs";import{fileURLToPath as kn}from"url";import{dirname as Cn,join as In}from"path";var Vn=Cn(kn(import.meta.url)),{version:En}=JSON.parse(jn(In(Vn,"../package.json"),"utf-8"));function N(t){return async(...e)=>{try{await t(...e)}catch(n){console.error(S.red("Error:"),n.message),process.exitCode=1}}}o(N,"action");var D=new Nn;D.name("ng-init").description("Angular project initializer with intelligent version management and automation").version(En);D.command("create",{isDefault:!0}).alias("new").description("Create a new Angular project with interactive setup").action(N(async()=>{let{runCli:t}=await Promise.resolve().then(()=>(At(),St));await t()}));var T=D.command("profile").description("Manage configuration profiles");T.command("list").description("List all saved profiles").action(N(async()=>{let{listProfiles:t,getProfileDetails:e}=await Promise.resolve().then(()=>(P(),E)),{printObjectList:n}=await Promise.resolve().then(()=>(b(),Ce)),r=await t();if(r.length===0){console.log(S.yellow("No saved profiles found."));return}let s=await Promise.all(r.map(async i=>{let c=await e(i);return{Name:c.name,Angular:c.angularVersion||"-",Libraries:c.libraries??0,Created:c.createdAt||"-"}}));n("Saved Profiles",s,["Name","Angular","Libraries","Created"])}));T.command("show <name>").description("Show details of a profile").action(N(async t=>{let{loadProfile:e,displayProfileInfo:n}=await Promise.resolve().then(()=>(P(),E)),r=await e(t);if(!r){console.log(S.red(`Profile "${t}" not found.`));return}n(t,r)}));T.command("delete <name>").description("Delete a profile").action(N(async t=>{let{deleteProfile:e}=await Promise.resolve().then(()=>(P(),E));await e(t)}));T.command("export <name> <output>").description("Export a profile to a file").action(N(async(t,e)=>{let{exportProfile:n}=await Promise.resolve().then(()=>(P(),E));await n(t,e)}));T.command("import <file>").description("Import a profile from a file").action(N(async t=>{let{importProfile:e}=await Promise.resolve().then(()=>(P(),E));await e(t)}));D.command("check").description("Check system versions and compatibility").action(N(async()=>{let{displaySystemVersions:t}=await Promise.resolve().then(()=>(oe(),Oe));await t()}));D.command("examples").description("Show usage examples").action(()=>{let t=S.gray("\u2501".repeat(50)),e=[["Create new project (interactive)","ng-init","or ng-init create"],["Check system versions","ng-init check"],["List saved profiles","ng-init profile list"],["Show profile details","ng-init profile show my-profile"],["Delete a profile","ng-init profile delete my-profile"],["Export a profile","ng-init profile export my-profile ./profile.json"],["Import a profile","ng-init profile import ./profile.json"]];console.log(S.bold.cyan(`
235
78
  \u{1F4DA} Usage Examples:
236
- `)),console.log(m.gray("\u2501".repeat(50))),console.log(m.white("Create new project (interactive):")),console.log(m.green(" $ ng-init")+m.gray(" or ")+m.green(`ng-init create
237
- `)),console.log(m.white("Check system versions:")),console.log(m.green(` $ ng-init check
238
- `)),console.log(m.white("List saved profiles:")),console.log(m.green(` $ ng-init profile list
239
- `)),console.log(m.white("Show profile details:")),console.log(m.green(` $ ng-init profile show my-profile
240
- `)),console.log(m.white("Delete a profile:")),console.log(m.green(` $ ng-init profile delete my-profile
241
- `)),console.log(m.white("Export a profile:")),console.log(m.green(` $ ng-init profile export my-profile ./profile.json
242
- `)),console.log(m.white("Import a profile:")),console.log(m.green(` $ ng-init profile import ./profile.json
243
- `)),console.log(m.gray("\u2501".repeat(50))+`
244
- `)});G.parse(process.argv);
79
+ `)),console.log(t);for(let[n,r,s]of e)console.log(S.white(`${n}:`)),console.log(S.green(` $ ${r}`)+(s?S.gray(` ${s}`):"")+`
80
+ `);console.log(t+`
81
+ `)});D.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jatinmourya/ng-init",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
4
4
  "description": "A comprehensive CLI tool to automate Angular project initialization with intelligent version management and prerequisite handling",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -48,9 +48,9 @@
48
48
  "chalk": "^5.3.0",
49
49
  "commander": "^13.1.0",
50
50
  "execa": "^9.6.1",
51
- "lodash.debounce": "^4.0.8",
52
51
  "ora": "^8.0.1",
53
- "semver": "^7.5.4"
52
+ "semver": "^7.5.4",
53
+ "cli-table3": "^0.6.2"
54
54
  },
55
55
  "devDependencies": {
56
56
  "esbuild": "^0.27.2",