@jatinmourya/ng-init 1.2.6 → 1.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Angular Project Automator 🚀
1
+ # Angular Project initialization Automator 🚀
2
2
 
3
3
  A comprehensive command-line interface (CLI) tool designed to automate and streamline the initialization of Angular projects with intelligent version management, interactive library search, and comprehensive prerequisite handling.
4
4
 
package/dist/cli.js ADDED
@@ -0,0 +1,244 @@
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(`
21
+ \u{1F4E6} Interactive Library Search
22
+ `)),e&&console.log(y.gray(`Angular version: ${e} (compatibility will be checked)
23
+ `)),console.log(y.gray(`Type to search npm packages. Press Enter to select.
24
+ `));t;)try{let r=await Et({message:"Search for a library:",source:s(async(o,{signal:l})=>!o||o.length<2?[]:(await pe(o,15)).map(c=>({name:Vt(c),value:c.name,description:c.description})),"source"),pageSize:10});if(r){let o=await Ne(r);if(o){console.log(y.green(`
25
+ \u2713 Selected: ${o.name}`)),console.log(y.gray(` Description: ${o.description}`)),console.log(y.gray(` Latest version: ${o.latestVersion}`)),console.log(y.gray(` Weekly downloads: ${de(o.weeklyDownloads)}`));let l=await _({message:"How would you like to select the version?",choices:[{name:`Use latest (${o.latestVersion})`,value:"latest"},{name:"Choose specific version (major.minor.patch)",value:"specific"},{name:"Enter version manually",value:"manual"}],default:"latest"}),i=o.latestVersion;if(l==="specific"){console.log(y.cyan(`
26
+ \u{1F4E6} Fetching versions for ${o.name}...
27
+ `));let c=await Ee(o.name);if(c.versions.length===0)console.log(y.yellow("Could not fetch versions. Using latest version.")),i=o.latestVersion;else{let p=Q(c.versions).map(b=>{let V=`${o.name} ${b}`;return{name:c.latest&&c.latest.startsWith(`${b}.`)?`${V} (latest)`:V,value:b}}),k=await _({message:`Select ${o.name} major version:`,choices:p,pageSize:15}),g=Z(c.versions,k).map(b=>({name:`v${b}.x`,value:b})),w=await _({message:`Select ${o.name} ${k} minor version:`,choices:g,pageSize:15}),C=ee(c.versions,w).map(b=>{let V=`v${b}`;return b===c.latest&&(V+=" (latest)"),b===c.lts&&(V+=" (LTS)"),{name:V,value:b}});i=await _({message:`Select ${o.name} ${w} patch version:`,choices:C,pageSize:15})}}else l==="manual"&&(i=await ge({message:"Enter version:",default:o.latestVersion,validate:s(c=>c?!0:"Version is required","validate")}));if(e&&i!=="latest"){console.log(y.cyan(`
28
+ \u{1F50D} Checking compatibility with Angular ${e}...
29
+ `));let c=await T(o.name,i,e);if(c.compatible)console.log(y.green(`\u2713 ${o.name}@${i} is compatible with Angular ${e}`)),c.peerDependency&&console.log(y.gray(` Peer dependency: ${c.peerDependency}
30
+ `));else if(console.log(y.red(`\u2717 ${o.name}@${i} may not be compatible with Angular ${e}`)),console.log(y.gray(` ${c.reason}
31
+ `)),await W({message:"Would you like to see compatible versions?",default:!0})){console.log(y.cyan(`
32
+ \u{1F50D} Dynamically searching for compatible versions...
33
+ `));let p=await Ge(o.name,e,10);if(p.length>0){let k=p.map(u=>({name:`${u.version}${u.peerDependency?` (peer: ${u.peerDependency})`:""}`,value:u.version}));k.push({name:"Keep selected version anyway",value:i}),i=await _({message:"Select a compatible version:",choices:k,pageSize:12})}else if(console.log(y.yellow("No compatible versions found automatically.")),!await W({message:"Continue with the selected version anyway?",default:!1})){console.log(y.yellow(`Skipping this library.
34
+ `)),t=await W({message:"Add another library?",default:!0});continue}}}n.push({name:o.name,version:i,description:o.description}),console.log(y.green(`\u2713 Added ${o.name}@${i} to installation queue
35
+ `))}}t=await W({message:"Add another library?",default:!1})}catch(r){console.error(y.red("Error during library search:",r.message)),t=!1}return n}s(Be,"interactiveLibrarySearch");function Vt(e){let n=de(e.weeklyDownloads||0),t=e.verified?" \u2713":"",r=e.description.substring(0,50)+(e.description.length>50?"...":"");return`${e.name}${t} - ${r} (v${e.version}, \u2B07 ${n}/week)`}s(Vt,"formatPackageChoice");async function He(e=null){let n=[],t=!0;for(console.log(y.bold.cyan(`
36
+ \u{1F4E6} Add Libraries
37
+ `)),e&&console.log(y.gray(`Angular version: ${e} (compatibility will be checked)
38
+ `));t;){let r=await ge({message:"Enter library name (or press Enter to skip):",validate:s(async l=>l?l.match(/^[@a-z0-9-~][a-z0-9-._~]*$/)?!0:"Invalid package name format":!0,"validate")});if(!r)break;let o=await ge({message:`Enter version for ${r} (or 'latest'):`,default:"latest"});if(e&&o!=="latest"){console.log(y.cyan(`
39
+ \u{1F50D} Checking compatibility with Angular ${e}...
40
+ `));let l=await T(r,o,e);l.compatible?(console.log(y.green(`\u2713 ${r}@${o} is compatible with Angular ${e}`)),l.peerDependency&&console.log(y.gray(` Peer dependency: ${l.peerDependency}
41
+ `))):(console.log(y.red(`\u2717 ${r}@${o} may not be compatible with Angular ${e}`)),console.log(y.gray(` ${l.reason}
42
+ `)),console.log(y.yellow(`\u26A0\uFE0F This may cause installation issues. Consider using a different version.
43
+ `)))}n.push({name:r,version:o}),console.log(y.green(`\u2713 Added ${r}@${o}
44
+ `)),t=await W({message:"Add another library?",default:!1})}return n}s(He,"simpleLibraryInput");async function qe(){return await _({message:"How would you like to add libraries?",choices:[{name:"Interactive search with autocomplete (Recommended)",value:"interactive"},{name:"Manual entry",value:"manual"},{name:"Choose from popular bundles",value:"bundles"},{name:"Skip for now",value:"skip"}],default:"interactive"})}s(qe,"askLibrarySearchPreference");var D={basic:{name:"Basic SPA",description:"Minimal setup with routing",options:{routing:!0,style:"css",strict:!1,standalone:!1},packages:[]},enterprise:{name:"Enterprise",description:"NgRx, Angular Material, strict mode, ESLint",options:{routing:!0,style:"scss",strict:!0,standalone:!1},packages:["@angular/material","@angular/cdk","@ngrx/store","@ngrx/effects","@ngrx/entity","@ngrx/store-devtools","eslint"],devPackages:["@typescript-eslint/eslint-plugin","@typescript-eslint/parser"]},pwa:{name:"PWA Ready",description:"Service workers, manifest, offline support",options:{routing:!0,style:"scss",strict:!0,standalone:!1},packages:["@angular/pwa","@angular/service-worker"]},material:{name:"Material Design",description:"Angular Material UI components",options:{routing:!0,style:"scss",strict:!1,standalone:!1},packages:["@angular/material","@angular/cdk"]},testing:{name:"Testing Ready",description:"Jest, Testing Library, Spectator",options:{routing:!0,style:"scss",strict:!0,standalone:!1},packages:["@testing-library/angular","@ngneat/spectator"],devPackages:["jest","@types/jest","jest-preset-angular"]},standalone:{name:"Standalone Components",description:"Modern Angular with standalone components",options:{routing:!0,style:"scss",strict:!0,standalone:!0},packages:[]}},me={uiFramework:{name:"UI Framework Bundle",description:"Angular Material + CDK",packages:[{name:"@angular/material",version:"latest"},{name:"@angular/cdk",version:"latest"}]},stateManagement:{name:"State Management Bundle",description:"NgRx + Entity + Effects + DevTools",packages:[{name:"@ngrx/store",version:"latest"},{name:"@ngrx/effects",version:"latest"},{name:"@ngrx/entity",version:"latest"},{name:"@ngrx/store-devtools",version:"latest"}]},forms:{name:"Form & Validation Bundle",description:"Reactive Forms utilities and validators",packages:[{name:"ngx-mask",version:"latest"},{name:"@angular/forms",version:"latest"}]},testing:{name:"Testing Bundle",description:"Jest + Testing Library + Spectator",packages:[],devPackages:[{name:"jest",version:"latest"},{name:"@types/jest",version:"latest"},{name:"jest-preset-angular",version:"latest"},{name:"@testing-library/angular",version:"latest"},{name:"@ngneat/spectator",version:"latest"}]},performance:{name:"Performance Bundle",description:"Angular Universal + optimization tools",packages:[{name:"@nguniversal/express-engine",version:"latest"}]},authentication:{name:"Authentication Bundle",description:"Auth utilities and Firebase",packages:[{name:"@angular/fire",version:"latest"},{name:"firebase",version:"latest"}]},utilities:{name:"Utilities Bundle",description:"Common utility libraries",packages:[{name:"lodash",version:"latest"},{name:"date-fns",version:"latest"},{name:"rxjs",version:"latest"}]},http:{name:"HTTP & API Bundle",description:"HTTP client and API tools",packages:[{name:"@angular/common",version:"latest"},{name:"axios",version:"latest"}]}},z={typescript:{name:"TypeScript Strict Mode",files:{"tsconfig.json":s(e=>({...e,compilerOptions:{...e.compilerOptions,strict:!0,noImplicitAny:!0,noImplicitReturns:!0,noFallthroughCasesInSwitch:!0,strictNullChecks:!0}}),"tsconfig.json")}},eslint:{name:"ESLint + Prettier",packages:["eslint","prettier","eslint-config-prettier","eslint-plugin-prettier"],files:{".eslintrc.json":{extends:["eslint:recommended","plugin:@typescript-eslint/recommended","prettier"],parser:"@typescript-eslint/parser",plugins:["@typescript-eslint","prettier"],rules:{"prettier/prettier":"error"}},".prettierrc":{semi:!0,singleQuote:!0,trailingComma:"es5",printWidth:100,tabWidth:2}}},husky:{name:"Husky Pre-commit Hooks",devPackages:["husky","lint-staged"],scripts:{prepare:"husky install","pre-commit":"lint-staged"},files:{".husky/pre-commit":`#!/bin/sh
45
+ . "$(dirname "$0")/_/husky.sh"
46
+
47
+ npx lint-staged`,"lint-staged.config.js":`module.exports = {
48
+ '*.{js,ts}': ['eslint --fix', 'prettier --write'],
49
+ '*.{json,md}': ['prettier --write']
50
+ };`}}},fe={standard:{name:"Standard Structure",folders:["src/app/core","src/app/core/services","src/app/core/guards","src/app/core/interceptors","src/app/shared","src/app/shared/components","src/app/shared/directives","src/app/shared/pipes","src/app/features","src/app/models","src/assets/images","src/assets/styles","src/environments"],files:{"src/app/core/README.md":`# Core Module
51
+
52
+ Singleton services, guards, and interceptors go here.`,"src/app/shared/README.md":`# Shared Module
53
+
54
+ Reusable components, directives, and pipes go here.`,"src/app/features/README.md":`# Features
55
+
56
+ Feature modules go here.`,"src/app/models/README.md":`# Models
57
+
58
+ TypeScript interfaces and types go here.`}},domain:{name:"Domain-Driven Structure",folders:["src/app/core","src/app/shared","src/app/domains","src/app/infrastructure"]}},ye={gitignore:`# See http://help.github.com/ignore-files/ for more about ignoring files.
59
+
60
+ # Compiled output
61
+ /dist
62
+ /tmp
63
+ /out-tsc
64
+ /bazel-out
65
+
66
+ # Node
67
+ /node_modules
68
+ npm-debug.log
69
+ yarn-error.log
70
+
71
+ # IDEs and editors
72
+ .idea/
73
+ .project
74
+ .classpath
75
+ .c9/
76
+ *.launch
77
+ .settings/
78
+ *.sublime-workspace
79
+
80
+ # Visual Studio Code
81
+ .vscode/*
82
+ !.vscode/settings.json
83
+ !.vscode/tasks.json
84
+ !.vscode/launch.json
85
+ !.vscode/extensions.json
86
+ .history/*
87
+
88
+ # Miscellaneous
89
+ /.angular/cache
90
+ .sass-cache/
91
+ /connect.lock
92
+ /coverage
93
+ /libpeerconnection.log
94
+ testem.log
95
+ /typings
96
+
97
+ # System files
98
+ .DS_Store
99
+ Thumbs.db
100
+
101
+ # Environment
102
+ .env
103
+ .env.local
104
+ `,initialCommitMessage:"Initial commit: Angular project setup"},he={readme:s((e,n)=>`# ${e}
105
+
106
+ ${n||"An Angular application"}
107
+
108
+ ## Description
109
+
110
+ This project was generated with Angular CLI.
111
+
112
+ ## Development server
113
+
114
+ Run \`ng serve\` for a dev server. Navigate to \`http://localhost:4200/\`. The application will automatically reload if you change any of the source files.
115
+
116
+ ## Code scaffolding
117
+
118
+ Run \`ng generate component component-name\` to generate a new component. You can also use \`ng generate directive|pipe|service|class|guard|interface|enum|module\`.
119
+
120
+ ## Build
121
+
122
+ Run \`ng build\` to build the project. The build artifacts will be stored in the \`dist/\` directory.
123
+
124
+ ## Running unit tests
125
+
126
+ Run \`ng test\` to execute the unit tests via your test runner.
127
+
128
+ ## Running end-to-end tests
129
+
130
+ Run \`ng e2e\` to execute the end-to-end tests via a platform of your choice.
131
+
132
+ ## Further help
133
+
134
+ To get more help on the Angular CLI use \`ng help\` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
135
+
136
+ ## Project Structure
137
+
138
+ \`\`\`
139
+ src/
140
+ \u251C\u2500\u2500 app/
141
+ \u2502 \u251C\u2500\u2500 core/ # Singleton services, guards
142
+ \u2502 \u251C\u2500\u2500 shared/ # Common components, pipes, directives
143
+ \u2502 \u251C\u2500\u2500 features/ # Feature modules
144
+ \u2502 \u251C\u2500\u2500 models/ # TypeScript interfaces/types
145
+ \u2502 \u2514\u2500\u2500 services/ # Business logic services
146
+ \`\`\`
147
+
148
+ ## Contributing
149
+
150
+ 1. Fork the repository
151
+ 2. Create your feature branch (\`git checkout -b feature/amazing-feature\`)
152
+ 3. Commit your changes (\`git commit -m 'Add some amazing feature'\`)
153
+ 4. Push to the branch (\`git push origin feature/amazing-feature\`)
154
+ 5. Open a Pull Request
155
+
156
+ ## License
157
+
158
+ This project is licensed under the MIT License.
159
+ `,"readme"),changelog:`# Changelog
160
+
161
+ All notable changes to this project will be documented in this file.
162
+
163
+ ## [Unreleased]
164
+
165
+ ### Added
166
+ - Initial project setup
167
+
168
+ ### Changed
169
+
170
+ ### Fixed
171
+
172
+ ### Removed
173
+ `};import I from"fs/promises";import L from"path";import x from"chalk";import{execa as we}from"execa";import ve from"ora";async function Ye(e){let n=ve("Initializing Git repository...").start();try{return await we("git",["init"],{cwd:e}),n.succeed("Git repository initialized"),!0}catch(t){return n.fail("Failed to initialize Git repository"),console.error(x.red(t.message)),!1}}s(Ye,"initGitRepo");async function Ke(e,n){try{let t=L.join(e,".gitignore");return await I.writeFile(t,n,"utf-8"),console.log(x.green("\u2713 Created .gitignore")),!0}catch(t){return console.error(x.red("Failed to create .gitignore:"),t.message),!1}}s(Ke,"createGitignore");async function Xe(e,n){let t=ve("Creating initial commit...").start();try{return await we("git",["add","."],{cwd:e}),await we("git",["commit","-m",n],{cwd:e}),t.succeed("Initial commit created"),!0}catch(r){return t.fail("Failed to create initial commit"),console.error(x.red(r.message)),!1}}s(Xe,"createInitialCommit");async function Qe(e,n){let t=ve("Creating project structure...").start();try{for(let r of n){let o=L.join(e,r);await I.mkdir(o,{recursive:!0})}return t.succeed("Project structure created"),!0}catch(r){return t.fail("Failed to create project structure"),console.error(x.red(r.message)),!1}}s(Qe,"createProjectFolders");async function be(e,n){try{for(let[t,r]of Object.entries(n)){let o=L.join(e,t),l=L.dirname(o);await I.mkdir(l,{recursive:!0});let i=typeof r=="string"?r:JSON.stringify(r,null,2);await I.writeFile(o,i,"utf-8")}return console.log(x.green(`\u2713 Created ${Object.keys(n).length} file(s)`)),!0}catch(t){return console.error(x.red("Failed to create project files:"),t.message),!1}}s(be,"createProjectFiles");async function Ze(e,n){try{let t=L.join(e,"README.md");return await I.writeFile(t,n,"utf-8"),console.log(x.green("\u2713 Created README.md")),!0}catch(t){return console.error(x.red("Failed to create README.md:"),t.message),!1}}s(Ze,"createReadme");async function et(e,n){try{let t=L.join(e,"CHANGELOG.md");return await I.writeFile(t,n,"utf-8"),console.log(x.green("\u2713 Created CHANGELOG.md")),!0}catch(t){return console.error(x.red("Failed to create CHANGELOG.md:"),t.message),!1}}s(et,"createChangelog");function tt(e){return/[<>:"|?*\x00-\x1f]/.test(e)?"Directory name contains invalid characters":["CON","PRN","AUX","NUL","COM1","COM2","COM3","COM4","COM5","COM6","COM7","COM8","COM9","LPT1","LPT2","LPT3","LPT4","LPT5","LPT6","LPT7","LPT8","LPT9"].includes(e.toUpperCase())?"Directory name is reserved":e.length===0?"Directory name cannot be empty":e.length>255?"Directory name is too long":e.endsWith(" ")||e.endsWith(".")?"Directory name cannot end with a space or period":!0}s(tt,"validateDirectoryName");async function nt(e,n){try{let t=L.join(e,"package.json"),r=JSON.parse(await I.readFile(t,"utf-8"));return r.scripts={...r.scripts,...n},await I.writeFile(t,JSON.stringify(r,null,2),"utf-8"),console.log(x.green("\u2713 Updated package.json scripts")),!0}catch(t){return console.error(x.red("Failed to update package.json:"),t.message),!1}}s(nt,"updatePackageJsonScripts");import B from"fs/promises";import rt from"path";import{homedir as Dt}from"os";import h from"chalk";var ot=rt.join(Dt(),".ng-init"),st=rt.join(ot,"profiles.json");async function at(){try{return await B.mkdir(ot,{recursive:!0}),!0}catch(e){return console.error(h.red("Failed to create profiles directory:"),e.message),!1}}s(at,"ensureProfilesDirectory");async function ne(){try{await at();let e=await B.readFile(st,"utf-8");return JSON.parse(e)}catch{return{}}}s(ne,"loadProfiles");async function it(e){try{return await at(),await B.writeFile(st,JSON.stringify(e,null,2),"utf-8"),!0}catch(n){return console.error(h.red("Failed to save profiles:"),n.message),!1}}s(it,"saveProfiles");async function $e(e,n){let t=await ne();t[e]={...n,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};let r=await it(t);return r&&console.log(h.green(`\u2713 Profile "${e}" saved successfully`)),r}s($e,"saveProfile");async function H(e){return(await ne())[e]||null}s(H,"loadProfile");async function lt(e){let n=await ne();if(!n[e])return console.log(h.yellow(`Profile "${e}" not found`)),!1;delete n[e];let t=await it(n);return t&&console.log(h.green(`\u2713 Profile "${e}" deleted successfully`)),t}s(lt,"deleteProfile");async function re(){let e=await ne();return Object.keys(e)}s(re,"listProfiles");async function ct(e,n){let t=await H(e);if(!t)return console.log(h.red(`Profile "${e}" not found`)),!1;try{let r={name:e,profile:t,exportedAt:new Date().toISOString(),version:"1.0.0"};return await B.writeFile(n,JSON.stringify(r,null,2),"utf-8"),console.log(h.green(`\u2713 Profile exported to ${n}`)),!0}catch(r){return console.error(h.red("Failed to export profile:"),r.message),!1}}s(ct,"exportProfile");async function ut(e){try{let n=await B.readFile(e,"utf-8"),t=JSON.parse(n);if(!t.name||!t.profile)return console.log(h.red("Invalid profile file format")),!1;let r=await $e(t.name,t.profile);return r&&console.log(h.green(`\u2713 Profile "${t.name}" imported successfully`)),r}catch(n){return console.error(h.red("Failed to import profile:"),n.message),!1}}s(ut,"importProfile");function oe(e,n){console.log(h.bold.cyan(`
174
+ \u{1F4CB} Profile: ${e}
175
+ `)),console.log(h.gray("\u2501".repeat(50))),n.angularVersion&&console.log(h.white("Angular Version: ")+h.green(n.angularVersion)),n.template&&console.log(h.white("Template: ")+h.cyan(n.template)),n.libraries&&n.libraries.length>0&&(console.log(h.white("Libraries: ")+h.cyan(n.libraries.length)),n.libraries.slice(0,5).forEach(t=>{console.log(h.gray(` \u2022 ${t.name}@${t.version}`))}),n.libraries.length>5&&console.log(h.gray(` ... and ${n.libraries.length-5} more`))),n.options&&(console.log(h.white("Options:")),Object.entries(n.options).forEach(([t,r])=>{console.log(h.gray(` \u2022 ${t}: ${r}`))})),n.createdAt&&console.log(h.white("Created: ")+h.gray(new Date(n.createdAt).toLocaleString())),console.log(h.gray("\u2501".repeat(50))+`
176
+ `)}s(oe,"displayProfileInfo");import{readFileSync as Rt}from"fs";import{fileURLToPath as Mt}from"url";import{dirname as Ft,join as Tt}from"path";var Ot=Mt(import.meta.url),_t=Ft(Ot),Gt=JSON.parse(Rt(Tt(_t,"../package.json"),"utf-8"));async function dt(){try{console.log(a.bold.cyan(`
177
+ \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557`)),console.log(a.bold.cyan(`\u2551 Angular Project Automation CLI v${Gt.version.padEnd(13)}\u2551`)),console.log(a.bold.cyan(`\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
178
+ `));let e=await ie(),n=await E({message:"Would you like to use a saved profile?",default:!1}),t={};if(n){let u=await re();if(u.length===0)console.log(a.yellow(`No saved profiles found. Continuing with manual setup...
179
+ `));else{let g=await A({message:"Select a profile:",choices:u.map(C=>({name:C,value:C}))}),w=await H(g);oe(g,w),await E({message:"Use this profile?",default:!0})&&(t=w)}}if(!t.angularVersion){console.log(a.bold.cyan(`
180
+ \u{1F4E6} Fetching Angular versions...
181
+ `));let u=await Ie();u.versions.length===0&&(console.log(a.red("Failed to fetch Angular versions. Please check your internet connection.")),process.exit(1));let w=Q(u.versions).map(S=>{let R=`Angular ${S}`;return{name:u.latest&&u.latest.startsWith(`${S}.`)?`${R} (latest)`:R,value:S}}),v=await A({message:"Select Angular major version:",choices:w,pageSize:15}),f=Z(u.versions,v).map(S=>({name:`v${S}.x`,value:S})),b=await A({message:`Select Angular ${v} minor version:`,choices:f,pageSize:15}),Pe=ee(u.versions,b).map(S=>{let R=`v${S}`;return S===u.latest&&(R+=" (latest)"),S===u.lts&&(R+=" (LTS)"),{name:R,value:S}}),gt=await A({message:`Select Angular ${b} patch version:`,choices:Pe,pageSize:15});t.angularVersion=gt}console.log(a.green(`
182
+ \u2713 Selected Angular version: ${t.angularVersion}
183
+ `));let r=await Ve(t.angularVersion),o=await Y(),l=Re(o,r);if(Me(l),!l.compatible)if(console.log(a.yellow(`\u26A0\uFE0F Node.js version incompatibility detected!
184
+ `)),await ae()){console.log(a.cyan(`\u2713 nvm detected on your system
185
+ `));let g=await le(),w=Fe(g,r);if(w.length>0){console.log(a.green(`Found ${w.length} compatible Node version(s) installed:
186
+ `));let v=await A({message:"Select Node version to switch to:",choices:w.map(f=>({name:`v${f}`,value:f}))});console.log(a.cyan(`
187
+ Switching to Node.js v${v}...
188
+ `)),await K(v)||(console.log(a.red("Failed to switch Node version. Please try manually.")),process.exit(1)),console.log(a.green(`\u2713 Node version switched successfully
189
+ `))}else{console.log(a.yellow(`No compatible Node versions installed.
190
+ `));let v=Te(r);await E({message:`Install Node.js v${v}?`,default:!0})?(await ce(v)||(console.log(a.red("Failed to install Node version.")),process.exit(1)),console.log(a.green(`\u2713 Node.js installed successfully
191
+ `)),await K(v)):(console.log(a.red("Cannot proceed without compatible Node.js version.")),process.exit(1))}}else{console.log(a.yellow(`\u26A0\uFE0F nvm is not installed on your system
192
+ `));let g=await A({message:"How would you like to proceed?",choices:[{name:"Install nvm (Recommended)",value:"nvm"},{name:"Install Node.js directly (Windows only)",value:"direct"},{name:"Exit and install manually",value:"exit"}]});g==="nvm"?(Je(),console.log(a.yellow(`
193
+ 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(`
195
+ Please restart your terminal and run this CLI again.
196
+ `)),process.exit(0)):(console.log(a.yellow(`Exiting. Please install a compatible Node.js version manually.
197
+ `)),process.exit(0))}t.projectName||(t.projectName=await ke({message:"Enter project name:",validate:s(u=>{if(!u)return"Project name is required";let g=tt(u);return g===!0?!0:g},"validate")})),t.location||(await A({message:"Where would you like to create the project?",choices:[{name:"Current directory",value:"current"},{name:"Specify custom directory",value:"custom"}]})==="custom"?t.location=await ke({message:"Enter directory path:",default:process.cwd()}):t.location=process.cwd());let i=Lt.join(t.location,t.projectName);if(!t.template)if(t.template=await A({message:"Select project template:",choices:[...Object.entries(D).map(([u,g])=>({name:`${g.name} - ${g.description}`,value:u})),{name:"Custom (configure manually)",value:"custom"}]}),t.template==="custom"){let u=await E({message:"Enable routing?",default:!0}),g=await A({message:"Select stylesheet format:",choices:[{name:"css",value:"css"},{name:"scss",value:"scss"},{name:"sass",value:"sass"},{name:"less",value:"less"}]}),w=await E({message:"Enable strict mode?",default:!0}),v=await E({message:"Use standalone components?",default:!1});t.options={routing:u,style:g,strict:w,standalone:v}}else t.options=D[t.template].options;if(!t.libraries){let u=await qe();if(t.libraries=[],u==="interactive")t.libraries=await Be(t.angularVersion);else if(u==="manual")t.libraries=await He(t.angularVersion);else if(u==="bundles"){let g=await pt({message:"Select library bundles:",choices:Object.entries(me).map(([w,v])=>({name:`${v.name} - ${v.description}`,value:w}))});for(let w of g){let v=me[w];v.packages&&t.libraries.push(...v.packages),v.devPackages&&t.libraries.push(...v.devPackages.map(C=>({...C,isDev:!0})))}}if(t.template!=="custom"&&D[t.template].packages){let g=D[t.template].packages.map(w=>({name:w,version:"latest"}));t.libraries.push(...g)}if(t.template!=="custom"&&D[t.template].devPackages){let g=D[t.template].devPackages.map(w=>({name:w,version:"latest",isDev:!0}));t.libraries.push(...g)}}if(t.features||(t.features=await pt({message:"Select additional features:",choices:[{name:"Git initialization",value:"git",checked:!0},{name:"Create project structure",value:"structure",checked:!0},{name:"Generate README.md",value:"readme",checked:!0},{name:"Generate CHANGELOG.md",value:"changelog",checked:!1},{name:"ESLint + Prettier setup",value:"eslint",checked:!1},{name:"Husky pre-commit hooks",value:"husky",checked:!1}]})),await E({message:"Save this configuration as a profile?",default:!1})){let u=await ke({message:"Enter profile name:",validate:s(g=>g?!0:"Profile name is required","validate")});await $e(u,t)}console.log(a.bold.cyan(`
198
+ \u{1F4CB} Project Configuration Summary
199
+ `)),console.log(a.gray("\u2501".repeat(50))),console.log(a.white("Project Name: ")+a.green(t.projectName)),console.log(a.white("Location: ")+a.cyan(i)),console.log(a.white("Angular Version: ")+a.green(t.angularVersion)),console.log(a.white("Template: ")+a.cyan(t.template)),console.log(a.white("Libraries: ")+a.cyan(t.libraries.length)),console.log(a.white("Features: ")+a.cyan(t.features.join(", "))),console.log(a.gray("\u2501".repeat(50))+`
200
+ `),await E({message:"Create project with this configuration?",default:!0})||(console.log(a.yellow(`Project creation cancelled.
201
+ `)),process.exit(0)),console.log(a.bold.cyan(`
202
+ \u{1F680} Creating Angular project...
203
+ `));let p={...t.options,skipInstall:!0};if(await ze(t.projectName,t.angularVersion,p)||(console.log(a.red("Failed to create Angular project.")),process.exit(1)),t.libraries.length>0){console.log(a.bold.cyan(`
204
+ \u{1F4E6} Resolving library versions...
205
+ `));let u=await _e(t.libraries,t.angularVersion),g=u.filter(f=>f.adjusted);g.length>0&&(console.log(a.green(`\u2713 Dynamically resolved compatible library versions:
206
+ `)),g.forEach(f=>{console.log(a.gray(` ${f.name}: ${f.originalVersion} \u2192 ${f.version}`)),f.reason&&console.log(a.gray(` \u2514\u2500 ${f.reason}`))}),console.log(""));let w=u.filter(f=>f.warning);w.length>0&&(console.log(a.yellow(`\u26A0\uFE0F Potential compatibility warnings:
207
+ `)),w.forEach(f=>{console.log(a.yellow(` ${f.name}@${f.version}`)),f.reason&&console.log(a.gray(` \u2514\u2500 ${f.reason}`))}),console.log(""));let v=u.filter(f=>!f.isDev),C=u.filter(f=>f.isDev);if(v.length>0){console.log(a.bold.cyan(`\u{1F4E6} Installing production libraries...
208
+ `));let f=v.map(b=>b.version==="latest"?b.name:`${b.name}@${b.version}`);await J(f,i)}if(C.length>0){console.log(a.bold.cyan(`\u{1F4E6} Installing dev libraries...
209
+ `));let f=C.map(b=>b.version==="latest"?b.name:`${b.name}@${b.version}`);await J(f,i,!0)}}if(console.log(a.bold.cyan(`
210
+ \u{1F4E5} Installing dependencies...
211
+ `)),await We(i),t.features.includes("structure")&&(console.log(a.bold.cyan(`
212
+ \u{1F4C1} Creating project structure...
213
+ `)),await Qe(i,fe.standard.folders),await be(i,fe.standard.files)),t.features.includes("git")&&(console.log(a.bold.cyan(`
214
+ \u{1F527} Initializing Git repository...
215
+ `)),await Ye(i),await Ke(i,ye.gitignore)),t.features.includes("readme")){console.log(a.bold.cyan(`
216
+ \u{1F4DD} Generating README.md...
217
+ `));let u=he.readme(t.projectName,"An Angular application created with Angular Project Automator");await Ze(i,u)}if(t.features.includes("changelog")&&await et(i,he.changelog),t.features.includes("eslint")){console.log(a.bold.cyan(`
218
+ \u{1F527} Setting up ESLint + Prettier...
219
+ `));let u=z.eslint.packages.map(g=>g);await J(u,i,!0),await be(i,z.eslint.files)}if(t.features.includes("husky")){console.log(a.bold.cyan(`
220
+ \u{1F436} Setting up Husky...
221
+ `));let u=z.husky.devPackages.map(g=>g);await J(u,i,!0),await nt(i,z.husky.scripts)}t.features.includes("git")&&(console.log(a.bold.cyan(`
222
+ \u{1F4DD} Creating initial commit...
223
+ `)),await Xe(i,ye.initialCommitMessage)),console.log(a.bold.green(`
224
+ \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(`
227
+ \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(`
235
+ \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);
package/package.json CHANGED
@@ -1,40 +1,32 @@
1
1
  {
2
2
  "name": "@jatinmourya/ng-init",
3
- "version": "1.2.6",
4
- "main": "dist/index.js",
3
+ "version": "1.2.7",
5
4
  "description": "A comprehensive CLI tool to automate Angular project initialization with intelligent version management and prerequisite handling",
5
+ "type": "module",
6
+ "main": "dist/cli.js",
7
+ "bin": {
8
+ "ng-init": "./dist/cli.js"
9
+ },
6
10
  "files": [
7
11
  "dist/",
8
12
  "README.md",
9
13
  "LICENSE"
10
14
  ],
11
15
  "scripts": {
12
- "test": "echo \"Error: no test specified\" && exit 1",
13
- "start": "node src/index.js",
14
16
  "build": "node build.js",
15
- "prepublishOnly": "npm run build && npm run check-size",
16
- "check-size": "npm pack --dry-run",
17
- "check-contents": "npm pack && tar -tzf *.tgz && rm *.tgz"
18
- },
19
- "type": "module",
20
- "bin": {
21
- "ng-init": "./dist/index.js"
17
+ "dev": "node build.js --watch",
18
+ "clean": "rimraf dist",
19
+ "prepublishOnly": "npm run build"
22
20
  },
23
21
  "keywords": [
24
22
  "angular",
25
23
  "cli",
26
24
  "automation",
27
25
  "project-generator",
28
- "angular-cli",
29
26
  "scaffolding",
30
- "nvm",
31
- "node-version",
32
- "npm",
33
27
  "interactive",
34
- "project-setup",
35
28
  "boilerplate",
36
29
  "template",
37
- "angular-project",
38
30
  "development-tools"
39
31
  ],
40
32
  "author": "jatinmourya",
@@ -61,7 +53,8 @@
61
53
  "node": ">=18.0.0"
62
54
  },
63
55
  "devDependencies": {
64
- "esbuild": "^0.27.2"
56
+ "esbuild": "^0.27.2",
57
+ "rimraf": "^6.1.2"
65
58
  },
66
59
  "publishConfig": {
67
60
  "access": "public"
package/dist/index.js DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
- import{Command as l}from"commander";import{runCli as a}from"./runner.js";import{listProfiles as s,loadProfile as c,deleteProfile as p,displayProfileInfo as g,exportProfile as m,importProfile as f}from"./utils/profile-manager.js";import o from"chalk";import{readFileSync as d}from"fs";import{fileURLToPath as h}from"url";import{dirname as y,join as w}from"path";const u=h(import.meta.url),v=y(u),E=JSON.parse(d(w(v,"../package.json"),"utf-8")),i=new l;i.name("ng-init").description("Angular project initializer with intelligent version management and automation").version(E.version);i.command("create",{isDefault:!0}).alias("new").description("Create a new Angular project with interactive setup").action(()=>{a()});const n=i.command("profile").description("Manage configuration profiles");n.command("list").description("List all saved profiles").action(async()=>{try{const e=await s();if(e.length===0){console.log(o.yellow("No saved profiles found."));return}console.log(o.bold.cyan(`
3
- \u{1F4CB} Saved Profiles:
4
- `)),console.log(o.gray("\u2501".repeat(50))),e.forEach(r=>{console.log(o.white(" \u2022 ")+o.green(r))}),console.log(o.gray("\u2501".repeat(50))+`
5
- `)}catch(e){console.error(o.red("Error listing profiles:"),e.message)}});n.command("show <name>").description("Show details of a profile").action(async e=>{try{const r=await c(e);if(!r){console.log(o.red(`Profile "${e}" not found.`));return}g(e,r)}catch(r){console.error(o.red("Error loading profile:"),r.message)}});n.command("delete <name>").description("Delete a profile").action(async e=>{try{await p(e)}catch(r){console.error(o.red("Error deleting profile:"),r.message)}});n.command("export <name> <output>").description("Export a profile to a file").action(async(e,r)=>{try{await m(e,r)}catch(t){console.error(o.red("Error exporting profile:"),t.message)}});n.command("import <file>").description("Import a profile from a file").action(async e=>{try{await f(e)}catch(r){console.error(o.red("Error importing profile:"),r.message)}});i.command("check").description("Check system versions and compatibility").action(async()=>{try{const{displaySystemVersions:e}=await import("./utils/version-checker.js");await e()}catch(e){console.error(o.red("Error checking versions:"),e.message)}});i.command("examples").description("Show usage examples").action(()=>{console.log(o.bold.cyan(`
6
- \u{1F4DA} Usage Examples:
7
- `)),console.log(o.gray("\u2501".repeat(50))),console.log(o.white("Create new project (interactive):")),console.log(o.green(" $ ng-init")+o.gray(" or ")+o.green(`ng-init create
8
- `)),console.log(o.white("Check system versions:")),console.log(o.green(` $ ng-init check
9
- `)),console.log(o.white("List saved profiles:")),console.log(o.green(` $ ng-init profile list
10
- `)),console.log(o.white("Show profile details:")),console.log(o.green(` $ ng-init profile show my-profile
11
- `)),console.log(o.white("Delete a profile:")),console.log(o.green(` $ ng-init profile delete my-profile
12
- `)),console.log(o.white("Export a profile:")),console.log(o.green(` $ ng-init profile export my-profile ./profile.json
13
- `)),console.log(o.white("Import a profile:")),console.log(o.green(` $ ng-init profile import ./profile.json
14
- `)),console.log(o.gray("\u2501".repeat(50))+`
15
- `)});i.parse(process.argv);
package/dist/runner.js DELETED
@@ -1,56 +0,0 @@
1
- var R=Object.defineProperty;var y=(f,v)=>R(f,"name",{value:v,configurable:!0});import{select as m,input as P,confirm as d,checkbox as N}from"@inquirer/prompts";import e from"chalk";import F from"path";import{displaySystemVersions as G,getNodeVersion as T,isNvmInstalled as D,switchNodeVersion as S,installNodeVersion as M,getInstalledNodeVersions as O}from"./utils/version-checker.js";import{getAngularVersions as _,getNodeRequirementsForAngular as U,getMajorVersions as W,getMinorVersionsForMajor as z,getPatchVersionsForMinor as H}from"./utils/npm-search.js";import{checkNodeCompatibility as J,displayCompatibilityStatus as q,findCompatibleVersions as B,getRecommendedNodeVersion as K,resolveLibraryVersionsAsync as Y}from"./utils/compatibility.js";import{createAngularProject as Q,installPackages as h,runNpmInstall as X,installNodeWithWinget as Z,displayNvmInstallGuide as ee}from"./utils/installer.js";import{interactiveLibrarySearch as oe,simpleLibraryInput as ae,askLibrarySearchPreference as se}from"./utils/prompt-handler.js";import{PROJECT_TEMPLATES as p,LIBRARY_BUNDLES as k,CONFIG_PRESETS as w,PROJECT_STRUCTURE as V,GIT_CONFIG as C,DOC_TEMPLATES as $}from"./templates/templates.js";import{initGitRepo as te,createGitignore as ne,createInitialCommit as ie,createProjectFolders as le,createProjectFiles as E,createReadme as re,createChangelog as ce,validateDirectoryName as ge,updatePackageJsonScripts as me}from"./utils/file-utils.js";import{saveProfile as de,loadProfile as ue,listProfiles as pe,displayProfileInfo as fe}from"./utils/profile-manager.js";import{readFileSync as ye}from"fs";import{fileURLToPath as he}from"url";import{dirname as we,join as ve}from"path";const be=he(import.meta.url),Pe=we(be),je=JSON.parse(ye(ve(Pe,"../package.json"),"utf-8"));async function ze(){try{console.log(e.bold.cyan(`
2
- \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(e.bold.cyan(`\u2551 Angular Project Automation CLI v${je.version.padEnd(13)}\u2551`)),console.log(e.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
3
- `));const f=await G(),v=await d({message:"Would you like to use a saved profile?",default:!1});let o={};if(v){const a=await pe();if(a.length===0)console.log(e.yellow(`No saved profiles found. Continuing with manual setup...
4
- `));else{const s=await m({message:"Select a profile:",choices:a.map(g=>({name:g,value:g}))}),i=await ue(s);fe(s,i),await d({message:"Use this profile?",default:!0})&&(o=i)}}if(!o.angularVersion){console.log(e.bold.cyan(`
5
- \u{1F4E6} Fetching Angular versions...
6
- `));const a=await _();a.versions.length===0&&(console.log(e.red("Failed to fetch Angular versions. Please check your internet connection.")),process.exit(1));const i=W(a.versions).map(c=>{const u=`Angular ${c}`;return{name:a.latest&&a.latest.startsWith(`${c}.`)?`${u} (latest)`:u,value:c}}),n=await m({message:"Select Angular major version:",choices:i,pageSize:15}),t=z(a.versions,n).map(c=>({name:`v${c}.x`,value:c})),r=await m({message:`Select Angular ${n} minor version:`,choices:t,pageSize:15}),L=H(a.versions,r).map(c=>{let u=`v${c}`;return c===a.latest&&(u+=" (latest)"),c===a.lts&&(u+=" (LTS)"),{name:u,value:c}}),x=await m({message:`Select Angular ${r} patch version:`,choices:L,pageSize:15});o.angularVersion=x}console.log(e.green(`
7
- \u2713 Selected Angular version: ${o.angularVersion}
8
- `));const b=await U(o.angularVersion),I=await T(),j=J(I,b);if(q(j),!j.compatible)if(console.log(e.yellow(`\u26A0\uFE0F Node.js version incompatibility detected!
9
- `)),await D()){console.log(e.cyan(`\u2713 nvm detected on your system
10
- `));const s=await O(),i=B(s,b);if(i.length>0){console.log(e.green(`Found ${i.length} compatible Node version(s) installed:
11
- `));const n=await m({message:"Select Node version to switch to:",choices:i.map(t=>({name:`v${t}`,value:t}))});console.log(e.cyan(`
12
- Switching to Node.js v${n}...
13
- `)),await S(n)||(console.log(e.red("Failed to switch Node version. Please try manually.")),process.exit(1)),console.log(e.green(`\u2713 Node version switched successfully
14
- `))}else{console.log(e.yellow(`No compatible Node versions installed.
15
- `));const n=K(b);await d({message:`Install Node.js v${n}?`,default:!0})?(await M(n)||(console.log(e.red("Failed to install Node version.")),process.exit(1)),console.log(e.green(`\u2713 Node.js installed successfully
16
- `)),await S(n)):(console.log(e.red("Cannot proceed without compatible Node.js version.")),process.exit(1))}}else{console.log(e.yellow(`\u26A0\uFE0F nvm is not installed on your system
17
- `));const s=await m({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"}]});s==="nvm"?(ee(),console.log(e.yellow(`
18
- Please install nvm and run this CLI again.
19
- `)),process.exit(0)):s==="direct"?(process.platform!=="win32"&&(console.log(e.red("Direct installation is only supported on Windows.")),process.exit(1)),await Z("LTS")||(console.log(e.red("Failed to install Node.js. Please install manually.")),process.exit(1)),console.log(e.yellow(`
20
- Please restart your terminal and run this CLI again.
21
- `)),process.exit(0)):(console.log(e.yellow(`Exiting. Please install a compatible Node.js version manually.
22
- `)),process.exit(0))}o.projectName||(o.projectName=await P({message:"Enter project name:",validate:y(a=>{if(!a)return"Project name is required";const s=ge(a);return s===!0?!0:s},"validate")})),o.location||(await m({message:"Where would you like to create the project?",choices:[{name:"Current directory",value:"current"},{name:"Specify custom directory",value:"custom"}]})==="custom"?o.location=await P({message:"Enter directory path:",default:process.cwd()}):o.location=process.cwd());const l=F.join(o.location,o.projectName);if(!o.template)if(o.template=await m({message:"Select project template:",choices:[...Object.entries(p).map(([a,s])=>({name:`${s.name} - ${s.description}`,value:a})),{name:"Custom (configure manually)",value:"custom"}]}),o.template==="custom"){const a=await d({message:"Enable routing?",default:!0}),s=await m({message:"Select stylesheet format:",choices:[{name:"css",value:"css"},{name:"scss",value:"scss"},{name:"sass",value:"sass"},{name:"less",value:"less"}]}),i=await d({message:"Enable strict mode?",default:!0}),n=await d({message:"Use standalone components?",default:!1});o.options={routing:a,style:s,strict:i,standalone:n}}else o.options=p[o.template].options;if(!o.libraries){const a=await se();if(o.libraries=[],a==="interactive")o.libraries=await oe(o.angularVersion);else if(a==="manual")o.libraries=await ae(o.angularVersion);else if(a==="bundles"){const s=await N({message:"Select library bundles:",choices:Object.entries(k).map(([i,n])=>({name:`${n.name} - ${n.description}`,value:i}))});for(const i of s){const n=k[i];n.packages&&o.libraries.push(...n.packages),n.devPackages&&o.libraries.push(...n.devPackages.map(g=>({...g,isDev:!0})))}}if(o.template!=="custom"&&p[o.template].packages){const s=p[o.template].packages.map(i=>({name:i,version:"latest"}));o.libraries.push(...s)}if(o.template!=="custom"&&p[o.template].devPackages){const s=p[o.template].devPackages.map(i=>({name:i,version:"latest",isDev:!0}));o.libraries.push(...s)}}if(o.features||(o.features=await N({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 d({message:"Save this configuration as a profile?",default:!1})){const a=await P({message:"Enter profile name:",validate:y(s=>s?!0:"Profile name is required","validate")});await de(a,o)}console.log(e.bold.cyan(`
23
- \u{1F4CB} Project Configuration Summary
24
- `)),console.log(e.gray("\u2501".repeat(50))),console.log(e.white("Project Name: ")+e.green(o.projectName)),console.log(e.white("Location: ")+e.cyan(l)),console.log(e.white("Angular Version: ")+e.green(o.angularVersion)),console.log(e.white("Template: ")+e.cyan(o.template)),console.log(e.white("Libraries: ")+e.cyan(o.libraries.length)),console.log(e.white("Features: ")+e.cyan(o.features.join(", "))),console.log(e.gray("\u2501".repeat(50))+`
25
- `),await d({message:"Create project with this configuration?",default:!0})||(console.log(e.yellow(`Project creation cancelled.
26
- `)),process.exit(0)),console.log(e.bold.cyan(`
27
- \u{1F680} Creating Angular project...
28
- `));const A={...o.options,skipInstall:!0};if(await Q(o.projectName,o.angularVersion,A)||(console.log(e.red("Failed to create Angular project.")),process.exit(1)),o.libraries.length>0){console.log(e.bold.cyan(`
29
- \u{1F4E6} Resolving library versions...
30
- `));const a=await Y(o.libraries,o.angularVersion),s=a.filter(t=>t.adjusted);s.length>0&&(console.log(e.green(`\u2713 Dynamically resolved compatible library versions:
31
- `)),s.forEach(t=>{console.log(e.gray(` ${t.name}: ${t.originalVersion} \u2192 ${t.version}`)),t.reason&&console.log(e.gray(` \u2514\u2500 ${t.reason}`))}),console.log(""));const i=a.filter(t=>t.warning);i.length>0&&(console.log(e.yellow(`\u26A0\uFE0F Potential compatibility warnings:
32
- `)),i.forEach(t=>{console.log(e.yellow(` ${t.name}@${t.version}`)),t.reason&&console.log(e.gray(` \u2514\u2500 ${t.reason}`))}),console.log(""));const n=a.filter(t=>!t.isDev),g=a.filter(t=>t.isDev);if(n.length>0){console.log(e.bold.cyan(`\u{1F4E6} Installing production libraries...
33
- `));const t=n.map(r=>r.version==="latest"?r.name:`${r.name}@${r.version}`);await h(t,l)}if(g.length>0){console.log(e.bold.cyan(`\u{1F4E6} Installing dev libraries...
34
- `));const t=g.map(r=>r.version==="latest"?r.name:`${r.name}@${r.version}`);await h(t,l,!0)}}if(console.log(e.bold.cyan(`
35
- \u{1F4E5} Installing dependencies...
36
- `)),await X(l),o.features.includes("structure")&&(console.log(e.bold.cyan(`
37
- \u{1F4C1} Creating project structure...
38
- `)),await le(l,V.standard.folders),await E(l,V.standard.files)),o.features.includes("git")&&(console.log(e.bold.cyan(`
39
- \u{1F527} Initializing Git repository...
40
- `)),await te(l),await ne(l,C.gitignore)),o.features.includes("readme")){console.log(e.bold.cyan(`
41
- \u{1F4DD} Generating README.md...
42
- `));const a=$.readme(o.projectName,"An Angular application created with Angular Project Automator");await re(l,a)}if(o.features.includes("changelog")&&await ce(l,$.changelog),o.features.includes("eslint")){console.log(e.bold.cyan(`
43
- \u{1F527} Setting up ESLint + Prettier...
44
- `));const a=w.eslint.packages.map(s=>s);await h(a,l,!0),await E(l,w.eslint.files)}if(o.features.includes("husky")){console.log(e.bold.cyan(`
45
- \u{1F436} Setting up Husky...
46
- `));const a=w.husky.devPackages.map(s=>s);await h(a,l,!0),await me(l,w.husky.scripts)}o.features.includes("git")&&(console.log(e.bold.cyan(`
47
- \u{1F4DD} Creating initial commit...
48
- `)),await ie(l,C.initialCommitMessage)),console.log(e.bold.green(`
49
- \u2705 Project created successfully! \u{1F389}
50
- `)),console.log(e.bold.cyan(`\u{1F4CA} Next Steps:
51
- `)),console.log(e.gray("\u2501".repeat(50))),console.log(e.white("1. ")+e.cyan(`cd ${o.projectName}`)),console.log(e.white("2. ")+e.cyan("ng serve")),console.log(e.white("3. ")+e.cyan("Open http://localhost:4200 in your browser")),console.log(e.gray("\u2501".repeat(50))),console.log(e.bold.cyan(`
52
- \u{1F4A1} Useful Commands:
53
- `)),console.log(e.gray(" ng generate component <name> ")+e.white("Create a component")),console.log(e.gray(" ng generate service <name> ")+e.white("Create a service")),console.log(e.gray(" ng build ")+e.white("Build for production")),console.log(e.gray(" ng test ")+e.white("Run unit tests")),console.log(e.gray(" ng help ")+e.white(`Get more help
54
- `)),console.log(e.bold.green(`Happy coding! \u{1F680}
55
- `))}catch(f){console.error(e.red(`
56
- \u274C Error:`),f.message),process.exit(1)}}y(ze,"runCli");export{ze as runCli};
@@ -1,130 +0,0 @@
1
- var n=Object.defineProperty;var s=(e,t)=>n(e,"name",{value:t,configurable:!0});const a={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:[]}},i={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"}]}},o={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
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npx lint-staged`,"lint-staged.config.js":`module.exports = {
5
- '*.{js,ts}': ['eslint --fix', 'prettier --write'],
6
- '*.{json,md}': ['prettier --write']
7
- };`}}},l={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
8
-
9
- Singleton services, guards, and interceptors go here.`,"src/app/shared/README.md":`# Shared Module
10
-
11
- Reusable components, directives, and pipes go here.`,"src/app/features/README.md":`# Features
12
-
13
- Feature modules go here.`,"src/app/models/README.md":`# Models
14
-
15
- TypeScript interfaces and types go here.`}},domain:{name:"Domain-Driven Structure",folders:["src/app/core","src/app/shared","src/app/domains","src/app/infrastructure"]}},c={gitignore:`# See http://help.github.com/ignore-files/ for more about ignoring files.
16
-
17
- # Compiled output
18
- /dist
19
- /tmp
20
- /out-tsc
21
- /bazel-out
22
-
23
- # Node
24
- /node_modules
25
- npm-debug.log
26
- yarn-error.log
27
-
28
- # IDEs and editors
29
- .idea/
30
- .project
31
- .classpath
32
- .c9/
33
- *.launch
34
- .settings/
35
- *.sublime-workspace
36
-
37
- # Visual Studio Code
38
- .vscode/*
39
- !.vscode/settings.json
40
- !.vscode/tasks.json
41
- !.vscode/launch.json
42
- !.vscode/extensions.json
43
- .history/*
44
-
45
- # Miscellaneous
46
- /.angular/cache
47
- .sass-cache/
48
- /connect.lock
49
- /coverage
50
- /libpeerconnection.log
51
- testem.log
52
- /typings
53
-
54
- # System files
55
- .DS_Store
56
- Thumbs.db
57
-
58
- # Environment
59
- .env
60
- .env.local
61
- `,initialCommitMessage:"Initial commit: Angular project setup"},p={readme:s((e,t)=>`# ${e}
62
-
63
- ${t||"An Angular application"}
64
-
65
- ## Description
66
-
67
- This project was generated with Angular CLI.
68
-
69
- ## Development server
70
-
71
- 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.
72
-
73
- ## Code scaffolding
74
-
75
- 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\`.
76
-
77
- ## Build
78
-
79
- Run \`ng build\` to build the project. The build artifacts will be stored in the \`dist/\` directory.
80
-
81
- ## Running unit tests
82
-
83
- Run \`ng test\` to execute the unit tests via your test runner.
84
-
85
- ## Running end-to-end tests
86
-
87
- Run \`ng e2e\` to execute the end-to-end tests via a platform of your choice.
88
-
89
- ## Further help
90
-
91
- 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.
92
-
93
- ## Project Structure
94
-
95
- \`\`\`
96
- src/
97
- \u251C\u2500\u2500 app/
98
- \u2502 \u251C\u2500\u2500 core/ # Singleton services, guards
99
- \u2502 \u251C\u2500\u2500 shared/ # Common components, pipes, directives
100
- \u2502 \u251C\u2500\u2500 features/ # Feature modules
101
- \u2502 \u251C\u2500\u2500 models/ # TypeScript interfaces/types
102
- \u2502 \u2514\u2500\u2500 services/ # Business logic services
103
- \`\`\`
104
-
105
- ## Contributing
106
-
107
- 1. Fork the repository
108
- 2. Create your feature branch (\`git checkout -b feature/amazing-feature\`)
109
- 3. Commit your changes (\`git commit -m 'Add some amazing feature'\`)
110
- 4. Push to the branch (\`git push origin feature/amazing-feature\`)
111
- 5. Open a Pull Request
112
-
113
- ## License
114
-
115
- This project is licensed under the MIT License.
116
- `,"readme"),changelog:`# Changelog
117
-
118
- All notable changes to this project will be documented in this file.
119
-
120
- ## [Unreleased]
121
-
122
- ### Added
123
- - Initial project setup
124
-
125
- ### Changed
126
-
127
- ### Fixed
128
-
129
- ### Removed
130
- `};export{o as CONFIG_PRESETS,p as DOC_TEMPLATES,c as GIT_CONFIG,i as LIBRARY_BUNDLES,l as PROJECT_STRUCTURE,a as PROJECT_TEMPLATES};
@@ -1,4 +0,0 @@
1
- var A=Object.defineProperty;var i=(e,n)=>A(e,"name",{value:n,configurable:!0});import d from"semver";import l from"chalk";import g from"axios";const y="https://registry.npmjs.org",f=new Map,v=300*1e3,w=100;function _(e,n){try{return{compatible:d.satisfies(e,n),current:e,required:n}}catch(t){return{compatible:!1,current:e,required:n,error:t.message}}}i(_,"checkNodeCompatibility");function q(e){return console.log(l.bold.cyan(`
2
- \u{1F4CB} Compatibility Check
3
- `)),console.log(l.gray("\u2501".repeat(50))),console.log(l.white("Current Node.js: ")+l.cyan(`v${e.current}`)),console.log(l.white("Required Node.js: ")+l.cyan(e.required)),e.compatible?console.log(l.white("Status: ")+l.green("\u2713 Compatible")):console.log(l.white("Status: ")+l.red("\u2717 Incompatible")),console.log(l.gray("\u2501".repeat(50))+`
4
- `),e.compatible}i(q,"displayCompatibilityStatus");function E(e,n){try{return e.filter(t=>{try{return d.satisfies(t,n)}catch{return!1}}).sort((t,r)=>d.rcompare(t,r))}catch{return[]}}i(E,"findCompatibleVersions");function S(e){try{const n=e.split("||").map(t=>t.trim());for(const t of n){const r=t.match(/(\d+)\./);if(r){const 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"}}i(S,"getRecommendedNodeVersion");async function x(e){try{return((await g.get(`${y}/@angular/cli/${e}`,{timeout:5e3})).data.engines||{}).node||null}catch{return null}}i(x,"getAngularNodeCompatibility");const h={19:"^18.19.1 || ^20.11.1 || ^22.0.0",18:"^18.19.1 || ^20.11.1 || ^22.0.0",17:"^18.13.0 || ^20.9.0",16:"^16.14.0 || ^18.10.0",15:"^14.20.0 || ^16.13.0 || ^18.10.0",14:"^14.15.0 || ^16.10.0",13:"^12.20.0 || ^14.15.0 || ^16.10.0",12:"^12.20.0 || ^14.15.0",11:"^10.13.0 || ^12.11.0",10:"^10.13.0 || ^12.11.0"},T=h;async function V(e){const n=await x(e);if(n)return n;const t=e.split(".")[0];return h[t]||"^18.13.0 || ^20.9.0"}i(V,"getNodeRequirementFromMatrix");function N(e){return d.valid(e)!==null}i(N,"isValidAngularVersion");function O(e,n){if(!e)return{needed:!0,reason:"Angular CLI is not installed"};const t=parseInt(e.split(".")[0]),r=parseInt(n.split(".")[0]);return t!==r?{needed:!0,reason:`Angular CLI version mismatch (current: ${t}, target: ${r})`,suggestion:`Consider using npx @angular/cli@${n} instead`}:{needed:!1,reason:"Angular CLI version is compatible"}}i(O,"needsAngularCli");async function $(e){const n=e,t=f.get(n);if(t&&Date.now()-t.timestamp<v)return t.data;try{const o=(await g.get(`${y}/${encodeURIComponent(e)}`,{timeout:1e4})).data;if(f.size>=w){const s=f.keys().next().value;f.delete(s)}return f.set(n,{data:o,timestamp:Date.now()}),o}catch(r){return console.error(l.gray(`Could not fetch package data for ${e}: ${r.message}`)),null}}i($,"fetchPackageData");async function j(e,n){try{return(await g.get(`${y}/${encodeURIComponent(e)}/${n}`,{timeout:5e3})).data}catch{return null}}i(j,"fetchPackageVersionData");async function D(e,n){return(await j(e,n))?.peerDependencies||{}}i(D,"getPackagePeerDependencies");async function b(e,n,t){const r=await D(e,n),o=r["@angular/core"]||r["@angular/common"];if(!o)return{compatible:!0,reason:"No Angular peer dependency"};try{const s=d.satisfies(t,o);return{compatible:s,peerDependency:o,reason:s?`Angular ${t} satisfies ${o}`:`Angular ${t} does not satisfy ${o}`}}catch{const a=t.split(".")[0],m=[`^${a}.`,`~${a}.`,`>=${a}.`,`${a}.`].some(c=>o.includes(c));return{compatible:m,peerDependency:o,reason:m?`Peer dependency appears compatible with Angular ${a}`:`Peer dependency ${o} may not support Angular ${a}`}}}i(b,"isVersionCompatibleWithAngular");async function C(e,n,t=!0){const r=await $(e);if(!r)return{version:"latest",source:"fallback",reason:"Could not fetch package data"};const o=parseInt(n.split(".")[0]),s=Object.keys(r.versions||{}).filter(c=>!c.includes("rc")&&!c.includes("beta")&&!c.includes("alpha")&&!c.includes("next")).sort((c,p)=>d.rcompare(c,p));if(e.startsWith("@angular/")){const c=s.filter(p=>parseInt(p.split(".")[0])===o);if(c.length>0)return{version:`^${c[0]}`,source:"dynamic",reason:`Matched Angular major version ${o}`}}const a=[],u=s.slice(0,20);for(const c of u){const p=await b(e,c,n);if(p.compatible&&(a.push({version:c,peerDependency:p.peerDependency}),t))return{version:`^${c}`,source:"dynamic",reason:p.reason,peerDependency:p.peerDependency}}if(a.length>0){const c=a[0];return{version:`^${c.version}`,source:"dynamic",reason:`Found ${a.length} compatible version(s)`,peerDependency:c.peerDependency}}const m=r["dist-tags"]?.latest;return{version:m?`^${m}`:"latest",source:"fallback",reason:"No version with compatible Angular peer dependency found",warning:!0}}i(C,"findCompatibleLibraryVersion");async function U(e,n){return(await C(e,n)).version}i(U,"getCompatibleLibraryVersionAsync");function I(e,n){const t=n.split(".")[0];return e.startsWith("@angular/")?`^${t}.0.0`:e.startsWith("@ngrx/")?`^${t}.0.0`:"latest"}i(I,"getCompatibleLibraryVersion");async function W(e,n){const t=[];for(const r of e){const o=r.version||"latest";if(o==="latest"){const s=await C(r.name,n);t.push({...r,version:s.version,originalVersion:o,adjusted:s.source==="dynamic",source:s.source,reason:s.reason,warning:s.warning||!1})}else{const s=await b(r.name,o.replace(/[\^~]/,""),n);t.push({...r,adjusted:!1,compatible:s.compatible,reason:s.reason,warning:!s.compatible})}}return t}i(W,"resolveLibraryVersionsAsync");function F(e,n){return e.map(t=>{const r=t.version||"latest";if(r==="latest"){const o=I(t.name,n);return{...t,version:o,originalVersion:r,adjusted:o!=="latest"}}return{...t,adjusted:!1}})}i(F,"resolveLibraryVersions");function G(e,n){if(!e||e==="No Angular peer dependency")return{compatible:!0,reason:"No Angular peer dependency specified"};try{return d.satisfies(n,e)?{compatible:!0,reason:`Angular ${n} satisfies peer dependency '${e}'`}:{compatible:!1,reason:`Angular ${n} does not satisfy peer dependency '${e}'`}}catch{const r=n.split(".")[0];return[`^${r}.`,`~${r}.`,`>=${r}.`,`${r}.x`,`${r}.0.0`,` ${r}.`].some(a=>e.includes(a))?{compatible:!0,reason:`Peer dependency '${e}' appears compatible with Angular ${r}`}:{compatible:!1,reason:`Peer dependency '${e}' may not support Angular ${r}`}}}i(G,"checkLibraryCompatibility");async function K(e,n,t=10){const r=await $(e);if(!r)return[];const o=Object.keys(r.versions||{}).filter(a=>!a.includes("rc")&&!a.includes("beta")&&!a.includes("alpha")&&!a.includes("next")).sort((a,u)=>d.rcompare(a,u)),s=[];for(const a of o){if(s.length>=t)break;const u=await b(e,a,n);u.compatible&&s.push({version:a,peerDependency:u.peerDependency,reason:u.reason})}return s}i(K,"getAllCompatibleVersions");export{T as ANGULAR_NODE_COMPATIBILITY,G as checkLibraryCompatibility,_ as checkNodeCompatibility,q as displayCompatibilityStatus,C as findCompatibleLibraryVersion,E as findCompatibleVersions,K as getAllCompatibleVersions,x as getAngularNodeCompatibility,I as getCompatibleLibraryVersion,U as getCompatibleLibraryVersionAsync,V as getNodeRequirementFromMatrix,D as getPackagePeerDependencies,S as getRecommendedNodeVersion,N as isValidAngularVersion,b as isVersionCompatibleWithAngular,O as needsAngularCli,F as resolveLibraryVersions,W as resolveLibraryVersionsAsync};
@@ -1 +0,0 @@
1
- var g=Object.defineProperty;var n=(r,t)=>g(r,"name",{value:t,configurable:!0});import i from"fs/promises";import c from"path";import o from"chalk";import{execa as l}from"execa";import u from"ora";async function P(r){const t=u("Initializing Git repository...").start();try{return await l("git",["init"],{cwd:r}),t.succeed("Git repository initialized"),!0}catch(e){return t.fail("Failed to initialize Git repository"),console.error(o.red(e.message)),!1}}n(P,"initGitRepo");async function j(r,t){try{const e=c.join(r,".gitignore");return await i.writeFile(e,t,"utf-8"),console.log(o.green("\u2713 Created .gitignore")),!0}catch(e){return console.error(o.red("Failed to create .gitignore:"),e.message),!1}}n(j,"createGitignore");async function F(r,t){const e=u("Creating initial commit...").start();try{return await l("git",["add","."],{cwd:r}),await l("git",["commit","-m",t],{cwd:r}),e.succeed("Initial commit created"),!0}catch(a){return e.fail("Failed to create initial commit"),console.error(o.red(a.message)),!1}}n(F,"createInitialCommit");async function O(r,t){const e=u("Creating project structure...").start();try{for(const a of t){const s=c.join(r,a);await i.mkdir(s,{recursive:!0})}return e.succeed("Project structure created"),!0}catch(a){return e.fail("Failed to create project structure"),console.error(o.red(a.message)),!1}}n(O,"createProjectFolders");async function k(r,t){try{for(const[e,a]of Object.entries(t)){const s=c.join(r,e),d=c.dirname(s);await i.mkdir(d,{recursive:!0});const f=typeof a=="string"?a:JSON.stringify(a,null,2);await i.writeFile(s,f,"utf-8")}return console.log(o.green(`\u2713 Created ${Object.keys(t).length} file(s)`)),!0}catch(e){return console.error(o.red("Failed to create project files:"),e.message),!1}}n(k,"createProjectFiles");async function x(r,t){try{const e=c.join(r,"README.md");return await i.writeFile(e,t,"utf-8"),console.log(o.green("\u2713 Created README.md")),!0}catch(e){return console.error(o.red("Failed to create README.md:"),e.message),!1}}n(x,"createReadme");async function L(r,t){try{const e=c.join(r,"CHANGELOG.md");return await i.writeFile(e,t,"utf-8"),console.log(o.green("\u2713 Created CHANGELOG.md")),!0}catch(e){return console.error(o.red("Failed to create CHANGELOG.md:"),e.message),!1}}n(L,"createChangelog");async function J(r){try{return(await i.readdir(r)).length===0}catch{return!0}}n(J,"isDirectoryEmpty");async function M(r){try{return await i.mkdir(r,{recursive:!0}),!0}catch(t){return console.error(o.red("Failed to create directory:"),t.message),!1}}n(M,"ensureDirectory");function N(r){return/[<>:"|?*\x00-\x1f]/.test(r)?"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(r.toUpperCase())?"Directory name is reserved":r.length===0?"Directory name cannot be empty":r.length>255?"Directory name is too long":r.endsWith(" ")||r.endsWith(".")?"Directory name cannot end with a space or period":!0}n(N,"validateDirectoryName");async function D(r,t){try{const e=c.join(r,"package.json"),a=JSON.parse(await i.readFile(e,"utf-8"));return a.scripts={...a.scripts,...t},await i.writeFile(e,JSON.stringify(a,null,2),"utf-8"),console.log(o.green("\u2713 Updated package.json scripts")),!0}catch(e){return console.error(o.red("Failed to update package.json:"),e.message),!1}}n(D,"updatePackageJsonScripts");async function G(r){try{const t=c.join(r,"package.json"),e=await i.readFile(t,"utf-8");return JSON.parse(e)}catch{return null}}n(G,"readPackageJson");async function v(r,t){try{const e=c.join(r,"package.json");return await i.writeFile(e,JSON.stringify(t,null,2),"utf-8"),!0}catch(e){return console.error(o.red("Failed to write package.json:"),e.message),!1}}n(v,"writePackageJson");export{L as createChangelog,j as createGitignore,F as createInitialCommit,k as createProjectFiles,O as createProjectFolders,x as createReadme,M as ensureDirectory,P as initGitRepo,J as isDirectoryEmpty,G as readPackageJson,D as updatePackageJsonScripts,N as validateDirectoryName,v as writePackageJson};
@@ -1,11 +0,0 @@
1
- var u=Object.defineProperty;var o=(e,t)=>u(e,"name",{value:t,configurable:!0});import{execa as a}from"execa";import c from"ora";import n from"chalk";import{platform as d}from"os";async function v(e="LTS"){const t=c("Installing Node.js with winget...").start();try{return await a("winget",["install",e==="LTS"?"OpenJS.NodeJS.LTS":"OpenJS.NodeJS"],{stdio:"inherit"}),t.succeed("Node.js installed successfully"),!0}catch(s){return t.fail("Failed to install Node.js"),console.error(n.red(s.message)),!1}}o(v,"installNodeWithWinget");function g(){switch(d()){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"]}}}o(g,"getNvmInstallInstructions");function I(){const e=g();console.log(n.bold.yellow(`
2
- \u{1F4DA} NVM Installation Guide
3
- `)),console.log(n.gray("\u2501".repeat(50))),console.log(n.white("OS: ")+n.cyan(e.os)),e.download&&console.log(n.white("Download: ")+n.blue(e.download)),e.repo&&console.log(n.white("Repository: ")+n.blue(e.repo)),e.install&&(console.log(n.white(`
4
- Install Command:`)),console.log(n.green(` ${e.install}`))),e.alternative&&(console.log(n.white(`
5
- Alternative Command:`)),console.log(n.green(` ${e.alternative}`))),Array.isArray(e.steps)&&(console.log(n.white(`
6
- Steps:`)),e.steps.forEach((t,s)=>{console.log(n.gray(` ${s+1}. ${t}`))})),Array.isArray(e.postInstall)&&(console.log(n.white(`
7
- Post-Install:`)),e.postInstall.forEach((t,s)=>{console.log(n.gray(` ${s+1}. ${t}`))})),console.log(n.gray("\u2501".repeat(50))),console.log(n.yellow(`
8
- \u{1F4A1} Why use NVM?`)),console.log(n.gray(" \u2022 Manage multiple Node.js versions")),console.log(n.gray(" \u2022 Switch instantly")),console.log(n.gray(" \u2022 No sudo/admin required")),console.log(n.gray(` \u2022 Per-project Node versions
9
- `))}o(I,"displayNvmInstallGuide");async function p(e,t="latest"){const s=c(`Installing ${e}@${t}...`).start();try{const l=t==="latest"?e:`${e}@${t}`;return await a("npm",["install","-g",l],{stdio:"inherit"}),s.succeed(`${e} installed successfully`),!0}catch(l){return s.fail(`Failed to install ${e}`),console.error(n.red(l.message)),!1}}o(p,"installGlobalPackage");async function $(e,t,s=!1){const l=c(`Installing ${e.length} package(s)...`).start();try{const r=["install"];return s&&r.push("--save-dev"),r.push(...e),await a("npm",r,{cwd:t}),l.succeed("Packages installed successfully"),!0}catch{l.warn("Failed with strict dependencies, retrying with --legacy-peer-deps...");try{const i=["install","--legacy-peer-deps"];return s&&i.push("--save-dev"),i.push(...e),await a("npm",i,{cwd:t}),l.succeed("Packages installed successfully with --legacy-peer-deps"),console.log(n.yellow("\u26A0\uFE0F Note: Installed with --legacy-peer-deps flag due to peer dependency conflicts")),!0}catch(i){return l.fail("Failed to install packages"),console.error(n.red(i.message)),console.log(n.yellow(`
10
- \u{1F4A1} Tip: You can try installing manually with:`)),console.log(n.cyan(` cd ${t}`)),console.log(n.cyan(` npm install ${e.join(" ")} --force`)),!1}}}o($,"installPackages");async function b(e){try{return await a("npm",["init","-y"],{cwd:e,stdio:"inherit"}),!0}catch{return console.error(n.red("Failed to initialize npm project")),!1}}o(b,"initNpmProject");async function x(e){const t=c("Installing dependencies...").start();try{return await a("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 a("npm",["install","--legacy-peer-deps"],{cwd:e}),t.succeed("Dependencies installed successfully with --legacy-peer-deps"),console.log(n.yellow("\u26A0\uFE0F Note: Installed with --legacy-peer-deps flag due to peer dependency conflicts")),!0}catch(l){return t.fail("Failed to install dependencies"),console.error(n.red(l.message)),console.log(n.yellow(`
11
- \u{1F4A1} Tip: You can try installing manually with:`)),console.log(n.cyan(` cd ${e}`)),console.log(n.cyan(" npm install --force")),!1}}}o(x,"runNpmInstall");async function N(e="latest"){return p("@angular/cli",e)}o(N,"installAngularCli");async function S(e,t,s={}){const l=c(`Creating Angular project: ${e}...`).start();try{const r=["new",e];s.skipInstall&&r.push("--skip-install"),s.routing!==void 0&&r.push(`--routing=${s.routing}`),s.style&&r.push(`--style=${s.style}`),s.strict!==void 0&&r.push(`--strict=${s.strict}`),s.standalone!==void 0&&r.push(`--standalone=${s.standalone}`);const i=t?`@angular/cli@${t}`:"@angular/cli";return await a("npx",[i,...r],{stdio:"inherit"}),l.succeed(`Angular project ${e} created successfully`),!0}catch(r){return l.fail("Failed to create Angular project"),console.error(n.red(r.message)),!1}}o(S,"createAngularProject");export{S as createAngularProject,I as displayNvmInstallGuide,g as getNvmInstallInstructions,b as initNpmProject,N as installAngularCli,p as installGlobalPackage,v as installNodeWithWinget,$ as installPackages,x as runNpmInstall};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var l=(e,t)=>f(e,"name",{value:t,configurable:!0});import p from"axios";import h from"lodash.debounce";const g="https://registry.npmjs.org",y="https://registry.npmjs.org/-/v1/search",$="https://api.npmjs.org/downloads/point/last-week";async function b(e,t=10){try{return(await p.get(y,{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),[]}}l(b,"searchNpmPackages");async function m(e){try{const t=await p.get(`${g}/${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}}l(m,"getPackageDetails");async function x(e){try{return(await p.get(`${$}/${e}`,{timeout:5e3})).data.downloads}catch{return 0}}l(x,"getPackageDownloads");async function D(e){return await m(e)!==null}l(D,"validatePackage");async function M(e){try{const[t,r]=await Promise.all([m(e),x(e)]);return t?{...t,weeklyDownloads:r}:null}catch(t){return console.error(`Error getting package info for ${e}:`,t.message),null}}l(M,"getEnhancedPackageInfo");function N(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toString()}l(N,"formatDownloads");const E=h(async(e,t)=>{if(!e||e.length<2){t([]);return}const r=await b(e,10);t(r)},300);async function R(){try{const e=await p.get(`${g}/@angular/cli`,{timeout:1e4}),t=Object.keys(e.data.versions||{}).filter(n=>!n.includes("rc")&&!n.includes("beta")&&!n.includes("next")).sort((n,s)=>{const i=n.split(".").map(Number),c=s.split(".").map(Number);for(let o=0;o<Math.max(i.length,c.length);o++){const a=i[o]||0,u=c[o]||0;if(a!==u)return u-a}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}}}l(R,"getAngularVersions");function j(e){const t=new Set;return e.forEach(r=>{const n=r.split(".")[0];t.add(n)}),Array.from(t).sort((r,n)=>Number(n)-Number(r))}l(j,"getMajorVersions");function A(e,t){const r=new Set;return e.filter(n=>n.startsWith(`${t}.`)).forEach(n=>{const s=n.split("."),i=`${s[0]}.${s[1]}`;r.add(i)}),Array.from(r).sort((n,s)=>{const i=n.split(".").map(Number),c=s.split(".").map(Number);for(let o=0;o<Math.max(i.length,c.length);o++){const a=i[o]||0,u=c[o]||0;if(a!==u)return u-a}return 0})}l(A,"getMinorVersionsForMajor");function S(e,t){return e.filter(r=>r.startsWith(`${t}.`)).sort((r,n)=>{const s=r.split(".").map(Number),i=n.split(".").map(Number);for(let c=0;c<Math.max(s.length,i.length);c++){const o=s[c]||0,a=i[c]||0;if(o!==a)return a-o}return 0})}l(S,"getPatchVersionsForMinor");async function w(e){try{const t=await p.get(`${g}/${e}`,{timeout:1e4}),r=Object.keys(t.data.versions||{}).filter(s=>!s.includes("rc")&&!s.includes("beta")&&!s.includes("next")&&!s.includes("alpha")).sort((s,i)=>{const c=s.split(".").map(Number),o=i.split(".").map(Number);for(let a=0;a<Math.max(c.length,o.length);a++){const u=c[a]||0,d=o[a]||0;if(u!==d)return d-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}}}l(w,"getPackageVersions");async function _(e){try{return((await p.get(`${g}/@angular/cli/${e}`,{timeout:5e3})).data.engines||{}).node||"^18.13.0 || ^20.9.0"}catch{const r=parseInt(e.split(".")[0]);return r>=19?"^18.19.1 || ^20.11.1 || ^22.0.0":r>=17?"^18.13.0 || ^20.9.0":r>=16?"^16.14.0 || ^18.10.0":r>=15?"^14.20.0 || ^16.13.0 || ^18.10.0":r>=14?"^14.15.0 || ^16.10.0":"^14.0.0 || ^16.0.0 || ^18.0.0"}}l(_,"getNodeRequirementsForAngular");async function P(e,t){try{return(await p.get(`${g}/${e}/${t}`,{timeout:5e3})).data.peerDependencies||{}}catch(r){return console.error(`Error fetching peer dependencies for ${e}@${t}:`,r.message),{}}}l(P,"getPackagePeerDependencies");async function F(e,t,r=5){try{const n=await w(e),s=t.split(".")[0],i=[];for(const c of n.versions){if(i.length>=r)break;const o=await P(e,c);if(o["@angular/core"]||o["@angular/common"]){const a=o["@angular/core"]||o["@angular/common"];(a.includes(`^${s}.`)||a.includes(`~${s}.`)||a.includes(`>=${s}.`)||a.includes(`${s}.x`))&&i.push({version:c,peerDependency:a})}else i.push({version:c,peerDependency:"No Angular peer dependency"})}return i}catch(n){return console.error(`Error finding compatible versions for ${e}:`,n.message),[]}}l(F,"findCompatiblePackageVersions");export{E as debouncedSearch,F as findCompatiblePackageVersions,N as formatDownloads,R as getAngularVersions,M as getEnhancedPackageInfo,j as getMajorVersions,A as getMinorVersionsForMajor,_ as getNodeRequirementsForAngular,m as getPackageDetails,x as getPackageDownloads,P as getPackagePeerDependencies,w as getPackageVersions,S as getPatchVersionsForMinor,b as searchNpmPackages,D as validatePackage};
@@ -1,4 +0,0 @@
1
- var p=Object.defineProperty;var n=(r,e)=>p(r,"name",{value:e,configurable:!0});import a from"fs/promises";import l from"path";import{homedir as y}from"os";import o from"chalk";const c=l.join(y(),".ng-init"),f=l.join(c,"profiles.json");async function u(){try{return await a.mkdir(c,{recursive:!0}),!0}catch(r){return console.error(o.red("Failed to create profiles directory:"),r.message),!1}}n(u,"ensureProfilesDirectory");async function s(){try{await u();const r=await a.readFile(f,"utf-8");return JSON.parse(r)}catch{return{}}}n(s,"loadProfiles");async function g(r){try{return await u(),await a.writeFile(f,JSON.stringify(r,null,2),"utf-8"),!0}catch(e){return console.error(o.red("Failed to save profiles:"),e.message),!1}}n(g,"saveProfiles");async function w(r,e){const t=await s();t[r]={...e,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};const i=await g(t);return i&&console.log(o.green(`\u2713 Profile "${r}" saved successfully`)),i}n(w,"saveProfile");async function d(r){return(await s())[r]||null}n(d,"loadProfile");async function O(r){const e=await s();if(!e[r])return console.log(o.yellow(`Profile "${r}" not found`)),!1;delete e[r];const t=await g(e);return t&&console.log(o.green(`\u2713 Profile "${r}" deleted successfully`)),t}n(O,"deleteProfile");async function $(){const r=await s();return Object.keys(r)}n($,"listProfiles");async function b(r){const e=await d(r);return e?{name:r,angularVersion:e.angularVersion,template:e.template,libraries:e.libraries?.length||0,createdAt:e.createdAt,updatedAt:e.updatedAt}:null}n(b,"getProfileDetails");async function F(r,e){const t=await d(r);if(!t)return console.log(o.red(`Profile "${r}" not found`)),!1;try{const i={name:r,profile:t,exportedAt:new Date().toISOString(),version:"1.0.0"};return await a.writeFile(e,JSON.stringify(i,null,2),"utf-8"),console.log(o.green(`\u2713 Profile exported to ${e}`)),!0}catch(i){return console.error(o.red("Failed to export profile:"),i.message),!1}}n(F,"exportProfile");async function A(r){try{const e=await a.readFile(r,"utf-8"),t=JSON.parse(e);if(!t.name||!t.profile)return console.log(o.red("Invalid profile file format")),!1;const i=await w(t.name,t.profile);return i&&console.log(o.green(`\u2713 Profile "${t.name}" imported successfully`)),i}catch(e){return console.error(o.red("Failed to import profile:"),e.message),!1}}n(A,"importProfile");function D(r,e){console.log(o.bold.cyan(`
2
- \u{1F4CB} Profile: ${r}
3
- `)),console.log(o.gray("\u2501".repeat(50))),e.angularVersion&&console.log(o.white("Angular Version: ")+o.green(e.angularVersion)),e.template&&console.log(o.white("Template: ")+o.cyan(e.template)),e.libraries&&e.libraries.length>0&&(console.log(o.white("Libraries: ")+o.cyan(e.libraries.length)),e.libraries.slice(0,5).forEach(t=>{console.log(o.gray(` \u2022 ${t.name}@${t.version}`))}),e.libraries.length>5&&console.log(o.gray(` ... and ${e.libraries.length-5} more`))),e.options&&(console.log(o.white("Options:")),Object.entries(e.options).forEach(([t,i])=>{console.log(o.gray(` \u2022 ${t}: ${i}`))})),e.createdAt&&console.log(o.white("Created: ")+o.gray(new Date(e.createdAt).toLocaleString())),console.log(o.gray("\u2501".repeat(50))+`
4
- `)}n(D,"displayProfileInfo");export{O as deleteProfile,D as displayProfileInfo,F as exportProfile,b as getProfileDetails,A as importProfile,$ as listProfiles,d as loadProfile,s as loadProfiles,w as saveProfile};
@@ -1,25 +0,0 @@
1
- var A=Object.defineProperty;var m=(n,l)=>A(n,"name",{value:l,configurable:!0});import{search as C,select as p,input as f,confirm as y}from"@inquirer/prompts";import o from"chalk";import{searchNpmPackages as V,getEnhancedPackageInfo as D,formatDownloads as w,getPackageVersions as P,getMajorVersions as L,getMinorVersionsForMajor as E,getPatchVersionsForMinor as z}from"./npm-search.js";import{isVersionCompatibleWithAngular as $,getAllCompatibleVersions as j}from"./compatibility.js";async function _(n=null){const l=[];let c=!0;for(console.log(o.bold.cyan(`
2
- \u{1F4E6} Interactive Library Search
3
- `)),n&&console.log(o.gray(`Angular version: ${n} (compatibility will be checked)
4
- `)),console.log(o.gray(`Type to search npm packages. Press Enter to select.
5
- `));c;)try{const s=await C({message:"Search for a library:",source:m(async(e,{signal:i})=>!e||e.length<2?[]:(await V(e,15)).map(a=>({name:M(a),value:a.name,description:a.description})),"source"),pageSize:10});if(s){const e=await D(s);if(e){console.log(o.green(`
6
- \u2713 Selected: ${e.name}`)),console.log(o.gray(` Description: ${e.description}`)),console.log(o.gray(` Latest version: ${e.latestVersion}`)),console.log(o.gray(` Weekly downloads: ${w(e.weeklyDownloads)}`));const i=await p({message:"How would you like to select the version?",choices:[{name:`Use latest (${e.latestVersion})`,value:"latest"},{name:"Choose specific version (major.minor.patch)",value:"specific"},{name:"Enter version manually",value:"manual"}],default:"latest"});let t=e.latestVersion;if(i==="specific"){console.log(o.cyan(`
7
- \u{1F4E6} Fetching versions for ${e.name}...
8
- `));const a=await P(e.name);if(a.versions.length===0)console.log(o.yellow("Could not fetch versions. Using latest version.")),t=e.latestVersion;else{const h=L(a.versions).map(r=>{const d=`${e.name} ${r}`;return{name:a.latest&&a.latest.startsWith(`${r}.`)?`${d} (latest)`:d,value:r}}),g=await p({message:`Select ${e.name} major version:`,choices:h,pageSize:15}),k=E(a.versions,g).map(r=>({name:`v${r}.x`,value:r})),v=await p({message:`Select ${e.name} ${g} minor version:`,choices:k,pageSize:15}),S=z(a.versions,v).map(r=>{let d=`v${r}`;return r===a.latest&&(d+=" (latest)"),r===a.lts&&(d+=" (LTS)"),{name:d,value:r}});t=await p({message:`Select ${e.name} ${v} patch version:`,choices:S,pageSize:15})}}else i==="manual"&&(t=await f({message:"Enter version:",default:e.latestVersion,validate:m(a=>a?!0:"Version is required","validate")}));if(n&&t!=="latest"){console.log(o.cyan(`
9
- \u{1F50D} Checking compatibility with Angular ${n}...
10
- `));const a=await $(e.name,t,n);if(a.compatible)console.log(o.green(`\u2713 ${e.name}@${t} is compatible with Angular ${n}`)),a.peerDependency&&console.log(o.gray(` Peer dependency: ${a.peerDependency}
11
- `));else if(console.log(o.red(`\u2717 ${e.name}@${t} may not be compatible with Angular ${n}`)),console.log(o.gray(` ${a.reason}
12
- `)),await y({message:"Would you like to see compatible versions?",default:!0})){console.log(o.cyan(`
13
- \u{1F50D} Dynamically searching for compatible versions...
14
- `));const h=await j(e.name,n,10);if(h.length>0){const g=h.map(u=>({name:`${u.version}${u.peerDependency?` (peer: ${u.peerDependency})`:""}`,value:u.version}));g.push({name:"Keep selected version anyway",value:t}),t=await p({message:"Select a compatible version:",choices:g,pageSize:12})}else if(console.log(o.yellow("No compatible versions found automatically.")),!await y({message:"Continue with the selected version anyway?",default:!1})){console.log(o.yellow(`Skipping this library.
15
- `)),c=await y({message:"Add another library?",default:!0});continue}}}l.push({name:e.name,version:t,description:e.description}),console.log(o.green(`\u2713 Added ${e.name}@${t} to installation queue
16
- `))}}c=await y({message:"Add another library?",default:!1})}catch(s){console.error(o.red("Error during library search:",s.message)),c=!1}return l}m(_,"interactiveLibrarySearch");function M(n){const l=w(n.weeklyDownloads||0),c=n.verified?" \u2713":"",s=n.description.substring(0,50)+(n.description.length>50?"...":"");return`${n.name}${c} - ${s} (v${n.version}, \u2B07 ${l}/week)`}m(M,"formatPackageChoice");async function B(n=null){const l=[];let c=!0;for(console.log(o.bold.cyan(`
17
- \u{1F4E6} Add Libraries
18
- `)),n&&console.log(o.gray(`Angular version: ${n} (compatibility will be checked)
19
- `));c;){const s=await f({message:"Enter library name (or press Enter to skip):",validate:m(async i=>i?i.match(/^[@a-z0-9-~][a-z0-9-._~]*$/)?!0:"Invalid package name format":!0,"validate")});if(!s)break;const e=await f({message:`Enter version for ${s} (or 'latest'):`,default:"latest"});if(n&&e!=="latest"){console.log(o.cyan(`
20
- \u{1F50D} Checking compatibility with Angular ${n}...
21
- `));const i=await $(s,e,n);i.compatible?(console.log(o.green(`\u2713 ${s}@${e} is compatible with Angular ${n}`)),i.peerDependency&&console.log(o.gray(` Peer dependency: ${i.peerDependency}
22
- `))):(console.log(o.red(`\u2717 ${s}@${e} may not be compatible with Angular ${n}`)),console.log(o.gray(` ${i.reason}
23
- `)),console.log(o.yellow(`\u26A0\uFE0F This may cause installation issues. Consider using a different version.
24
- `)))}l.push({name:s,version:e}),console.log(o.green(`\u2713 Added ${s}@${e}
25
- `)),c=await y({message:"Add another library?",default:!1})}return l}m(B,"simpleLibraryInput");async function G(){return await p({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"})}m(G,"askLibrarySearchPreference");export{G as askLibrarySearchPreference,_ as interactiveLibrarySearch,B as simpleLibraryInput};
@@ -1,6 +0,0 @@
1
- var u=Object.defineProperty;var r=(t,n)=>u(t,"name",{value:n,configurable:!0});import{execa as o}from"execa";import e from"chalk";import a from"semver";async function m(){try{const{stdout:t}=await o("node",["--version"]);return t.trim().replace("v","")}catch{return null}}r(m,"getNodeVersion");async function d(){try{const{stdout:t}=await o("npm",["--version"]);return t.trim()}catch{return null}}r(d,"getNpmVersion");async function c(){try{const{stdout:t}=await o("nvm",["--version"],{shell:!0});return t.trim()}catch{return null}}r(c,"getNvmVersion");async function g(){return await c()!==null}r(g,"isNvmInstalled");async function p(){try{const{stdout:t}=await o("ng",["--version"],{shell:!0});return t.trim()||null}catch{return null}}r(p,"getAngularCliVersion");async function w(){console.log(e.bold.cyan(`
2
- \u{1F50D} System Environment Check
3
- `)),console.log(e.gray("\u2501".repeat(50)));const t=await m(),n=await d(),s=await c(),i=await p();return console.log(e.white("Node.js: ")+(t?e.green(`v${t}`):e.red("Not installed"))),console.log(e.white("npm: ")+(n?e.green(`v${n}`):e.red("Not installed"))),console.log(e.white("nvm: ")+(s?e.green(`v${s}`):e.yellow("Not installed"))),console.log(e.white("Angular CLI: ")+(i?e.green(`v${i}`):e.yellow("Not installed"))),console.log(e.gray("\u2501".repeat(50))+`
4
- `),{node:t,npm:n,nvm:s,angularCli:i}}r(w,"displaySystemVersions");async function V(){try{const{stdout:t}=await o("nvm",["list","available"],{shell:!0}),n=[],s=t.split(`
5
- `);for(const i of s){const l=i.match(/(\d+\.\d+\.\d+)/);l&&n.push(l[1])}return n}catch{return[]}}r(V,"getAvailableNodeVersions");async function x(){try{const{stdout:t}=await o("nvm",["list"],{shell:!0}),n=[],s=t.split(`
6
- `);for(const i of s){const l=i.match(/(\d+\.\d+\.\d+)/);l&&n.push(l[1])}return n}catch{return[]}}r(x,"getInstalledNodeVersions");async function N(t){try{return await o("nvm",["use",t],{shell:!0,stdio:"inherit"}),!0}catch{return!1}}r(N,"switchNodeVersion");async function C(t){try{return await o("nvm",["install",t],{shell:!0,stdio:"inherit"}),!0}catch{return!1}}r(C,"installNodeVersion");function $(t,n){return a.compare(t,n)}r($,"compareVersions");function b(t,n){return a.satisfies(t,n)}r(b,"satisfiesVersion");export{$ as compareVersions,w as displaySystemVersions,p as getAngularCliVersion,V as getAvailableNodeVersions,x as getInstalledNodeVersions,m as getNodeVersion,d as getNpmVersion,c as getNvmVersion,C as installNodeVersion,g as isNvmInstalled,b as satisfiesVersion,N as switchNodeVersion};