@eve-horizon/cli 0.2.21 → 0.2.22
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/dist/index.js +40 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -48902,7 +48902,7 @@ var HELP = {
|
|
|
48902
48902
|
]
|
|
48903
48903
|
},
|
|
48904
48904
|
status: {
|
|
48905
|
-
description: "Show deployment status across all profiles with service URLs",
|
|
48905
|
+
description: "Show deployment status across all profiles with revision info, service URLs, and deploy age",
|
|
48906
48906
|
usage: "eve project status [--profile <name>] [--env <name>] [--json]",
|
|
48907
48907
|
options: [
|
|
48908
48908
|
"--profile <name> Show only this profile",
|
|
@@ -51815,19 +51815,37 @@ async function handleStatus(flags, currentContext, json) {
|
|
|
51815
51815
|
formatStatusOutput(results);
|
|
51816
51816
|
}
|
|
51817
51817
|
async function fetchProfileStatus(ctx, envFilter) {
|
|
51818
|
-
const project = await
|
|
51818
|
+
const [project, releasesResponse] = await Promise.all([
|
|
51819
|
+
requestJson(ctx, `/projects/${ctx.projectId}`),
|
|
51820
|
+
requestJson(ctx, `/projects/${ctx.projectId}/releases?limit=50`).catch(() => ({ data: [] }))
|
|
51821
|
+
]);
|
|
51822
|
+
const releasesById = new Map(releasesResponse.data.map((r) => [r.id, r]));
|
|
51819
51823
|
const envResponse = await requestJson(ctx, `/projects/${ctx.projectId}/envs?limit=50`);
|
|
51820
51824
|
const domain = inferDomain(ctx.apiUrl);
|
|
51821
51825
|
const environments = [];
|
|
51822
51826
|
for (const env of envResponse.data) {
|
|
51823
51827
|
if (envFilter && env.name !== envFilter) continue;
|
|
51824
51828
|
const status = env.suspended_at ? "suspended" : "active";
|
|
51829
|
+
let release = null;
|
|
51830
|
+
if (env.current_release_id) {
|
|
51831
|
+
const r = releasesById.get(env.current_release_id);
|
|
51832
|
+
if (r) {
|
|
51833
|
+
release = {
|
|
51834
|
+
git_sha: r.git_sha,
|
|
51835
|
+
version: r.version,
|
|
51836
|
+
tag: r.tag,
|
|
51837
|
+
deployed_at: r.created_at,
|
|
51838
|
+
created_by: r.created_by
|
|
51839
|
+
};
|
|
51840
|
+
}
|
|
51841
|
+
}
|
|
51825
51842
|
if (env.suspended_at) {
|
|
51826
51843
|
environments.push({
|
|
51827
51844
|
name: env.name,
|
|
51828
51845
|
type: env.type,
|
|
51829
51846
|
status,
|
|
51830
51847
|
namespace: env.namespace,
|
|
51848
|
+
release,
|
|
51831
51849
|
services: []
|
|
51832
51850
|
});
|
|
51833
51851
|
continue;
|
|
@@ -51843,6 +51861,7 @@ async function fetchProfileStatus(ctx, envFilter) {
|
|
|
51843
51861
|
type: env.type,
|
|
51844
51862
|
status,
|
|
51845
51863
|
namespace: env.namespace,
|
|
51864
|
+
release,
|
|
51846
51865
|
services
|
|
51847
51866
|
});
|
|
51848
51867
|
}
|
|
@@ -51910,6 +51929,13 @@ function formatStatusOutput(results) {
|
|
|
51910
51929
|
for (const env of r.environments) {
|
|
51911
51930
|
console.log("");
|
|
51912
51931
|
console.log(` ${env.name} ${env.status} ${env.type}`);
|
|
51932
|
+
if (env.release) {
|
|
51933
|
+
const sha = env.release.git_sha.substring(0, 8);
|
|
51934
|
+
const age = formatAge(env.release.deployed_at);
|
|
51935
|
+
const ver = env.release.tag ?? env.release.version ?? "";
|
|
51936
|
+
const verPart = ver ? ` ${ver}` : "";
|
|
51937
|
+
console.log(` revision: ${sha}${verPart} deployed ${age}`);
|
|
51938
|
+
}
|
|
51913
51939
|
if (env.services.length === 0) {
|
|
51914
51940
|
if (env.status === "suspended") {
|
|
51915
51941
|
console.log(" (suspended)");
|
|
@@ -51957,6 +51983,18 @@ function parseSinceValue2(since) {
|
|
|
51957
51983
|
}
|
|
51958
51984
|
return now.toISOString();
|
|
51959
51985
|
}
|
|
51986
|
+
function formatAge(isoDate) {
|
|
51987
|
+
const ms = Date.now() - new Date(isoDate).getTime();
|
|
51988
|
+
if (ms < 0) return "just now";
|
|
51989
|
+
const secs = Math.floor(ms / 1e3);
|
|
51990
|
+
if (secs < 60) return `${secs}s ago`;
|
|
51991
|
+
const mins = Math.floor(secs / 60);
|
|
51992
|
+
if (mins < 60) return `${mins}m ago`;
|
|
51993
|
+
const hours = Math.floor(mins / 60);
|
|
51994
|
+
if (hours < 24) return `${hours}h ago`;
|
|
51995
|
+
const days = Math.floor(hours / 24);
|
|
51996
|
+
return `${days}d ago`;
|
|
51997
|
+
}
|
|
51960
51998
|
function padRight(str, width) {
|
|
51961
51999
|
return str.length >= width ? str : str + " ".repeat(width - str.length);
|
|
51962
52000
|
}
|