easy-devops 1.3.6 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/ui/assets/index-Bu7af-Kj.css +1 -0
- package/dist/ui/assets/index-gndgYe3K.js +532 -0
- package/dist/ui/assets/socket-Bv0wCEgi.js +65 -0
- package/dist/ui/index.html +2 -2
- package/package.json +2 -2
- package/src/cli/index.js +8 -0
- package/src/cli/managers/domain-manager.js +37 -6
- package/src/cli/managers/nginx-manager.js +14 -5
- package/src/cli/managers/node-manager.js +19 -13
- package/src/cli/managers/ssl-manager.js +89 -26
- package/src/cli/menu.js +8 -2
- package/src/cli/menus/cleanup.js +4 -2
- package/src/cli/menus/dashboard.js +22 -15
- package/src/cli/menus/hub.js +381 -0
- package/src/cli/menus/runtime.js +12 -0
- package/src/cli/menus/service.js +28 -10
- package/src/cli/menus/settings.js +46 -12
- package/src/cli/menus/uninstall.js +13 -5
- package/src/cli/menus/update.js +24 -14
- package/src/cli/ui/page.js +123 -0
- package/src/core/cert-operations.js +34 -4
- package/src/core/cert-reader.js +67 -22
- package/src/core/cert-renewal.js +65 -9
- package/src/core/cert-suggest.js +120 -0
- package/src/core/cleanup.js +221 -1
- package/src/core/cloudflare-ips.js +161 -0
- package/src/core/daemon/ipc.js +1 -1
- package/src/core/daemon/lock.js +296 -9
- package/src/core/dashboardProcess.js +134 -6
- package/src/core/deploy/apps.js +36 -62
- package/src/core/deploy/deployKey.js +331 -0
- package/src/core/deploy/domainLink.js +280 -23
- package/src/core/deploy/engine.js +382 -63
- package/src/core/deploy/ezfile.js +496 -29
- package/src/core/deploy/githubApi.js +100 -13
- package/src/core/deploy/hubCommands.js +158 -18
- package/src/core/deploy/status.js +28 -1
- package/src/core/domains-db.js +1 -0
- package/src/core/hub/agent.js +238 -32
- package/src/core/hub/deployProgress.js +411 -0
- package/src/core/hubConnect.js +205 -0
- package/src/core/hubPermissions.js +48 -10
- package/src/core/jobs/bus.js +1 -1
- package/src/core/jobs/owner.js +268 -6
- package/src/core/nginx-conf-generator.js +124 -19
- package/src/core/notifications/claim.js +26 -3
- package/src/core/permissions.js +277 -59
- package/src/core/platform.js +48 -2
- package/src/core/runner.js +96 -40
- package/src/core/ssl/preflight.js +548 -0
- package/src/core/ssl/progress.js +196 -0
- package/src/core/ssl-issuer.js +502 -148
- package/src/core/validators.js +24 -0
- package/src/dashboard/controllers/authController.js +12 -5
- package/src/dashboard/controllers/deploymentsController.js +76 -11
- package/src/dashboard/controllers/domainsController.js +35 -1
- package/src/dashboard/controllers/hubController.js +4 -3
- package/src/dashboard/controllers/settingsController.js +73 -68
- package/src/dashboard/controllers/sslController.js +135 -15
- package/src/dashboard/public/js/app.js +42 -7
- package/src/dashboard/routes/deployments.js +2 -0
- package/src/dashboard/routes/domains.js +1 -0
- package/src/dashboard/server.js +42 -7
- package/src/dashboard/socketManager.js +19 -25
- package/src/dashboard/views/partials/settings-panel.ejs +29 -10
- package/dist/ui/assets/index-BUpPxWmp.css +0 -1
- package/dist/ui/assets/index-DD0JjK0Q.js +0 -475
- package/dist/ui/assets/socket-4tfdap-e.js +0 -65
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import"./index-gndgYe3K.js";const w=new Set;function L(e){return w.add(e),()=>{w.delete(e)}}const u=e=>new Date(Date.now()+e*864e5).toISOString(),H=()=>({nginx_down:{enabled:!0,channelIds:[]},cert_expiry:{enabled:!0,channelIds:[]},domain_health:{enabled:!0,channelIds:[]}});function h(e){const t=u(-40);return{backendHost:"127.0.0.1",upstreamType:"http",www:!1,wildcard:!1,enabled:!0,configFile:`/etc/nginx/conf.d/${e.name}.conf`,createdAt:t,updatedAt:t,ssl:{enabled:!1,certPath:"",keyPath:"",redirect:!0,hsts:!1,hstsMaxAge:31536e3},performance:{maxBodySize:"10m",readTimeout:60,connectTimeout:10,proxyBuffers:!1,gzip:!0,gzipTypes:"text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript"},security:{rateLimit:!1,rateLimitRate:10,rateLimitBurst:20,securityHeaders:!1,custom404:!1,custom50x:!1},advanced:{accessLog:!0,customLocations:""},certExpiry:null,daysLeft:null,notifications:H(),...e}}const x=e=>({certPath:`/etc/easy-devops/ssl/${e}/fullchain.pem`,keyPath:`/etc/easy-devops/ssl/${e}/privkey.pem`});function $(){return[h({name:"app.example.com",port:3e3,www:!0,ssl:{enabled:!0,...x("app.example.com"),redirect:!0,hsts:!0,hstsMaxAge:31536e3},certExpiry:u(95),daysLeft:95,security:{rateLimit:!0,rateLimitRate:10,rateLimitBurst:20,securityHeaders:!0,custom404:!1,custom50x:!1},notifications:{nginx_down:{enabled:!0,channelIds:["ch-discord-ops"]},cert_expiry:{enabled:!0,channelIds:["ch-discord-ops","ch-telegram-oncall"]},domain_health:{enabled:!1,channelIds:[]}}}),h({name:"api.example.com",port:8080,upstreamType:"https",ssl:{enabled:!0,...x("api.example.com"),redirect:!1,hsts:!1,hstsMaxAge:31536e3},certExpiry:u(12),daysLeft:12,notifications:{nginx_down:{enabled:!1,channelIds:[]},cert_expiry:{enabled:!0,channelIds:["ch-telegram-oncall"]},domain_health:{enabled:!0,channelIds:["ch-telegram-oncall"]}}}),h({name:"blog.example.com",port:4e3,backendHost:"10.0.0.12",security:{rateLimit:!1,rateLimitRate:10,rateLimitBurst:20,securityHeaders:!1,custom404:!0,custom50x:!1},notifications:{nginx_down:{enabled:!1,channelIds:[]},cert_expiry:{enabled:!1,channelIds:[]},domain_health:{enabled:!0,channelIds:["ch-discord-ops"]}}}),h({name:"staging.example.com",port:5e3,enabled:!1,configFile:"/etc/nginx/conf.d/staging.example.com.conf.disabled"})]}function N(){return[{domain:"app.example.com",expiry:u(95),daysLeft:95,status:"valid",autoRenew:"auto",autoRenewDays:7},{domain:"api.example.com",expiry:u(12),daysLeft:12,status:"expiring",autoRenew:"manual",autoRenewDays:7},{domain:"legacy.example.com",expiry:u(-3),daysLeft:-3,status:"expired"},{domain:"pending.example.com",expiry:null,daysLeft:null,status:"not_issued",label:"Not issued yet"},{domain:"broken.example.com",expiry:null,daysLeft:null,status:"unreadable",label:null},{domain:"blog.example.com",expiry:u(64),daysLeft:64,status:"valid",autoRenew:"unused",autoRenewDays:7}]}function j(){return[{id:"ch-discord-ops",name:"Ops Discord",type:"discord",webhookUrl:"https://discord.com/api/webhooks/123456789012345678/example-token",message:"Easy DevOps alert",lastTest:"passed"},{id:"ch-telegram-oncall",name:"On-call Telegram",type:"telegram",botToken:"7123456789:AAExampleTokenForMockOnly",chatId:"-1001234567890",lastTest:"failed"},{id:"ch-discord-builds",name:"Builds Discord",type:"discord",webhookUrl:"https://discord.com/api/webhooks/987654321098765432/example-token",lastTest:null},{id:"ch-telegram-releases",name:"Releases Telegram",type:"telegram",botToken:"7987654321:AAExampleTokenForMockOnly",chatId:"-1009876543210"}]}function C(){return{running:!0,version:"1.24.0",pid:1421}}function B(){return{"app.example.com.conf":`# Generated by Easy DevOps — manual edits are preserved on save only.
|
|
2
|
+
server {
|
|
3
|
+
listen 80;
|
|
4
|
+
server_name app.example.com www.app.example.com;
|
|
5
|
+
|
|
6
|
+
location /.well-known/acme-challenge/ {
|
|
7
|
+
root /var/www/easy-devops;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return 301 https://$host$request_uri;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
server {
|
|
14
|
+
listen 443 ssl http2;
|
|
15
|
+
server_name app.example.com www.app.example.com;
|
|
16
|
+
|
|
17
|
+
ssl_certificate /etc/easy-devops/ssl/app.example.com/fullchain.pem;
|
|
18
|
+
ssl_certificate_key /etc/easy-devops/ssl/app.example.com/privkey.pem;
|
|
19
|
+
|
|
20
|
+
client_max_body_size 10m;
|
|
21
|
+
gzip on;
|
|
22
|
+
|
|
23
|
+
add_header Strict-Transport-Security "max-age=31536000" always;
|
|
24
|
+
|
|
25
|
+
location / {
|
|
26
|
+
proxy_pass http://127.0.0.1:3000;
|
|
27
|
+
proxy_http_version 1.1;
|
|
28
|
+
proxy_set_header Host $host;
|
|
29
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
30
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
31
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
`,"api.example.com.conf":`server {
|
|
35
|
+
listen 80;
|
|
36
|
+
server_name api.example.com;
|
|
37
|
+
|
|
38
|
+
location /.well-known/acme-challenge/ {
|
|
39
|
+
root /var/www/easy-devops;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
location / {
|
|
43
|
+
proxy_pass https://127.0.0.1:8080;
|
|
44
|
+
proxy_set_header Host $host;
|
|
45
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`,"blog.example.com.conf":`server {
|
|
49
|
+
listen 80;
|
|
50
|
+
server_name blog.example.com;
|
|
51
|
+
|
|
52
|
+
location / {
|
|
53
|
+
proxy_pass http://10.0.0.12:4000;
|
|
54
|
+
proxy_set_header Host $host;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`,"default.conf":`server {
|
|
58
|
+
listen 80 default_server;
|
|
59
|
+
server_name _;
|
|
60
|
+
|
|
61
|
+
location / {
|
|
62
|
+
return 404;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`}}function z(){const e=Date.now(),t=n=>new Date(e-n).toISOString().replace("T"," ").slice(0,19);return['2026/11/13 09:12:02 [notice] 1#1: using the "epoll" event method',"2026/11/13 09:12:02 [notice] 1#1: nginx/1.24.0","2026/11/13 09:12:02 [notice] 1#1: OS: Linux 6.8.0-45-generic",`${t(36e5)} [warn] 1421#1421: *241 an upstream response is buffered to a temporary file`,`${t(9e5)} [error] 1421#1421: *318 connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.0.5, server: blog.example.com, request: "GET / HTTP/1.1", upstream: "http://10.0.0.12:4000/", host: "blog.example.com"`,`${t(24e4)} [warn] 1421#1421: *322 conflicting server name "staging.example.com" on 0.0.0.0:80, ignored`,`${t(3e4)} [error] 1421#1421: *330 open() "/var/www/easy-devops/.well-known/acme-challenge/test" failed (2: No such file or directory)`]}function F(){const e=Date.now(),t=n=>new Date(e-n).toISOString().replace("T"," ").replace("Z","");return[`10.0.0.5 - - [${t(12e4)}] "GET / HTTP/1.1" 200 4321 "-" "Mozilla/5.0"`,`10.0.0.8 - - [${t(9e4)}] "GET /api/health HTTP/1.1" 200 32 "-" "curl/8.5.0"`,`10.0.0.5 - - [${t(45e3)}] "POST /api/orders HTTP/1.1" 201 512 "-" "Mozilla/5.0"`,`10.0.0.9 - - [${t(2e4)}] "GET /assets/app.js HTTP/1.1" 200 18234 "https://app.example.com/" "Mozilla/5.0"`]}function I(){return[{name:"ez-dashboard",pmId:0,pid:2190,status:"online",cpu:1.2,memoryBytes:96468992,startedAt:Date.now()-2*864e5,uptimeMs:2*864e5,restarts:0,unstableRestarts:0,execPath:"/opt/easy-devops/src/cli/index.js",cwd:"/opt/easy-devops",user:"deploy",managed:!0,dataDir:"/var/lib/easy-devops"},{name:"api-worker",pmId:1,pid:2401,status:"online",cpu:2.4,memoryBytes:134217728,startedAt:Date.now()-6*36e5,uptimeMs:6*36e5,restarts:2,unstableRestarts:0,execPath:"/srv/api/worker.js",cwd:"/srv/api",user:"deploy",managed:!1,dataDir:null},{name:"legacy-app",pmId:2,pid:null,status:"stopped",cpu:null,memoryBytes:null,startedAt:null,uptimeMs:null,restarts:14,unstableRestarts:1,execPath:"/srv/legacy/server.js",cwd:"/srv/legacy",user:"deploy",managed:!1,dataDir:null},{name:"pm2-logrotate",pmId:3,pid:2502,status:"online",cpu:0,memoryBytes:0,startedAt:Date.now()-12*36e5,uptimeMs:12*36e5,restarts:1,unstableRestarts:0,execPath:"/home/deploy/.pm2/modules/pm2-logrotate/pm2-logrotate.js",cwd:"/home/deploy/.pm2/modules/pm2-logrotate",user:"deploy",managed:!1,dataDir:null}]}function U(){return{pm2:{installed:!0,version:"5.4.2",path:"/usr/local/bin/pm2"},apps:I(),currentUser:"deploy",pm2Home:"/home/deploy/.pm2"}}function G(){return{pm2:{installed:!0,version:"6.0.14",path:"/usr/local/bin/pm2"},dev:!1,dataDir:"/var/lib/easy-devops",backgroundService:{running:!0,connected:!0,pid:2190,version:"1.2.1",startedAt:Date.now()-2*864e5,heartbeatAgeMs:4e3,jobsRunningHere:!1,jobsOwnerPid:2190,jobsOwnerRole:"daemon",mechanism:"systemd",mode:null,installed:!0,startsAt:"boot",stoppedByUser:!1,stoppedAt:null,dataDir:"/var/lib/easy-devops",serverMode:!1,detail:null,state:"active",enabledOnBoot:!0,restarts:0,crashLooping:!1,warnings:[],runtime:{systemNode:{path:"/usr/bin/node",version:"v22.11.0",abi:"127"},pinned:{kind:"symlink",path:"/var/lib/easy-devops/runtime/node",target:"/usr/bin/node",version:"v22.11.0",exists:!0,broken:!1,differsFromSystem:!1},manager:{managed:!1,manager:null},mixed:{mixed:!1,msiPath:null,managed:null},warnings:[]}},install:{command:"ezz service install",needsElevation:!1,shell:null},probes:{ageMs:800,fresh:!0,pending:!1,refreshing:!1}}}function X(){return{dashboardPort:6443,nginxDir:"/etc/nginx",sslDir:"/etc/easy-devops/ssl",acmeEmail:"ops@example.com",sslAutoRenew:!0,sslAutoRenewDays:7,sslAutoRenewDaysMin:1,sslAutoRenewDaysMax:30,deployDir:"/home/ops/.config/easy-devops/ez_deploys",deployDirDefault:"/home/ops/.config/easy-devops/ez_deploys",deployDirIsDefault:!0,dashboardBindAddress:"127.0.0.1",bindsToLoopbackOnly:!0,dashboardAuth:"password",dashboardUi:"new",canUseNoPassword:!0,hasPassword:!0,platform:"linux"}}const b=[{id:"nginx",label:"Nginx",description:"Control the nginx service and its configuration files.",children:[{id:"nginx.start",label:"Start",description:"Start nginx when it is stopped."},{id:"nginx.stop",label:"Stop",description:"Stop nginx. Your sites go offline until it is started again."},{id:"nginx.restart",label:"Restart",description:"Full restart. Briefly drops connections."},{id:"nginx.reload",label:"Reload",description:"Graceful reload. Picks up config changes without dropping connections."},{id:"nginx.test",label:"Test config",description:"Run nginx -t. Read-only, changes nothing."},{id:"nginx.config.view",label:"View configs",description:"Read the generated nginx config files."},{id:"nginx.config.edit",label:"Edit configs",description:"Edit a config file. Always tested before it is kept, and rolled back if nginx rejects it."},{id:"nginx.logs.view",label:"View logs",description:"Read recent nginx access and error log lines."}]},{id:"domains",label:"Domains",description:"Manage reverse proxy domains and their nginx configs.",children:[{id:"domains.create",label:"Create",description:"Add a new domain and generate its nginx config."},{id:"domains.edit",label:"Edit",description:"Change an existing domain and regenerate its config."},{id:"domains.toggle",label:"Enable / disable",description:"Take a domain in or out of service without deleting it."},{id:"domains.delete",label:"Delete",description:"Remove a domain and its nginx config."}]},{id:"ssl",label:"SSL certificates",description:"Issue, renew and remove Let’s Encrypt certificates.",children:[{id:"ssl.renew",label:"Renew one",description:"Renew a single certificate. nginx keeps running."},{id:"ssl.renewAll",label:"Renew all expiring",description:"Renew every certificate expiring within 30 days."},{id:"ssl.issue",label:"Issue new",description:"Request a new certificate over HTTP-01. nginx keeps running."},{id:"ssl.delete",label:"Delete",description:"Delete certificate files. Refused while an enabled domain still uses them."},{id:"ssl.issueDns",label:"Issue wildcard (DNS-01)",description:"Wildcard certificates need a DNS TXT record you add by hand, so they cannot be driven from the Hub yet.",comingSoon:!0}]},{id:"deploy",label:"Deployments",description:"Deploy the apps on this server from the Hub. Fetching code and running its commands happens here, with this server’s own settings.",children:[{id:"deploy.run",label:"Deploy",description:"Start a deployment of an existing app from its configured repository."},{id:"deploy.rollback",label:"Roll back",description:"Switch an app back to an earlier release that is still on this server."},{id:"deploy.logs",label:"View deployment logs",description:"Read the output of a deployment. Build output can contain whatever the build prints."},{id:"deploy.manage",label:"Create, edit and delete apps",description:"Add an app from a repository, change its settings, issue its deploy token, or remove it. This decides which code runs here."},{id:"deploy.env",label:"Read and edit environment variables",description:"See and change an app’s environment values. They pass through the Hub while being edited and are not stored there."},{id:"deploy.ci",label:"Deploy from CI through the Hub",description:"Let a GitHub Action trigger a deployment by calling the Hub with the app’s own deploy token, so this server needs no inbound port."}]},{id:"process",label:"Processes",description:"Control the PM2 processes on this server. Easy DevOps itself runs as a background service, not a PM2 app, so it cannot be controlled from here.",children:[{id:"process.start",label:"Start",description:"Start a stopped PM2 process from the Hub."},{id:"process.stop",label:"Stop",description:"Stop a running PM2 process from the Hub."},{id:"process.restart",label:"Restart",description:"Restart a PM2 process from the Hub."}]},{id:"system",label:"System",description:"Server-level operations beyond nginx.",children:[{id:"system.nodeVersions",label:"Manage Node.js versions",description:"Install and switch Node.js versions through nvm.",comingSoon:!0},{id:"system.restartServer",label:"Reboot the server",description:"Reboot the whole machine.",comingSoon:!0}]}],q=b.flatMap(e=>e.children.filter(t=>t.comingSoon).map(t=>t.id));function K(){const e={};for(const t of b)for(const n of t.children)e[n.id]=!1;for(const t of["nginx.reload","nginx.test","nginx.config.view","nginx.logs.view","domains.create","domains.edit","domains.toggle","ssl.renew","ssl.renewAll"])e[t]=!0;return e}function V(e){return{linked:!0,hubUrl:"https://hub.example.com",serverId:"srv_demo_01",permissions:e,tree:b,comingSoon:q,connected:!0,status:"connected",lastError:null,attempts:0,agentOwner:"dashboard",agentReported:!0,dataDir:"/var/lib/easy-devops",devDataDir:!1}}const S=["dashboard","service-stopped","service-stopped-by-you","service-not-installed","service-elevation","service-pending","login","setup","setupcode","setupcode-expired","none"],J="ez-mock-state-v6",k="ez-mock-scenario";function W(){try{const e=new URLSearchParams(window.location.search),t=window.location.hash.includes("?")?new URLSearchParams(window.location.hash.slice(window.location.hash.indexOf("?")+1)):null,n=e.get("mock")??t?.get("mock");if(n&&S.includes(n))return sessionStorage.setItem(k,n),n;const a=sessionStorage.getItem(k);if(a&&S.includes(a))return a}catch{}return"dashboard"}function Y(e){const t=G(),n=t.backgroundService,a={command:"ezz service install",needsElevation:!1,shell:null};return e==="service-stopped"&&(t.backgroundService={...n,running:!1,connected:!1,pid:null,version:null,startedAt:null,heartbeatAgeMs:null,jobsRunningHere:!0,jobsOwnerPid:null,jobsOwnerRole:"dashboard",state:"inactive",detail:"The service is stopped."}),e==="service-stopped-by-you"&&(t.install=a,t.backgroundService={...n,running:!1,connected:!1,pid:null,version:null,startedAt:null,heartbeatAgeMs:null,jobsRunningHere:!0,jobsOwnerPid:null,jobsOwnerRole:"dashboard",mechanism:"startup-supervisor",mode:"personal",installed:!0,startsAt:"logon",stoppedByUser:!0,stoppedAt:new Date(Date.now()-36e5).toISOString(),state:null,enabledOnBoot:!0,detail:"The service is stopped.",runtime:{systemNode:{path:"C:\\Program Files\\nodejs\\node.exe",version:"v22.11.0",abi:"127"},pinned:{kind:"copy",path:"C:\\Users\\deploy\\AppData\\Local\\easy-devops\\runtime\\node.exe",version:"v20.18.1",exists:!0,broken:!1,differsFromSystem:!0},manager:{managed:!0,manager:"nvm-windows"},mixed:{mixed:!1,msiPath:null,managed:null},warnings:[]}}),e==="service-not-installed"&&(t.install=a,t.backgroundService={...n,running:!1,connected:!1,pid:null,version:null,startedAt:null,heartbeatAgeMs:null,jobsRunningHere:!0,jobsOwnerPid:null,jobsOwnerRole:"dashboard",mechanism:"startup-supervisor",mode:"personal",installed:!1,startsAt:"logon",stoppedByUser:!1,stoppedAt:null,state:null,enabledOnBoot:null,restarts:0,crashLooping:!1,runtime:null,warnings:[],detail:"The service is not installed."}),e==="service-elevation"&&(t.backgroundService={...n,mechanism:"systemd",mode:null,installed:!0,startsAt:"boot"}),e==="service-pending"&&(t.pm2={installed:null,version:null,path:null},t.probes={ageMs:null,fresh:!1,pending:!0,refreshing:!1},t.backgroundService={...n,state:null,enabledOnBoot:null,runtime:null,warnings:[]}),t}function Z(e){const t=$(),n=I(),a=K(),l=X(),m=e==="dashboard"||e==="none"||e.startsWith("service-"),p=e==="setup"||e==="setupcode"||e==="setupcode-expired";return{scenario:e,authenticated:m,authMode:e==="none"?"none":"password",setupConfigured:!p,hasPassword:!p,authRate:{login:{failures:0,blockedUntil:null},setup:{failures:0,blockedUntil:null}},domains:t,certs:N(),channels:j(),nginx:C(),configs:B(),errorLog:z(),accessLog:F(),processes:{...U(),apps:n},service:Y(e),pendingUntil:e==="service-pending"?Date.now()+1200:null,settings:{...l,dashboardAuth:e==="none"?"none":"password",canUseNoPassword:!0},permissionsConfigured:!1,hub:V(a),update:{current:"1.3.4",latest:"1.3.5",reachable:!0,updateAvailable:!0,source:{kind:"npm",reason:"an npm-installed package at /usr/lib/node_modules/easy-devops",npmUpdatable:!0,howToUpdate:[]},run:null},pendingDns:{}}}let d=null;function A(e){return`${J}:${e}`}function P(){if(d)return d;const e=W();try{const t=sessionStorage.getItem(A(e));if(t){const n=JSON.parse(t);if(n&&n.scenario===e)return d=n,d}}catch{}return d=Z(e),Q(),d}function Q(){if(d)try{sessionStorage.setItem(A(d.scenario),JSON.stringify(d))}catch{}}const O=e=>structuredClone(e),_=new Set;function ee(){try{return O(P().service.backgroundService)}catch{return null}}function te(e){return _.add(e),()=>{_.delete(e)}}function f(){try{const{linked:e,connected:t,status:n,lastError:a,attempts:l}=P().hub;return O({linked:e,connected:t,status:n,lastError:a,attempts:l})}catch{return null}}const T={running:!0,version:"1.24.0",pid:1421},D=[{name:"app.example.com",up:!0,port:3e3,host:"127.0.0.1"},{name:"api.example.com",up:!0,port:8080,host:"127.0.0.1"},{name:"blog.example.com",up:!1,port:4e3,host:"10.0.0.12"},{name:"staging.example.com",up:!0,port:5e3,host:"127.0.0.1"}];function R(e,t,n,a={}){return{id:`${e}-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:e,severity:t,message:n,timestamp:Date.now(),...a}}async function ae(){const e=new Map;let t=!1,n=[],a=[],l=null,m=0,p=null,g=null;const o=(s,r)=>{for(const i of e.get(s)??[])i(r)},E=(s,r)=>{const i=e.get(s)??new Set;i.add(r),e.set(s,i)},M=(s,r)=>{e.get(s)?.delete(r)},y=()=>{n.forEach(clearTimeout),n=[],a.forEach(clearInterval),a=[],l&&clearInterval(l),l=null};return{get connected(){return t},on(s,r){E(s,r)},off(s,r){M(s,r)},emit(s,r){if(s==="logs:unsubscribe"){l&&clearInterval(l),l=null;return}const i=r?.logFile==="access"?"access":"error";l&&clearInterval(l);for(let c=50;c>0;c-=1){const v=new Date(Date.now()-c*3e4).toISOString().replace("T"," ").slice(0,19);o("logs:line",{logFile:i,line:i==="access"?`10.0.0.${5+c%4} - - [${v}] "GET /health HTTP/1.1" 200 ${300+c} "-" "Mozilla/5.0"`:`${v} [warn] 1421#1421: *${100+c} an upstream response is buffered to a temporary file`})}l=setInterval(()=>{m+=1;const c=i==="access"?{line:`10.0.0.${5+m%4} - - [${new Date().toISOString()}] "GET / HTTP/1.1" 200 ${1e3+m*37} "-" "Mozilla/5.0"`,logFile:i}:{line:`${new Date().toISOString().replace("T"," ").slice(0,19)} [warn] 1421#1421: *${400+m} an upstream response is buffered to a temporary file`,logFile:i};o("logs:line",c)},900)},connect(){t||(y(),n.push(setTimeout(()=>{t=!0,o("connect",void 0),o("nginx:status",T),o("domain:health",D);const s=ee();s&&o("service:changed",s);const r=f();r&&o("hub:agentState",r),p?.(),p=te(i=>{t&&o("service:changed",i)}),g?.(),g=L(i=>{t&&o("ssl:progress",i)})},120),setTimeout(()=>{o("notification:new",R("nginx_down","success","Nginx is running again",{subtype:"recovery"}))},2200),setTimeout(()=>{o("notification:new",R("cert_expiry","warning","🔒 SSL cert for api.example.com expires in 12 days",{domain:"api.example.com"}))},5200),setTimeout(()=>{const s=f();if(!s?.linked)return;const r={...s,connected:!1,status:"unreachable",attempts:s.attempts+1,lastError:"connect ECONNREFUSED 10.0.0.20:443"};o("hub:agentState",r)},9e3),setTimeout(()=>{const s=f();s?.linked&&o("hub:agentState",{...s,connected:!0,status:"connected",attempts:0,lastError:null})},15e3)),a.push(setInterval(()=>{t&&o("nginx:status",T)},5e3),setInterval(()=>{t&&o("domain:health",D)},6e4)))},disconnect(){t&&(t=!1,y(),p?.(),p=null,g?.(),g=null,o("disconnect",void 0))}}}export{ae as createMockSocket};
|
package/dist/ui/index.html
CHANGED
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
}
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
|
-
<script type="module" crossorigin src="./assets/index-
|
|
66
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
65
|
+
<script type="module" crossorigin src="./assets/index-gndgYe3K.js"></script>
|
|
66
|
+
<link rel="stylesheet" crossorigin href="./assets/index-Bu7af-Kj.css">
|
|
67
67
|
</head>
|
|
68
68
|
<body>
|
|
69
69
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easy-devops",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "A unified DevOps management tool with CLI and web dashboard for managing Nginx, SSL certificates, deployment apps, and Node.js on Linux and Windows servers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"devops",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"dev": "node src/cli/index.js --dev",
|
|
51
51
|
"build:ui": "npm --prefix src/dashboard/ui install && npm --prefix src/dashboard/ui run build",
|
|
52
52
|
"prepublishOnly": "npm run build:ui && npm test",
|
|
53
|
-
"
|
|
53
|
+
"test": "node e2e/run.mjs",
|
|
54
54
|
"test:e2e": "node e2e/run.mjs",
|
|
55
55
|
"test:e2e:check": "node e2e/run.mjs --check",
|
|
56
56
|
"dashboard": "node src/dashboard/server.js",
|
package/src/cli/index.js
CHANGED
|
@@ -127,6 +127,8 @@ Commands:
|
|
|
127
127
|
runtime <action> The Node runtime the service is pinned to.
|
|
128
128
|
Actions: status, update
|
|
129
129
|
update Update Easy DevOps itself, then restart the service.
|
|
130
|
+
hub <action> Pair this server with an Easy DevOps Hub.
|
|
131
|
+
Actions: connect <link-or-ezops-string>, status, unlink
|
|
130
132
|
cleanup List reclaimable files (runtime backups, old logs, stale
|
|
131
133
|
locks, nginx .bak files) and remove the ones you choose.
|
|
132
134
|
uninstall Remove Easy DevOps. Needs --purge to do anything.
|
|
@@ -165,6 +167,9 @@ Examples:
|
|
|
165
167
|
ezz runtime status Show the pinned Node and the available LTS versions
|
|
166
168
|
ezz runtime update Move the service to a newer Node, with rollback
|
|
167
169
|
ezz update Update Easy DevOps and restart the service
|
|
170
|
+
ezz hub connect <link> Pair with a Hub using the command from its "From the CLI" option
|
|
171
|
+
ezz hub status Show the Hub origin, server id and agent state
|
|
172
|
+
ezz hub unlink --yes Remove the pairing (the Hub keeps the server, offline)
|
|
168
173
|
ezz cleanup Show what can be reclaimed (nothing is deleted)
|
|
169
174
|
ezz dashboard setup-code Issue a new first-run setup code
|
|
170
175
|
npm run dev Interactive menu against .dev-data
|
|
@@ -242,6 +247,9 @@ if (flags.has('dash')) {
|
|
|
242
247
|
} else if (command === 'update') {
|
|
243
248
|
const { updateCommand } = await import('./menus/update.js');
|
|
244
249
|
process.exit(await updateCommand({ yes: flags.has('yes') }));
|
|
250
|
+
} else if (command === 'hub') {
|
|
251
|
+
const { hubCommand } = await import('./menus/hub.js');
|
|
252
|
+
process.exit(await hubCommand(args[0] ?? 'status', args.slice(1), { yes: flags.has('yes') }));
|
|
245
253
|
} else if (command === 'cleanup') {
|
|
246
254
|
const { cleanupCommand } = await import('./menus/cleanup.js');
|
|
247
255
|
process.exit(await cleanupCommand({ days: options.days, yes: flags.has('yes') }));
|
|
@@ -23,6 +23,7 @@ import { writeConfWithTest, findBackslashCertPaths } from '../../core/nginx-appl
|
|
|
23
23
|
import { prepareDomainForHttpChallenge, describeIssuance } from '../../core/ssl-issuer.js';
|
|
24
24
|
import { issueCert } from './ssl-manager.js';
|
|
25
25
|
import { isWindows, nginxTestCmd, nginxReloadCmd, combineOutput, isNginxTestOk } from '../../core/platform.js';
|
|
26
|
+
import { page, pause, BACK } from '../ui/page.js';
|
|
26
27
|
|
|
27
28
|
// ─── List Domains ───────────────────────────────────────────────────────
|
|
28
29
|
|
|
@@ -126,6 +127,11 @@ async function addDomainAction() {
|
|
|
126
127
|
type: 'confirm', name: 'www', message: 'Include www subdomain?', default: false,
|
|
127
128
|
when: (ans) => !ans.wildcard,
|
|
128
129
|
},
|
|
130
|
+
{
|
|
131
|
+
type: 'confirm', name: 'behindCloudflare',
|
|
132
|
+
message: 'Is this domain behind Cloudflare (trust CF-Connecting-IP)?',
|
|
133
|
+
default: false,
|
|
134
|
+
},
|
|
129
135
|
]);
|
|
130
136
|
|
|
131
137
|
// Check for duplicate
|
|
@@ -230,7 +236,19 @@ async function addDomainAction() {
|
|
|
230
236
|
}
|
|
231
237
|
}
|
|
232
238
|
|
|
233
|
-
const result = await issueCert(basic.name, {
|
|
239
|
+
const result = await issueCert(basic.name, {
|
|
240
|
+
www: basic.www,
|
|
241
|
+
wildcard: basic.wildcard,
|
|
242
|
+
validationMethod: basic.wildcard ? 'dns' : 'http',
|
|
243
|
+
onEvent: (event) => {
|
|
244
|
+
try {
|
|
245
|
+
if (event.status !== 'running') return;
|
|
246
|
+
spinner.text = event.stage === 'waiting for validation'
|
|
247
|
+
? `Waiting for Let's Encrypt validation (${Math.max(0, Math.round((event.elapsedMs ?? 0) / 1000))}s)…`
|
|
248
|
+
: `${event.stage}…`;
|
|
249
|
+
} catch { /* progress must never break the command */ }
|
|
250
|
+
},
|
|
251
|
+
});
|
|
234
252
|
spinner.stop();
|
|
235
253
|
|
|
236
254
|
if (result.success) {
|
|
@@ -320,6 +338,7 @@ async function addDomainAction() {
|
|
|
320
338
|
upstreamType: basic.upstreamType,
|
|
321
339
|
www: basic.www,
|
|
322
340
|
wildcard: basic.wildcard,
|
|
341
|
+
behindCloudflare: basic.behindCloudflare ?? false,
|
|
323
342
|
ssl,
|
|
324
343
|
performance,
|
|
325
344
|
security,
|
|
@@ -381,6 +400,11 @@ async function editDomainAction() {
|
|
|
381
400
|
choices: ['http', 'https', 'ws'],
|
|
382
401
|
},
|
|
383
402
|
{ type: 'confirm', name: 'www', message: 'Include www?', default: existing.www || false },
|
|
403
|
+
{
|
|
404
|
+
type: 'confirm', name: 'behindCloudflare',
|
|
405
|
+
message: 'Is this domain behind Cloudflare (trust CF-Connecting-IP)?',
|
|
406
|
+
default: existing.behindCloudflare === true,
|
|
407
|
+
},
|
|
384
408
|
{ type: 'confirm', name: 'sslEnabled', message: 'SSL enabled?', default: existing.ssl?.enabled || false },
|
|
385
409
|
]);
|
|
386
410
|
|
|
@@ -391,6 +415,7 @@ async function editDomainAction() {
|
|
|
391
415
|
domain.port = updates.port;
|
|
392
416
|
domain.upstreamType = updates.upstreamType;
|
|
393
417
|
domain.www = updates.www;
|
|
418
|
+
domain.behindCloudflare = updates.behindCloudflare === true;
|
|
394
419
|
domain.ssl.enabled = updates.sslEnabled;
|
|
395
420
|
|
|
396
421
|
// Regenerate config through the shared core apply. On failure the previous
|
|
@@ -588,9 +613,10 @@ async function toggleDomainAction() {
|
|
|
588
613
|
|
|
589
614
|
export async function showDomainManager() {
|
|
590
615
|
while (true) {
|
|
616
|
+
page(['Domains']);
|
|
617
|
+
|
|
591
618
|
const domains = getDomains();
|
|
592
619
|
|
|
593
|
-
console.log(chalk.bold('\n Domain Manager'));
|
|
594
620
|
console.log(chalk.gray(' ' + '─'.repeat(40)));
|
|
595
621
|
console.log(` ${chalk.blue(domains.length)} domain${domains.length !== 1 ? 's' : ''} configured`);
|
|
596
622
|
console.log();
|
|
@@ -602,7 +628,7 @@ export async function showDomainManager() {
|
|
|
602
628
|
'Enable / Disable Domain',
|
|
603
629
|
'Delete Domain',
|
|
604
630
|
new inquirer.Separator(),
|
|
605
|
-
|
|
631
|
+
BACK,
|
|
606
632
|
];
|
|
607
633
|
|
|
608
634
|
let choice;
|
|
@@ -620,26 +646,31 @@ export async function showDomainManager() {
|
|
|
620
646
|
|
|
621
647
|
switch (choice) {
|
|
622
648
|
case 'List Domains':
|
|
649
|
+
page(['Domains', 'List']);
|
|
623
650
|
await listDomainsAction();
|
|
624
651
|
break;
|
|
625
652
|
case 'Add Domain':
|
|
653
|
+
page(['Domains', 'Add']);
|
|
626
654
|
await addDomainAction();
|
|
627
655
|
break;
|
|
628
656
|
case 'Edit Domain':
|
|
657
|
+
page(['Domains', 'Edit']);
|
|
629
658
|
await editDomainAction();
|
|
630
659
|
break;
|
|
631
660
|
case 'Enable / Disable Domain':
|
|
661
|
+
page(['Domains', 'Enable / Disable']);
|
|
632
662
|
await toggleDomainAction();
|
|
633
663
|
break;
|
|
634
664
|
case 'Delete Domain':
|
|
665
|
+
page(['Domains', 'Delete']);
|
|
635
666
|
await deleteDomainAction();
|
|
636
667
|
break;
|
|
637
|
-
case
|
|
668
|
+
case BACK:
|
|
638
669
|
return;
|
|
639
670
|
}
|
|
640
671
|
|
|
641
|
-
if (choice !==
|
|
642
|
-
await
|
|
672
|
+
if (choice !== BACK) {
|
|
673
|
+
await pause();
|
|
643
674
|
}
|
|
644
675
|
}
|
|
645
676
|
}
|
|
@@ -17,6 +17,7 @@ import { run, runLive, runInteractive } from '../../core/shell.js';
|
|
|
17
17
|
import { loadConfig } from '../../core/config.js';
|
|
18
18
|
import { ensureNginxInclude } from '../../core/nginx-conf-generator.js';
|
|
19
19
|
import { isWindows, isNginxTestOk } from '../../core/platform.js';
|
|
20
|
+
import { page, pause, BACK } from '../ui/page.js';
|
|
20
21
|
import path from 'path';
|
|
21
22
|
|
|
22
23
|
// ─── Helpers ────────────────────────────────────────────────────────────────
|
|
@@ -409,10 +410,11 @@ async function installNginx() {
|
|
|
409
410
|
|
|
410
411
|
export async function showNginxManager() {
|
|
411
412
|
while (true) {
|
|
413
|
+
page(['Nginx']);
|
|
414
|
+
|
|
412
415
|
const { nginxDir } = loadConfig();
|
|
413
416
|
const status = await getNginxStatus(nginxDir);
|
|
414
417
|
|
|
415
|
-
console.log(chalk.bold('\n Nginx Manager'));
|
|
416
418
|
console.log(chalk.gray(' ' + '─'.repeat(40)));
|
|
417
419
|
|
|
418
420
|
if (status.version) {
|
|
@@ -438,7 +440,7 @@ export async function showNginxManager() {
|
|
|
438
440
|
choices.push('Install nginx', new inquirer.Separator());
|
|
439
441
|
}
|
|
440
442
|
|
|
441
|
-
choices.push(
|
|
443
|
+
choices.push(BACK);
|
|
442
444
|
|
|
443
445
|
let choice;
|
|
444
446
|
try {
|
|
@@ -455,18 +457,23 @@ export async function showNginxManager() {
|
|
|
455
457
|
|
|
456
458
|
switch (choice) {
|
|
457
459
|
case 'Reload nginx':
|
|
460
|
+
page(['Nginx', 'Reload']);
|
|
458
461
|
await reloadNginx(status.nginxExe, status.nginxDir);
|
|
459
462
|
break;
|
|
460
463
|
case 'Restart nginx':
|
|
464
|
+
page(['Nginx', 'Restart']);
|
|
461
465
|
await restartNginx(status.nginxExe, status.nginxDir);
|
|
462
466
|
break;
|
|
463
467
|
case 'Start nginx':
|
|
468
|
+
page(['Nginx', 'Start']);
|
|
464
469
|
await startNginx(status.nginxExe, status.nginxDir);
|
|
465
470
|
break;
|
|
466
471
|
case 'Stop nginx':
|
|
472
|
+
page(['Nginx', 'Stop']);
|
|
467
473
|
await stopNginx(status.nginxDir);
|
|
468
474
|
break;
|
|
469
475
|
case 'Test config': {
|
|
476
|
+
page(['Nginx', 'Test config']);
|
|
470
477
|
const result = await testConfig(status.nginxExe, status.nginxDir);
|
|
471
478
|
console.log(
|
|
472
479
|
'\n Config test: ' +
|
|
@@ -477,17 +484,19 @@ export async function showNginxManager() {
|
|
|
477
484
|
break;
|
|
478
485
|
}
|
|
479
486
|
case 'View error log':
|
|
487
|
+
page(['Nginx', 'Error log']);
|
|
480
488
|
await viewErrorLog(status.logPath);
|
|
481
489
|
break;
|
|
482
490
|
case 'Install nginx':
|
|
491
|
+
page(['Nginx', 'Install']);
|
|
483
492
|
await installNginx();
|
|
484
493
|
break;
|
|
485
|
-
case
|
|
494
|
+
case BACK:
|
|
486
495
|
return;
|
|
487
496
|
}
|
|
488
497
|
|
|
489
|
-
if (choice !==
|
|
490
|
-
await
|
|
498
|
+
if (choice !== BACK) {
|
|
499
|
+
await pause();
|
|
491
500
|
}
|
|
492
501
|
}
|
|
493
502
|
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import chalk from 'chalk';
|
|
14
14
|
import inquirer from 'inquirer';
|
|
15
15
|
import { run, runLive } from '../../core/shell.js';
|
|
16
|
+
import { page, pause, BACK } from '../ui/page.js';
|
|
16
17
|
|
|
17
18
|
const isWindows = process.platform === 'win32';
|
|
18
19
|
|
|
@@ -32,6 +33,8 @@ async function getCurrentVersions() {
|
|
|
32
33
|
// ─── switchVersion ────────────────────────────────────────────────────────────
|
|
33
34
|
|
|
34
35
|
async function switchVersion() {
|
|
36
|
+
page(['Node.js', 'Switch version']);
|
|
37
|
+
|
|
35
38
|
// Verify nvm is present
|
|
36
39
|
const nvmCheck = await run(isWindows ? 'nvm version' : 'nvm --version');
|
|
37
40
|
if (!nvmCheck.success) {
|
|
@@ -43,7 +46,7 @@ async function switchVersion() {
|
|
|
43
46
|
console.log(chalk.gray(' Install nvm: https://github.com/nvm-sh/nvm#installing-and-updating'));
|
|
44
47
|
}
|
|
45
48
|
console.log();
|
|
46
|
-
await
|
|
49
|
+
await pause();
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
49
52
|
|
|
@@ -84,7 +87,7 @@ async function switchVersion() {
|
|
|
84
87
|
|
|
85
88
|
if (versions.length === 0) {
|
|
86
89
|
console.log(chalk.red('\n Could not fetch available versions. Check your internet connection.\n'));
|
|
87
|
-
await
|
|
90
|
+
await pause();
|
|
88
91
|
return;
|
|
89
92
|
}
|
|
90
93
|
|
|
@@ -110,7 +113,7 @@ async function switchVersion() {
|
|
|
110
113
|
|
|
111
114
|
await runLive(switchCmd, { timeout: 60000 });
|
|
112
115
|
|
|
113
|
-
await
|
|
116
|
+
await pause();
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
// ─── listGlobalPackages ───────────────────────────────────────────────────────
|
|
@@ -124,7 +127,7 @@ async function listGlobalPackages() {
|
|
|
124
127
|
console.log(chalk.red(' Failed to list global packages.'));
|
|
125
128
|
if (result.stderr) console.log(chalk.gray(' ' + result.stderr));
|
|
126
129
|
}
|
|
127
|
-
await
|
|
130
|
+
await pause();
|
|
128
131
|
}
|
|
129
132
|
|
|
130
133
|
// ─── installGlobalPackage ─────────────────────────────────────────────────────
|
|
@@ -147,7 +150,7 @@ async function installGlobalPackage() {
|
|
|
147
150
|
} else {
|
|
148
151
|
console.log(chalk.red(`\n ✗ Installation failed (exit code ${exitCode})`));
|
|
149
152
|
}
|
|
150
|
-
await
|
|
153
|
+
await pause();
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
// ─── uninstallGlobalPackage ───────────────────────────────────────────────────
|
|
@@ -164,7 +167,7 @@ async function uninstallGlobalPackage() {
|
|
|
164
167
|
|
|
165
168
|
if (packages.length === 0) {
|
|
166
169
|
console.log(chalk.yellow('\n No removable global packages found.\n'));
|
|
167
|
-
await
|
|
170
|
+
await pause();
|
|
168
171
|
return;
|
|
169
172
|
}
|
|
170
173
|
|
|
@@ -187,7 +190,7 @@ async function uninstallGlobalPackage() {
|
|
|
187
190
|
} else {
|
|
188
191
|
console.log(chalk.red(`\n ✗ Uninstall failed (exit code ${exitCode})`));
|
|
189
192
|
}
|
|
190
|
-
await
|
|
193
|
+
await pause();
|
|
191
194
|
}
|
|
192
195
|
|
|
193
196
|
// ─── updateNpm ────────────────────────────────────────────────────────────────
|
|
@@ -202,16 +205,17 @@ async function updateNpm() {
|
|
|
202
205
|
} else {
|
|
203
206
|
console.log(chalk.red(`\n ✗ Update failed (exit code ${exitCode})`));
|
|
204
207
|
}
|
|
205
|
-
await
|
|
208
|
+
await pause();
|
|
206
209
|
}
|
|
207
210
|
|
|
208
211
|
// ─── showNodeManager ──────────────────────────────────────────────────────────
|
|
209
212
|
|
|
210
213
|
export async function showNodeManager() {
|
|
211
214
|
while (true) {
|
|
215
|
+
page(['Node.js']);
|
|
216
|
+
|
|
212
217
|
const versions = await getCurrentVersions();
|
|
213
218
|
|
|
214
|
-
console.log(chalk.bold('\n Node.js Manager'));
|
|
215
219
|
console.log(chalk.gray(' ' + '─'.repeat(40)));
|
|
216
220
|
console.log(` Current: ${chalk.green('Node ' + versions.node)} | ${chalk.yellow('npm v' + versions.npm)}`);
|
|
217
221
|
console.log();
|
|
@@ -228,7 +232,7 @@ export async function showNodeManager() {
|
|
|
228
232
|
new inquirer.Separator(),
|
|
229
233
|
'Update npm',
|
|
230
234
|
new inquirer.Separator(),
|
|
231
|
-
|
|
235
|
+
BACK,
|
|
232
236
|
],
|
|
233
237
|
}]));
|
|
234
238
|
} catch (err) {
|
|
@@ -240,7 +244,7 @@ export async function showNodeManager() {
|
|
|
240
244
|
case 'Switch Node version': await switchVersion(); break;
|
|
241
245
|
case 'Manage global packages': await manageGlobalPackages(); break;
|
|
242
246
|
case 'Update npm': await updateNpm(); break;
|
|
243
|
-
case
|
|
247
|
+
case BACK: return;
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
250
|
}
|
|
@@ -248,6 +252,8 @@ export async function showNodeManager() {
|
|
|
248
252
|
// ─── manageGlobalPackages ─────────────────────────────────────────────────────
|
|
249
253
|
|
|
250
254
|
async function manageGlobalPackages() {
|
|
255
|
+
page(['Node.js', 'Global packages']);
|
|
256
|
+
|
|
251
257
|
let choice;
|
|
252
258
|
try {
|
|
253
259
|
({ choice } = await inquirer.prompt([{
|
|
@@ -258,7 +264,7 @@ async function manageGlobalPackages() {
|
|
|
258
264
|
'List global packages',
|
|
259
265
|
'Install global package',
|
|
260
266
|
'Uninstall global package',
|
|
261
|
-
|
|
267
|
+
BACK,
|
|
262
268
|
],
|
|
263
269
|
}]));
|
|
264
270
|
} catch (err) {
|
|
@@ -270,6 +276,6 @@ async function manageGlobalPackages() {
|
|
|
270
276
|
case 'List global packages': await listGlobalPackages(); break;
|
|
271
277
|
case 'Install global package': await installGlobalPackage(); break;
|
|
272
278
|
case 'Uninstall global package': await uninstallGlobalPackage(); break;
|
|
273
|
-
case
|
|
279
|
+
case BACK: return;
|
|
274
280
|
}
|
|
275
281
|
}
|