@jatinmourya/ng-init 1.2.8 → 1.2.10

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 +78 -228
  3. package/package.json +17 -13
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,94 @@
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 $e=Object.defineProperty;var a=(e,t)=>$e(e,"name",{value:t,configurable:!0});var xe=(e,t)=>()=>(e&&(t=e(e=0)),t);var Pe=(e,t)=>{for(var r in t)$e(e,r,{get:t[r],enumerable:!0})};var Y={};Pe(Y,{default:()=>pt,printKeyValue:()=>N,printObjectList:()=>C,printSimpleTable:()=>Ce});import Ve from"cli-table3";import H from"chalk";function N(e,t=[]){e&&console.log(H.bold.cyan(`
3
+ ${e}
4
+ `));let r=new Ve({head:["Field","Value"],style:{head:["cyan"]}});t.forEach(([n,o])=>r.push([n,o])),console.log(r.toString()+`
5
+ `)}function C(e,t=[],r=[]){if(!Array.isArray(t)||t.length===0){console.log(H.yellow(`No ${e||"items"} to display.`));return}e&&console.log(H.bold.cyan(`
6
+ ${e}
7
+ `));let n=new Ve({head:r,style:{head:["cyan"]}});t.forEach(o=>{let i=r.map(s=>o[s]!==void 0?String(o[s]):"");n.push(i)}),console.log(n.toString()+`
8
+ `)}function Ce(e,t=[]){if(!Array.isArray(t)||t.length===0){console.log(H.yellow(`No ${e||"items"} to display.`));return}let r=Object.keys(t[0]);C(e,t,r)}var pt,S=xe(()=>{a(N,"printKeyValue");a(C,"printObjectList");a(Ce,"printSimpleTable");pt={printKeyValue:N,printObjectList:C,printSimpleTable:Ce}});var je={};Pe(je,{compareVersions:()=>mt,displaySystemVersions:()=>ue,getAngularCliVersion:()=>Se,getAvailableNodeVersions:()=>dt,getInstalledNodeVersions:()=>pe,getNodeVersion:()=>B,getNpmVersion:()=>Ne,getNvmVersion:()=>le,installNodeVersion:()=>de,isNvmInstalled:()=>ce,satisfiesVersion:()=>gt,switchNodeVersion:()=>X});import{execa as D}from"execa";import"chalk";import ke from"semver";async function B(){try{let{stdout:e}=await D("node",["--version"]);return e.trim().replace("v","")}catch{return null}}async function Ne(){try{let{stdout:e}=await D("npm",["--version"]);return e.trim()}catch{return null}}async function le(){try{let{stdout:e}=await D("nvm",["--version"],{shell:!0});return e.trim()}catch{return null}}async function ce(){return await le()!==null}async function Se(){try{let{stdout:e}=await D("ng",["--version"],{shell:!0});return e.trim()||null}catch{return null}}async function ue(){let e=await B(),t=await Ne(),r=await le(),n=await Se(),o=null;if(n){let s=n.match(/(\d+\.\d+\.\d+)/);o=s?s[1]:n.split(`
9
+ `)[0]||null}let i=[{Tool:"Node.js",Version:e?`${e}`:"Not installed"},{Tool:"npm",Version:t?`${t}`:"Not installed"},{Tool:"nvm",Version:r?`${r}`:"Not installed"},{Tool:"Angular CLI",Version:o?`${o}`:"Not installed"}];try{let s=i.map(c=>({Tool:c.Tool,Version:c.Version}));C("\u{1F50D} System Environment Check",s,["Tool","Version"])}catch{console.table(i)}return{node:e,npm:t,nvm:r,angularCli:o}}async function dt(){try{let{stdout:e}=await D("nvm",["list","available"],{shell:!0}),t=[],r=e.split(`
10
+ `);for(let n of r){let o=n.match(/(\d+\.\d+\.\d+)/);o&&t.push(o[1])}return t}catch{return[]}}async function pe(){try{let{stdout:e}=await D("nvm",["list"],{shell:!0}),t=[],r=e.split(`
11
+ `);for(let n of r){let o=n.match(/(\d+\.\d+\.\d+)/);o&&t.push(o[1])}return t}catch{return[]}}async function X(e){try{return await D("nvm",["use",e],{shell:!0,stdio:"inherit"}),!0}catch{return!1}}async function de(e){try{return await D("nvm",["install",e],{shell:!0,stdio:"inherit"}),!0}catch{return!1}}function mt(e,t){return ke.compare(e,t)}function gt(e,t){return ke.satisfies(e,t)}var me=xe(()=>{S();a(B,"getNodeVersion");a(Ne,"getNpmVersion");a(le,"getNvmVersion");a(ce,"isNvmInstalled");a(Se,"getAngularCliVersion");a(ue,"displaySystemVersions");a(dt,"getAvailableNodeVersions");a(pe,"getInstalledNodeVersions");a(X,"switchNodeVersion");a(de,"installNodeVersion");a(mt,"compareVersions");a(gt,"satisfiesVersion")});import{Command as zt}from"commander";me();import{select as F,input as ve,confirm as E}from"@inquirer/prompts";import l from"chalk";import It from"path";import T from"axios";import ft from"chalk";import yt from"lodash.debounce";var Z="https://registry.npmjs.org",ht="https://registry.npmjs.org/-/v1/search",wt="https://api.npmjs.org/downloads/point/last-week";async function ge(e,t=10){try{return(await T.get(ht,{params:{text:e,size:t},timeout:5e3})).data.objects.map(n=>({name:n.package.name,version:n.package.version,description:n.package.description||"No description",author:n.package.publisher?.username||"Unknown",date:n.package.date,verified:n.package.publisher?.verified||!1}))}catch(r){return console.error("Error searching npm packages:",r.message),[]}}a(ge,"searchNpmPackages");async function vt(e){try{let t=await T.get(`${Z}/${e}`,{timeout:5e3}),r=t.data["dist-tags"]?.latest,n=Object.keys(t.data.versions||{});return{name:t.data.name,description:t.data.description||"No description",latestVersion:r,versions:n,homepage:t.data.homepage,repository:t.data.repository,license:t.data.license,keywords:t.data.keywords||[]}}catch(t){if(t.response?.status===404)return null;throw t}}a(vt,"getPackageDetails");async function bt(e){try{return(await T.get(`${wt}/${e}`,{timeout:5e3})).data.downloads}catch{return 0}}a(bt,"getPackageDownloads");async function Le(e){try{let[t,r]=await Promise.all([vt(e),bt(e)]);return t?{...t,weeklyDownloads:r}:null}catch(t){return console.error(`Error getting package info for ${e}:`,t.message),null}}a(Le,"getEnhancedPackageInfo");function fe(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}a(fe,"formatDownloads");var lr=yt(async(e,t)=>{if(!e||e.length<2){t([]);return}let r=await ge(e,10);t(r)},300);async function Ie(){try{let e=await T.get(`${Z}/@angular/cli`,{timeout:1e4}),t=Object.keys(e.data.versions||{}).filter(n=>!n.includes("rc")&&!n.includes("beta")&&!n.includes("next")).sort((n,o)=>{let i=n.split(".").map(Number),s=o.split(".").map(Number);for(let c=0;c<Math.max(i.length,s.length);c++){let d=i[c]||0,u=s[c]||0;if(d!==u)return u-d}return 0}),r=e.data["dist-tags"]||{};return{versions:t,latest:r.latest,lts:r.lts}}catch(e){return console.error("Error fetching Angular versions:",e.message),{versions:[],latest:null,lts:null}}}a(Ie,"getAngularVersions");function Q(e){let t=new Set;return e.forEach(r=>{let n=r.split(".")[0];t.add(n)}),Array.from(t).sort((r,n)=>Number(n)-Number(r))}a(Q,"getMajorVersions");function ee(e,t){let r=new Set;return e.filter(n=>n.startsWith(`${t}.`)).forEach(n=>{let o=n.split("."),i=`${o[0]}.${o[1]}`;r.add(i)}),Array.from(r).sort((n,o)=>{let i=n.split(".").map(Number),s=o.split(".").map(Number);for(let c=0;c<Math.max(i.length,s.length);c++){let d=i[c]||0,u=s[c]||0;if(d!==u)return u-d}return 0})}a(ee,"getMinorVersionsForMajor");function te(e,t){return e.filter(r=>r.startsWith(`${t}.`)).sort((r,n)=>{let o=r.split(".").map(Number),i=n.split(".").map(Number);for(let s=0;s<Math.max(o.length,i.length);s++){let c=o[s]||0,d=i[s]||0;if(c!==d)return d-c}return 0})}a(te,"getPatchVersionsForMinor");async function De(e){try{let t=await T.get(`${Z}/${e}`,{timeout:1e4}),r=Object.keys(t.data.versions||{}).filter(o=>!o.includes("rc")&&!o.includes("beta")&&!o.includes("next")&&!o.includes("alpha")).sort((o,i)=>{let s=o.split(".").map(Number),c=i.split(".").map(Number);for(let d=0;d<Math.max(s.length,c.length);d++){let u=s[d]||0,$=c[d]||0;if(u!==$)return $-u}return 0}),n=t.data["dist-tags"]||{};return{versions:r,latest:n.latest,lts:n.lts}}catch(t){return console.error(`Error fetching versions for ${e}:`,t.message),{versions:[],latest:null,lts:null}}}a(De,"getPackageVersions");async function Fe(e){try{let r=(await T.get(`${Z}/@angular/cli/${e}`,{timeout:5e3})).data.engines||{};if(!r.node){let n=parseInt(e.split(".")[0]);return Ae(n)}return r.node}catch{let r=parseInt(e.split(".")[0]);return console.log(ft.gray(`Unable to fetch Node requirements, deriving from Angular ${r}...`)),Ae(r)}}a(Fe,"getNodeRequirementsForAngular");function Ae(e){let t;e>=15?t=Math.floor(e/2)*2:e>=10?t=Math.floor((e+2)/2)*2:t=Math.floor(e*1.5/2)*2;let r=t,n=t+2,o=t+4;return`^${r}.0.0 || ^${n}.0.0 || ^${o}.0.0`}a(Ae,"generateNodeRequirementFromAngularVersion");S();import O from"semver";import M from"chalk";import Ee from"axios";var Me="https://registry.npmjs.org",U=new Map,$t=300*1e3,xt=100;function Oe(e,t){try{return{compatible:O.satisfies(e,t),current:e,required:t}}catch(r){return{compatible:!1,current:e,required:t,error:r.message}}}a(Oe,"checkNodeCompatibility");function Re(e){let t=[["Current Node.js",M.cyan(`v${e.current}`)],["Required Node.js",M.cyan(e.required)],["Status",e.compatible?M.green("\u2713 Compatible"):M.red("\u2717 Incompatible")]];return N("\u{1F4CB} Compatibility Check",t),e.compatible}a(Re,"displayCompatibilityStatus");function Te(e,t){try{return e.filter(r=>{try{return O.satisfies(r,t)}catch{return!1}}).sort((r,n)=>O.rcompare(r,n))}catch{return[]}}a(Te,"findCompatibleVersions");function ze(e){try{let t=e.split("||").map(o=>o.trim()),r=[];for(let o of t){let i=o.match(/[~^><=]*\s*(\d+)\./g);i&&i.forEach(s=>{let c=parseInt(s.match(/(\d+)/)[1]);r.includes(c)||r.push(c)})}return r.length===0?(console.log(M.yellow("\u26A0\uFE0F Could not parse Node version range. Please install the latest LTS version.")),null):(r.sort((o,i)=>o-i),`${r[0]}.0.0`)}catch{return console.log(M.yellow("\u26A0\uFE0F Could not parse Node version range. Please install a compatible version manually.")),null}}a(ze,"getRecommendedNodeVersion");async function We(e){let t=e,r=U.get(t);if(r&&Date.now()-r.timestamp<$t)return r.data;try{let o=(await Ee.get(`${Me}/${encodeURIComponent(e)}`,{timeout:1e4})).data;if(U.size>=xt){let i=U.keys().next().value;U.delete(i)}return U.set(t,{data:o,timestamp:Date.now()}),o}catch(n){return console.error(M.gray(`Could not fetch package data for ${e}: ${n.message}`)),null}}a(We,"fetchPackageData");async function Pt(e,t){try{return(await Ee.get(`${Me}/${encodeURIComponent(e)}/${t}`,{timeout:5e3})).data}catch{return null}}a(Pt,"fetchPackageVersionData");async function Vt(e,t){return(await Pt(e,t))?.peerDependencies||{}}a(Vt,"getPackagePeerDependencies");async function z(e,t,r){let n=await Vt(e,t),o=["@angular/core","@angular/common","@angular/platform-browser"],i=null;for(let s of o)if(n[s]){i=n[s];break}if(!i)return{compatible:!0,reason:"No Angular peer dependency found",hasPeerDependency:!1};try{let s=O.satisfies(r,i);return{compatible:s,peerDependency:i,hasPeerDependency:!0,reason:s?`Angular ${r} satisfies ${i}`:`Angular ${r} does not satisfy ${i}`}}catch{return kt(i,r)}}a(z,"isVersionCompatibleWithAngular");async function Ct(e,t,r=!0){let n=await We(e);if(!n)return{version:"latest",source:"fallback",reason:"Could not fetch package data"};let o=parseInt(t.split(".")[0]),i=Object.keys(n.versions||{}).filter(g=>!g.includes("rc")&&!g.includes("beta")&&!g.includes("alpha")&&!g.includes("next")).sort((g,v)=>O.rcompare(g,v));if(e.startsWith("@angular/")){let g=i.filter(v=>parseInt(v.split(".")[0])===o);if(g.length>0)return{version:`^${g[0]}`,source:"dynamic",reason:`Matched Angular major version ${o}`,matchType:"angular-scope"}}if(["@ngrx/","@ngxs/","@ng-bootstrap/","@angular-eslint/"].some(g=>e.startsWith(g))){let g=i.filter(v=>parseInt(v.split(".")[0])===o);if(g.length>0)return{version:`^${g[0]}`,source:"dynamic",reason:`Matched Angular ecosystem major version ${o}`,matchType:"ecosystem"}}let c=[],d=i.length>50?30:20,u=i.slice(0,d);for(let g of u){let v=await z(e,g,t);if(v.compatible&&(c.push({version:g,peerDependency:v.peerDependency,hasPeerDependency:v.hasPeerDependency}),r))return{version:`^${g}`,source:"dynamic",reason:v.reason,peerDependency:v.peerDependency,matchType:"peer-dependency"}}if(c.length>0){let g=c[0];return{version:`^${g.version}`,source:"dynamic",reason:`Found ${c.length} compatible version(s)`,peerDependency:g.peerDependency,matchType:"peer-dependency"}}let $=n["dist-tags"]?.latest;return{version:$?`^${$}`:"latest",source:"fallback",reason:"No version with compatible Angular peer dependency found",warning:!0,matchType:"fallback"}}a(Ct,"findCompatibleLibraryVersion");async function Je(e,t){let r=[];for(let n of e){let o=n.version||"latest";if(o==="latest"){let i=await Ct(n.name,t);r.push({...n,version:i.version,originalVersion:o,adjusted:i.source==="dynamic",source:i.source,reason:i.reason,warning:i.warning||!1})}else{let i=await z(n.name,o.replace(/[\^~]/,""),t);r.push({...n,adjusted:!1,compatible:i.compatible,reason:i.reason,warning:!i.compatible})}}return r}a(Je,"resolveLibraryVersionsAsync");function kt(e,t){if(!e||e==="No Angular peer dependency")return{compatible:!0,reason:"No Angular peer dependency specified"};try{return O.satisfies(t,e)?{compatible:!0,reason:`Angular ${t} satisfies peer dependency '${e}'`}:{compatible:!1,reason:`Angular ${t} does not satisfy peer dependency '${e}'`}}catch{let n=t.split(".")[0],o=t.split(".")[1]||"0";return[`^${n}.`,`~${n}.`,`>=${n}.`,`${n}.x`,`${n}.${o}.`,` ${n}.`,`||.*${n}.`].some(c=>new RegExp(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).test(e))?{compatible:!0,reason:`Peer dependency '${e}' appears compatible with Angular ${n}`}:{compatible:!1,reason:`Peer dependency '${e}' may not support Angular ${n}`}}}a(kt,"checkLibraryCompatibility");async function _e(e,t,r=10){let n=await We(e);if(!n)return[];let o=Object.keys(n.versions||{}).filter(s=>!s.includes("rc")&&!s.includes("beta")&&!s.includes("alpha")&&!s.includes("next")).sort((s,c)=>O.rcompare(s,c)),i=[];for(let s of o){if(i.length>=r)break;let c=await z(e,s,t);c.compatible&&i.push({version:s,peerDependency:c.peerDependency,reason:c.reason})}return i}a(_e,"getAllCompatibleVersions");S();import{execa as W}from"execa";import re from"ora";import x from"chalk";import{platform as Nt}from"os";async function Ue(e="LTS"){let t=re("Installing Node.js with winget...").start();try{return await W("winget",["install",e==="LTS"?"OpenJS.NodeJS.LTS":"OpenJS.NodeJS"],{stdio:"inherit"}),t.succeed("Node.js installed successfully"),!0}catch(r){return t.fail("Failed to install Node.js"),console.error(x.red(r.message)),!1}}a(Ue,"installNodeWithWinget");function St(){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"]}}}a(St,"getNvmInstallInstructions");function Ge(){let e=St();if(N("\u{1F4DA} NVM Installation Guide",[["OS",x.cyan(e.os)],["Download/Repo",e.download?x.blue(e.download):e.repo?x.blue(e.repo):"-"],["Install",e.install?x.green(e.install):"-"],["Alternative",e.alternative?x.green(e.alternative):"-"]]),Array.isArray(e.steps)){let r=e.steps.map((n,o)=>({Step:`${o+1}`,Instruction:n}));C("Steps",r,["Step","Instruction"])}if(Array.isArray(e.postInstall)){let r=e.postInstall.map((n,o)=>({Step:`${o+1}`,Instruction:n}));C("Post-Install",r,["Step","Instruction"])}C("Why use NVM?",[{Benefit:"Manage multiple Node.js versions"},{Benefit:"Switch instantly"},{Benefit:"No sudo/admin required"},{Benefit:"Per-project Node versions"}],["Benefit"])}a(Ge,"displayNvmInstallGuide");async function ye(e,t,r=!1){let n=re(`Installing ${e.length} package(s)...`).start();try{let o=["install"];return r&&o.push("--save-dev"),o.push(...e),await W("npm",o,{cwd:t}),n.succeed("Packages installed successfully"),!0}catch{n.warn("Failed with strict dependencies, retrying with --legacy-peer-deps...");try{let i=["install","--legacy-peer-deps"];return r&&i.push("--save-dev"),i.push(...e),await W("npm",i,{cwd:t}),n.succeed("Packages installed successfully with --legacy-peer-deps"),console.log(x.yellow("\u26A0\uFE0F Note: Installed with --legacy-peer-deps flag due to peer dependency conflicts")),!0}catch(i){return n.fail("Failed to install packages"),console.error(x.red(i.message)),console.log(x.yellow(`
12
+ \u{1F4A1} Tip: You can try installing manually with:`)),console.log(x.cyan(` cd ${t}`)),console.log(x.cyan(` npm install ${e.join(" ")} --force`)),!1}}}a(ye,"installPackages");async function qe(e){let t=re("Installing dependencies...").start();try{return await W("npm",["install"],{cwd:e}),t.succeed("Dependencies installed successfully"),!0}catch{t.warn("Failed with strict dependencies, retrying with --legacy-peer-deps...");try{return await W("npm",["install","--legacy-peer-deps"],{cwd:e}),t.succeed("Dependencies installed successfully with --legacy-peer-deps"),console.log(x.yellow("\u26A0\uFE0F Note: Installed with --legacy-peer-deps flag due to peer dependency conflicts")),!0}catch(n){return t.fail("Failed to install dependencies"),console.error(x.red(n.message)),console.log(x.yellow(`
13
+ \u{1F4A1} Tip: You can try installing manually with:`)),console.log(x.cyan(` cd ${e}`)),console.log(x.cyan(" npm install --force")),!1}}}a(qe,"runNpmInstall");async function Ke(e,t,r={}){let n=re(`Creating Angular project: ${e}...`).start();try{let o=["new",e];r.skipInstall&&o.push("--skip-install"),r.routing!==void 0&&o.push(`--routing=${r.routing}`),r.style&&o.push(`--style=${r.style}`),r.strict!==void 0&&o.push(`--strict=${r.strict}`),r.standalone!==void 0&&o.push(`--standalone=${r.standalone}`);let i=t?`@angular/cli@${t}`:"@angular/cli";return await W("npx",[i,...o],{stdio:"inherit"}),n.succeed(`Angular project ${e} created successfully`),!0}catch(o){return n.fail("Failed to create Angular project"),console.error(x.red(o.message)),!1}}a(Ke,"createAngularProject");import{search as jt,select as j,input as he,confirm as ne}from"@inquirer/prompts";import p from"chalk";S();var oe=class{static{a(this,"LibraryTracker")}constructor(){this.selectedLibraries=new Map}add(t){this.selectedLibraries.set(t.name,t)}remove(t){this.selectedLibraries.delete(t)}has(t){return this.selectedLibraries.has(t)}getAll(){return Array.from(this.selectedLibraries.values())}size(){return this.selectedLibraries.size}clear(){this.selectedLibraries.clear()}displaySelected(){if(this.selectedLibraries.size===0){console.log(p.gray(` No libraries selected yet.
14
+ `));return}let t=this.getAll().map(r=>({Library:r.name,Version:r.version,Description:r.description?r.description.substring(0,70):""}));C("\u{1F4E6} Currently Selected Libraries",t,["Library","Version","Description"])}};async function He(e=null){let t=new oe,r=!0;for(console.log(p.bold.cyan(`
21
15
  \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(`
16
+ `)),e&&console.log(p.gray(`Angular version: ${e} (compatibility will be checked)
17
+ `)),console.log(p.gray(`Type to search npm packages. Press Enter to select.
18
+ `));r;)try{t.size()>0&&t.displaySelected();let n=await jt({message:"Search for a library:",source:a(async(s,{signal:c})=>{if(!s||s.length<2)return[];let d=await ge(s,15),u=d.filter($=>!t.has($.name));return u.length===0&&d.length>0?[{name:p.yellow("All matching libraries have already been selected"),value:null,disabled:!0}]:u.map($=>({name:At($),value:$.name,description:$.description}))},"source"),pageSize:10});if(!n){r=await ne({message:"Continue searching for libraries?",default:!1});continue}let o=await Le(n);if(o){N(`
19
+ Selected Package`,[["Name",p.green(o.name)],["Description",p.gray(o.description)],["Latest version",p.cyan(o.latestVersion)],["Weekly downloads",p.gray(fe(o.weeklyDownloads))]]);let s=await j({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"}),c=o.latestVersion;if(s==="specific"){console.log(p.cyan(`
26
20
  \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(`
21
+ `));let u=await De(o.name);if(u.versions.length===0)console.log(p.yellow("Could not fetch versions. Using latest version.")),c=o.latestVersion;else{let g=Q(u.versions).map(y=>{let h=`${o.name} ${y}`;return{name:u.latest&&u.latest.startsWith(`${y}.`)?`${h} (latest)`:h,value:y}}),v=await j({message:`Select ${o.name} major version:`,choices:g,pageSize:15}),be=ee(u.versions,v).map(y=>({name:`v${y}.x`,value:y})),K=await j({message:`Select ${o.name} ${v} minor version:`,choices:be,pageSize:15}),m=te(u.versions,K).map(y=>{let h=`v${y}`;return y===u.latest&&(h+=" (latest)"),y===u.lts&&(h+=" (LTS)"),{name:h,value:y}});c=await j({message:`Select ${o.name} ${K} patch version:`,choices:m,pageSize:15})}}else s==="manual"&&(c=await he({message:"Enter version:",default:o.latestVersion,validate:a(u=>u?!0:"Version is required","validate")}));if(e&&c!=="latest"){console.log(p.cyan(`
28
22
  \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(`
23
+ `));let u=await z(o.name,c,e);if(u.compatible)console.log(p.green(`\u2713 ${o.name}@${c} is compatible with Angular ${e}`)),u.peerDependency&&console.log(p.gray(` Peer dependency: ${u.peerDependency}
24
+ `));else if(console.log(p.red(`\u2717 ${o.name}@${c} may not be compatible with Angular ${e}`)),console.log(p.gray(` ${u.reason}
25
+ `)),await ne({message:"Would you like to see compatible versions?",default:!0})){console.log(p.cyan(`
32
26
  \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(`
27
+ `));let g=await _e(o.name,e,10);if(g.length>0){let v=g.map(A=>({name:`${A.version}${A.peerDependency?` (peer: ${A.peerDependency})`:""}`,value:A.version}));v.push({name:"Keep selected version anyway",value:c}),c=await j({message:"Select a compatible version:",choices:v,pageSize:12})}else if(console.log(p.yellow("No compatible versions found automatically.")),!await ne({message:"Continue with the selected version anyway?",default:!1})){console.log(p.yellow(`Skipping this library.
28
+ `)),r=await ne({message:"Search for another library?",default:!0});continue}}}let d={name:o.name,version:c,description:o.description};t.add(d),console.log(p.green(`\u2713 Added ${o.name}@${c} to installation queue
29
+ `))}let i=await j({message:"What would you like to do next?",choices:[{name:"Add another library",value:"add"},{name:"Remove a library",value:"remove",disabled:t.size()===0},{name:"Finish library selection",value:"finish"}],default:"add"});if(i==="remove"){let s=t.getAll().map(d=>({name:`${d.name}@${d.version}`,value:d.name})),c=await j({message:"Select library to remove:",choices:s});t.remove(c),console.log(p.yellow(`
30
+ \u2713 Removed ${c}
31
+ `)),r=!0}else i==="finish"?r=!1:r=!0}catch(n){console.error(p.red("Error during library search:",n.message)),r=!1}return t.getAll()}a(He,"interactiveLibrarySearch");function At(e){let t=fe(e.weeklyDownloads||0),r=e.verified?" \u2713":"",n=e.description.substring(0,50)+(e.description.length>50?"...":"");return`${e.name}${r} - ${n} (v${e.version}, \u2B07 ${t}/week)`}a(At,"formatPackageChoice");async function Ye(e=null){let t=new oe,r=!0;for(console.log(p.bold.cyan(`
36
32
  \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(`
33
+ `)),e&&console.log(p.gray(`Angular version: ${e} (compatibility will be checked)
34
+ `));r;){t.size()>0&&t.displaySelected();let n=await he({message:"Enter library name (or press Enter to skip):",validate:a(async s=>s?s.match(/^[@a-z0-9-~][a-z0-9-._~]*$/)?t.has(s)?`${s} has already been selected`:!0:"Invalid package name format":!0,"validate")});if(!n)break;let o=await he({message:`Enter version for ${n} (or 'latest'):`,default:"latest"});if(e&&o!=="latest"){console.log(p.cyan(`
39
35
  \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(`
36
+ `));let s=await z(n,o,e);s.compatible?(console.log(p.green(`\u2713 ${n}@${o} is compatible with Angular ${e}`)),s.peerDependency&&console.log(p.gray(` Peer dependency: ${s.peerDependency}
37
+ `))):(console.log(p.red(`\u2717 ${n}@${o} may not be compatible with Angular ${e}`)),console.log(p.gray(` ${s.reason}
38
+ `)),console.log(p.yellow(`\u26A0\uFE0F This may cause installation issues. Consider using a different version.
39
+ `)))}t.add({name:n,version:o}),console.log(p.green(`\u2713 Added ${n}@${o}
40
+ `));let i=await j({message:"What would you like to do next?",choices:[{name:"Add another library",value:"add"},{name:"Remove a library",value:"remove",disabled:t.size()===0},{name:"Finish library selection",value:"finish"}],default:"add"});if(i==="remove"){let s=t.getAll().map(d=>({name:`${d.name}@${d.version}`,value:d.name})),c=await j({message:"Select library to remove:",choices:s});t.remove(c),console.log(p.yellow(`
41
+ \u2713 Removed ${c}
42
+ `)),r=!0}else i==="finish"&&(r=!1)}return t.getAll()}a(Ye,"simpleLibraryInput");async function Be(){return await j({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"})}a(Be,"askLibrarySearchPreference");import Er from"chalk";import{execa as Or}from"execa";import Tr from"ora";function Xe(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}a(Xe,"validateDirectoryName");S();import G from"fs/promises";import Ze from"path";import{homedir as Lt}from"os";import P from"chalk";var Qe=Ze.join(Lt(),".ng-init"),et=Ze.join(Qe,"profiles.json");async function tt(){try{return await G.mkdir(Qe,{recursive:!0}),!0}catch(e){return console.error(P.red("Failed to create profiles directory:"),e.message),!1}}a(tt,"ensureProfilesDirectory");async function se(){try{await tt();let e=await G.readFile(et,"utf-8");return JSON.parse(e)}catch{return{}}}a(se,"loadProfiles");async function rt(e){try{return await tt(),await G.writeFile(et,JSON.stringify(e,null,2),"utf-8"),!0}catch(t){return console.error(P.red("Failed to save profiles:"),t.message),!1}}a(rt,"saveProfiles");async function we(e,t){let r=await se();r[e]={...t,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};let n=await rt(r);return n&&console.log(P.green(`\u2713 Profile "${e}" saved successfully`)),n}a(we,"saveProfile");async function J(e){return(await se())[e]||null}a(J,"loadProfile");async function nt(e){let t=await se();if(!t[e])return console.log(P.yellow(`Profile "${e}" not found`)),!1;delete t[e];let r=await rt(t);return r&&console.log(P.green(`\u2713 Profile "${e}" deleted successfully`)),r}a(nt,"deleteProfile");async function ae(){let e=await se();return Object.keys(e)}a(ae,"listProfiles");async function ot(e){let t=await J(e);return t?{name:e,angularVersion:t.angularVersion,libraries:t.libraries?.length||0,createdAt:t.createdAt,updatedAt:t.updatedAt}:null}a(ot,"getProfileDetails");async function st(e,t){let r=await J(e);if(!r)return console.log(P.red(`Profile "${e}" not found`)),!1;try{let n={name:e,profile:r,exportedAt:new Date().toISOString(),version:"1.0.0"};return await G.writeFile(t,JSON.stringify(n,null,2),"utf-8"),console.log(P.green(`\u2713 Profile exported to ${t}`)),!0}catch(n){return console.error(P.red("Failed to export profile:"),n.message),!1}}a(st,"exportProfile");async function at(e){try{let t=await G.readFile(e,"utf-8"),r=JSON.parse(t);if(!r.name||!r.profile)return console.log(P.red("Invalid profile file format")),!1;let n=await we(r.name,r.profile);return n&&console.log(P.green(`\u2713 Profile "${r.name}" imported successfully`)),n}catch(t){return console.error(P.red("Failed to import profile:"),t.message),!1}}a(at,"importProfile");function ie(e,t){let r=[];if(t.angularVersion&&r.push(["Angular Version",P.green(t.angularVersion)]),t.template&&r.push(["Template",P.gray(`${t.template} (deprecated)`)]),r.push(["Libraries",P.cyan(t.libraries?.length||0)]),t.createdAt&&r.push(["Created",P.gray(new Date(t.createdAt).toLocaleString())]),t.updatedAt&&r.push(["Updated",P.gray(new Date(t.updatedAt).toLocaleString())]),N(`\u{1F4CB} Profile: ${e}`,r),t.libraries&&t.libraries.length>0){let n=t.libraries.slice(0,50).map(o=>({Library:o.name,Version:o.version,Description:o.description||""}));C("Libraries (showing up to 50)",n,["Library","Version","Description"]),t.libraries.length>50&&console.log(P.gray(` ... and ${t.libraries.length-50} more`))}if(t.options){let n=Object.entries(t.options).map(([o,i])=>({Option:o,Value:String(i)}));C("Options",n,["Option","Value"])}}a(ie,"displayProfileInfo");import{readFileSync as Dt}from"fs";import{fileURLToPath as Ft}from"url";import{dirname as Et,join as Mt}from"path";var Ot=Ft(import.meta.url),Rt=Et(Ot),Tt=JSON.parse(Dt(Mt(Rt,"../package.json"),"utf-8"));async function it(){try{let e=`Angular Project Initialization Automation CLI v${Tt.version}`,t=60,r="\u2550".repeat(t),n=t-e.length;console.log(l.cyan.bold(`
43
+ \u2554${r}\u2557
44
+ \u2551${" ".repeat(n/2)}${e}${" ".repeat(Math.ceil(n/2))}\u2551
45
+ \u255A${r}\u255D
46
+ `));let o=await ue(),i=await E({message:"Would you like to use a saved profile?",default:!1}),s={};if(i){let m=await ae();if(m.length===0)console.log(l.yellow(`No saved profiles found. Continuing with manual setup...
47
+ `));else{let b=await F({message:"Select a profile:",choices:m.map(L=>({name:L,value:L}))}),y=await J(b);ie(b,y),await E({message:"Use this profile?",default:!0})&&(s=y)}}if(!s.angularVersion){console.log(l.bold.cyan(`
180
48
  \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(`
49
+ `));let m=await Ie();m.versions.length===0&&(console.log(l.red("Failed to fetch Angular versions. Please check your internet connection.")),process.exit(1));let y=Q(m.versions).map(k=>{let R=`Angular ${k}`;return{name:m.latest&&m.latest.startsWith(`${k}.`)?`${R} (latest)`:R,value:k}}),h=await F({message:"Select Angular major version:",choices:y,pageSize:15}),w=ee(m.versions,h).map(k=>({name:`v${k}.x`,value:k})),V=await F({message:`Select Angular ${h} minor version:`,choices:w,pageSize:15}),ct=te(m.versions,V).map(k=>{let R=`v${k}`;return k===m.latest&&(R+=" (latest)"),k===m.lts&&(R+=" (LTS)"),{name:R,value:k}}),ut=await F({message:`Select Angular ${V} patch version:`,choices:ct,pageSize:15});s.angularVersion=ut}console.log(l.green(`
50
+ \u2713 Selected Angular version: ${s.angularVersion}
51
+ `));let c=await Fe(s.angularVersion),d=await B(),u=Oe(d,c);if(Re(u),!u.compatible)if(console.log(l.yellow(`\u26A0\uFE0F Node.js version incompatibility detected!
52
+ `)),await ce()){console.log(l.cyan(`\u2713 nvm detected on your system
53
+ `));let b=await pe(),y=Te(b,c);if(y.length>0){console.log(l.green(`Found ${y.length} compatible Node version(s) installed:
54
+ `));let h=await F({message:"Select Node version to switch to:",choices:y.map(w=>({name:`v${w}`,value:w}))});console.log(l.cyan(`
55
+ Switching to Node.js v${h}...
56
+ `)),await X(h)||(console.log(l.red("Failed to switch Node version. Please try manually.")),process.exit(1)),console.log(l.green(`\u2713 Node version switched successfully
57
+ `))}else{console.log(l.yellow(`No compatible Node versions installed.
58
+ `));let h=ze(c);await E({message:`Install Node.js v${h}?`,default:!0})?(await de(h)||(console.log(l.red("Failed to install Node version.")),process.exit(1)),console.log(l.green(`\u2713 Node.js installed successfully
59
+ `)),await X(h)):(console.log(l.red("Cannot proceed without compatible Node.js version.")),process.exit(1))}}else{console.log(l.yellow(`\u26A0\uFE0F nvm is not installed on your system
60
+ `));let b=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"}]});b==="nvm"?(Ge(),console.log(l.yellow(`
193
61
  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(`
62
+ `)),process.exit(0)):b==="direct"?(process.platform!=="win32"&&(console.log(l.red("Direct installation is only supported on Windows.")),process.exit(1)),await Ue("LTS")||(console.log(l.red("Failed to install Node.js. Please install manually.")),process.exit(1)),console.log(l.yellow(`
195
63
  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(`
64
+ `)),process.exit(0)):(console.log(l.yellow(`Exiting. Please install a compatible Node.js version manually.
65
+ `)),process.exit(0))}s.projectName||(s.projectName=await ve({message:"Enter project name:",validate:a(m=>{if(!m)return"Project name is required";let b=Xe(m);return b===!0?!0:b},"validate")})),s.location||(await F({message:"Where would you like to create the project?",choices:[{name:"Current directory",value:"current"},{name:"Specify custom directory",value:"custom"}]})==="custom"?s.location=await ve({message:"Enter directory path:",default:process.cwd()}):s.location=process.cwd());let $=It.join(s.location,s.projectName);if(!s.options){let m=await E({message:"Enable routing?",default:!0}),b=await F({message:"Select stylesheet format:",choices:[{name:"css",value:"css"},{name:"scss",value:"scss"},{name:"sass",value:"sass"},{name:"less",value:"less"}]}),y=await E({message:"Enable strict mode?",default:!0}),h=await E({message:"Use standalone components?",default:!1});s.options={routing:m,style:b,strict:y,standalone:h}}if(!s.libraries){let m=await Be();s.libraries=[],m==="interactive"?s.libraries=await He(s.angularVersion):m==="manual"&&(s.libraries=await Ye(s.angularVersion))}if(s.features=[],await E({message:"Save this configuration as a profile?",default:!1})){let m=await ve({message:"Enter profile name:",validate:a(b=>b?!0:"Profile name is required","validate")});await we(m,s)}let{printKeyValue:v}=await Promise.resolve().then(()=>(S(),Y)),A=[["Project Name",l.green(s.projectName)],["Location",l.cyan($)],["Angular Version",l.green(s.angularVersion)],["Style",l.cyan(s.options.style)],["Routing",l.cyan(s.options.routing?"Yes":"No")],["Strict Mode",l.cyan(s.options.strict?"Yes":"No")],["Standalone",l.cyan(s.options.standalone?"Yes":"No")],["Libraries",l.cyan(s.libraries.length)]];v("\u{1F4CB} Project Configuration Summary",A),await E({message:"Create project with this configuration?",default:!0})||(console.log(l.yellow(`Project creation cancelled.
66
+ `)),process.exit(0)),console.log(l.bold.cyan(`
202
67
  \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(`
68
+ `));let K={...s.options,skipInstall:!0};if(await Ke(s.projectName,s.angularVersion,K)||(console.log(l.red("Failed to create Angular project.")),process.exit(1)),s.libraries.length>0){console.log(l.bold.cyan(`
204
69
  \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(`
70
+ `));let m=await Je(s.libraries,s.angularVersion),b=m.filter(w=>w.adjusted);if(b.length>0){let{printObjectList:w}=await Promise.resolve().then(()=>(S(),Y)),V=b.map(I=>({Package:I.name,From:I.originalVersion,To:I.version,Reason:I.reason||""}));console.log(l.green(`\u2713 Dynamically resolved compatible library versions:
71
+ `)),w("Resolved Library Versions",V,["Package","From","To","Reason"])}let y=m.filter(w=>w.warning);if(y.length>0){let{printObjectList:w}=await Promise.resolve().then(()=>(S(),Y)),V=y.map(I=>({Package:I.name,Version:I.version,Reason:I.reason||""}));console.log(l.yellow(`\u26A0\uFE0F Potential compatibility warnings:
72
+ `)),w("Compatibility Warnings",V,["Package","Version","Reason"])}let h=m.filter(w=>!w.isDev),L=m.filter(w=>w.isDev);if(h.length>0){console.log(l.bold.cyan(`\u{1F4E6} Installing production libraries...
73
+ `));let w=h.map(V=>V.version==="latest"?V.name:`${V.name}@${V.version}`);await ye(w,$)}if(L.length>0){console.log(l.bold.cyan(`\u{1F4E6} Installing dev libraries...
74
+ `));let w=L.map(V=>V.version==="latest"?V.name:`${V.name}@${V.version}`);await ye(w,$,!0)}}console.log(l.bold.cyan(`
210
75
  \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(`
76
+ `)),await qe($),console.log(l.bold.green(`
224
77
  \u2705 Project created successfully! \u{1F389}
225
- `)),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(`
78
+ `)),console.log(l.bold.cyan(`\u{1F4CA} Next Steps:
79
+ `)),console.log(l.gray("\u2501".repeat(50))),console.log(l.white("1. ")+l.cyan(`cd ${s.projectName}`)),console.log(l.white("2. ")+l.cyan("ng serve")),console.log(l.white("3. ")+l.cyan("Open http://localhost:4200 in your browser")),console.log(l.gray("\u2501".repeat(50))),console.log(l.bold.cyan(`
227
80
  \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(`
81
+ `)),console.log(l.gray(" ng generate component <name> ")+l.white("Create a component")),console.log(l.gray(" ng generate service <name> ")+l.white("Create a service")),console.log(l.gray(" ng build ")+l.white("Build for production")),console.log(l.gray(" ng test ")+l.white("Run unit tests")),console.log(l.gray(" ng help ")+l.white(`Get more help
82
+ `)),console.log(l.bold.green(`Happy coding! \u{1F680}
83
+ `))}catch(e){console.error(l.red(`
84
+ \u274C Error:`),e.message),process.exit(1)}}a(it,"runCli");S();import f from"chalk";import{readFileSync as Wt}from"fs";import{fileURLToPath as Jt}from"url";import{dirname as _t,join as Ut}from"path";var Gt=Jt(import.meta.url),qt=_t(Gt),Kt=JSON.parse(Wt(Ut(qt,"../package.json"),"utf-8")),_=new zt;_.name("ng-init").description("Angular project initializer with intelligent version management and automation").version(Kt.version);_.command("create",{isDefault:!0}).alias("new").description("Create a new Angular project with interactive setup").action(()=>{it()});var q=_.command("profile").description("Manage configuration profiles");q.command("list").description("List all saved profiles").action(async()=>{try{let e=await ae();if(e.length===0){console.log(f.yellow("No saved profiles found."));return}let t=[];for(let r of e){let n=await ot(r);t.push({Name:n.name,Angular:n.angularVersion||"-",Libraries:n.libraries||0,Created:n.createdAt||"-"})}C("Saved Profiles",t,["Name","Angular","Libraries","Created"])}catch(e){console.error(f.red("Error listing profiles:"),e.message)}});q.command("show <name>").description("Show details of a profile").action(async e=>{try{let t=await J(e);if(!t){console.log(f.red(`Profile "${e}" not found.`));return}ie(e,t)}catch(t){console.error(f.red("Error loading profile:"),t.message)}});q.command("delete <name>").description("Delete a profile").action(async e=>{try{await nt(e)}catch(t){console.error(f.red("Error deleting profile:"),t.message)}});q.command("export <name> <output>").description("Export a profile to a file").action(async(e,t)=>{try{await st(e,t)}catch(r){console.error(f.red("Error exporting profile:"),r.message)}});q.command("import <file>").description("Import a profile from a file").action(async e=>{try{await at(e)}catch(t){console.error(f.red("Error importing profile:"),t.message)}});_.command("check").description("Check system versions and compatibility").action(async()=>{try{let{displaySystemVersions:e}=await Promise.resolve().then(()=>(me(),je));await e()}catch(e){console.error(f.red("Error checking versions:"),e.message)}});_.command("examples").description("Show usage examples").action(()=>{console.log(f.bold.cyan(`
235
85
  \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);
86
+ `)),console.log(f.gray("\u2501".repeat(50))),console.log(f.white("Create new project (interactive):")),console.log(f.green(" $ ng-init")+f.gray(" or ")+f.green(`ng-init create
87
+ `)),console.log(f.white("Check system versions:")),console.log(f.green(` $ ng-init check
88
+ `)),console.log(f.white("List saved profiles:")),console.log(f.green(` $ ng-init profile list
89
+ `)),console.log(f.white("Show profile details:")),console.log(f.green(` $ ng-init profile show my-profile
90
+ `)),console.log(f.white("Delete a profile:")),console.log(f.green(` $ ng-init profile delete my-profile
91
+ `)),console.log(f.white("Export a profile:")),console.log(f.green(` $ ng-init profile export my-profile ./profile.json
92
+ `)),console.log(f.white("Import a profile:")),console.log(f.green(` $ ng-init profile import ./profile.json
93
+ `)),console.log(f.gray("\u2501".repeat(50))+`
94
+ `)});_.parse(process.argv);
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@jatinmourya/ng-init",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "description": "A comprehensive CLI tool to automate Angular project initialization with intelligent version management and prerequisite handling",
5
5
  "type": "module",
6
- "main": "dist/cli.js",
6
+ "main": "./dist/cli.js",
7
7
  "bin": {
8
8
  "ng-init": "./dist/cli.js"
9
9
  },
10
10
  "files": [
11
- "dist/",
11
+ "dist",
12
12
  "README.md",
13
13
  "LICENSE"
14
14
  ],
15
15
  "scripts": {
16
+ "lint": "eslint .",
16
17
  "build": "node build.js",
17
18
  "dev": "node build.js --watch",
18
19
  "clean": "rimraf dist",
@@ -21,24 +22,26 @@
21
22
  "keywords": [
22
23
  "angular",
23
24
  "cli",
25
+ "scaffold",
26
+ "generator",
24
27
  "automation",
25
- "project-generator",
26
- "scaffolding",
27
- "interactive",
28
28
  "boilerplate",
29
29
  "template",
30
- "development-tools"
30
+ "developer-tools"
31
31
  ],
32
- "author": "jatinmourya",
32
+ "author": "Jatin Mourya <https://github.com/jatinmourya>",
33
33
  "license": "MIT",
34
34
  "repository": {
35
35
  "type": "git",
36
- "url": "https://github.com/jatinmourya/ng-init.git"
36
+ "url": "git+https://github.com/jatinmourya/ng-init.git"
37
37
  },
38
38
  "bugs": {
39
39
  "url": "https://github.com/jatinmourya/ng-init/issues"
40
40
  },
41
41
  "homepage": "https://github.com/jatinmourya/ng-init#readme",
42
+ "engines": {
43
+ "node": ">=18"
44
+ },
42
45
  "dependencies": {
43
46
  "@inquirer/prompts": "^7.10.1",
44
47
  "axios": "^1.6.5",
@@ -47,10 +50,8 @@
47
50
  "execa": "^9.6.1",
48
51
  "lodash.debounce": "^4.0.8",
49
52
  "ora": "^8.0.1",
50
- "semver": "^7.5.4"
51
- },
52
- "engines": {
53
- "node": ">=18.0.0"
53
+ "semver": "^7.5.4",
54
+ "cli-table3": "^0.6.2"
54
55
  },
55
56
  "devDependencies": {
56
57
  "esbuild": "^0.27.2",
@@ -58,5 +59,8 @@
58
59
  },
59
60
  "publishConfig": {
60
61
  "access": "public"
62
+ },
63
+ "exports": {
64
+ ".": "./dist/cli.js"
61
65
  }
62
66
  }