@sylphx/cli 0.1.7 → 0.1.9
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 +20 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var import_commander16 = require("commander");
|
|
|
30
30
|
// package.json
|
|
31
31
|
var package_default = {
|
|
32
32
|
name: "@sylphx/cli",
|
|
33
|
-
version: "0.1.
|
|
33
|
+
version: "0.1.9",
|
|
34
34
|
description: "Sylphx Platform CLI \u2014 deploy, manage logs, env vars, and more",
|
|
35
35
|
type: "commonjs",
|
|
36
36
|
bin: {
|
|
@@ -1170,7 +1170,9 @@ var linkCommand = new import_commander6.Command("link").description("Link curren
|
|
|
1170
1170
|
if (envs.length > 1) {
|
|
1171
1171
|
console.log(import_chalk7.default.bold("\n Available environments:\n"));
|
|
1172
1172
|
envs.forEach((env, i) => {
|
|
1173
|
-
console.log(
|
|
1173
|
+
console.log(
|
|
1174
|
+
` ${import_chalk7.default.cyan(String(i + 1))}. ${env.envType ?? env.slug ?? env.name} ${import_chalk7.default.dim(`(${env.name})`)}`
|
|
1175
|
+
);
|
|
1174
1176
|
});
|
|
1175
1177
|
console.log("");
|
|
1176
1178
|
const envChoice = await prompt3(
|
|
@@ -1179,7 +1181,7 @@ var linkCommand = new import_commander6.Command("link").description("Link curren
|
|
|
1179
1181
|
if (envChoice) {
|
|
1180
1182
|
const envIdx = Number.parseInt(envChoice, 10) - 1;
|
|
1181
1183
|
if (!Number.isNaN(envIdx) && envIdx >= 0 && envIdx < envs.length && envs[envIdx]) {
|
|
1182
|
-
defaultEnv = envs[envIdx]?.slug;
|
|
1184
|
+
defaultEnv = envs[envIdx]?.envType ?? envs[envIdx]?.slug ?? "production";
|
|
1183
1185
|
}
|
|
1184
1186
|
}
|
|
1185
1187
|
}
|
|
@@ -1376,11 +1378,14 @@ var openCommand = new import_commander10.Command("open").description("Open the a
|
|
|
1376
1378
|
try {
|
|
1377
1379
|
const status = await api.getDeploymentStatus(linked.appId);
|
|
1378
1380
|
spinner.stop();
|
|
1379
|
-
|
|
1381
|
+
const envType = opts.env ?? linked.defaultEnv ?? "production";
|
|
1382
|
+
const envMatch = status.environments?.find((e) => e.envType === envType) ?? status.environments?.find((e) => e.envType === "production") ?? status.environments?.[0];
|
|
1383
|
+
const resolvedUrl = status.url ?? envMatch?.url ?? null;
|
|
1384
|
+
if (!resolvedUrl) {
|
|
1380
1385
|
url = `https://sylphx.com/console/apps/${linked.appId}`;
|
|
1381
1386
|
console.log(import_chalk11.default.yellow(" No URL found, opening console instead."));
|
|
1382
1387
|
} else {
|
|
1383
|
-
url =
|
|
1388
|
+
url = resolvedUrl;
|
|
1384
1389
|
}
|
|
1385
1390
|
} catch {
|
|
1386
1391
|
spinner.stop();
|
|
@@ -1392,9 +1397,7 @@ var openCommand = new import_commander10.Command("open").description("Open the a
|
|
|
1392
1397
|
await open(url);
|
|
1393
1398
|
} catch (err) {
|
|
1394
1399
|
console.log(
|
|
1395
|
-
import_chalk11.default.red(
|
|
1396
|
-
`Failed to open browser: ${err instanceof Error ? err.message : String(err)}`
|
|
1397
|
-
)
|
|
1400
|
+
import_chalk11.default.red(`Failed to open browser: ${err instanceof Error ? err.message : String(err)}`)
|
|
1398
1401
|
);
|
|
1399
1402
|
console.log(import_chalk11.default.dim(` URL: ${url}`));
|
|
1400
1403
|
process.exit(1);
|
|
@@ -1606,8 +1609,15 @@ var statusCommand = new import_commander13.Command("status").description("Show d
|
|
|
1606
1609
|
const date = new Date(status.deployedAt);
|
|
1607
1610
|
console.log(` Deployed: ${import_chalk14.default.white(date.toLocaleString())}`);
|
|
1608
1611
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1612
|
+
const envMatch = status.environments?.find((e) => e.envType === env) ?? status.environments?.find((e) => e.envType === "production") ?? status.environments?.[0];
|
|
1613
|
+
const displayUrl = status.url ?? envMatch?.url ?? null;
|
|
1614
|
+
if (displayUrl) {
|
|
1615
|
+
console.log(` URL: ${import_chalk14.default.cyan(displayUrl)}`);
|
|
1616
|
+
}
|
|
1617
|
+
if (envMatch?.lastDeployedAt) {
|
|
1618
|
+
console.log(
|
|
1619
|
+
` Deployed: ${import_chalk14.default.white(new Date(envMatch.lastDeployedAt).toLocaleString())}`
|
|
1620
|
+
);
|
|
1611
1621
|
}
|
|
1612
1622
|
if (status.replicas) {
|
|
1613
1623
|
const { ready, desired } = status.replicas;
|