dockup-cli 1.0.2 → 1.2.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/bin/dockup +2 -0
- package/dist/commands/agent.js +432 -0
- package/dist/commands/auth.js +123 -126
- package/dist/commands/database.js +315 -563
- package/dist/commands/env.js +125 -93
- package/dist/commands/link.js +148 -189
- package/dist/commands/logs.js +100 -82
- package/dist/commands/open.js +69 -41
- package/dist/commands/projects.js +128 -94
- package/dist/commands/push.js +138 -122
- package/dist/commands/service.js +143 -119
- package/dist/commands/status.js +116 -89
- package/dist/commands/workspace.js +210 -220
- package/dist/index.js +77 -179
- package/dist/lib/api.js +248 -185
- package/dist/lib/config.js +135 -142
- package/dist/lib/flags.js +36 -0
- package/dist/lib/output.js +65 -0
- package/dist/lib/target.js +40 -0
- package/dockupcli.md +211 -0
- package/package.json +13 -25
- package/dist/commands/auth.d.ts +0 -5
- package/dist/commands/database.d.ts +0 -16
- package/dist/commands/env.d.ts +0 -5
- package/dist/commands/link.d.ts +0 -2
- package/dist/commands/logs.d.ts +0 -4
- package/dist/commands/open.d.ts +0 -3
- package/dist/commands/projects.d.ts +0 -2
- package/dist/commands/push.d.ts +0 -3
- package/dist/commands/service.d.ts +0 -8
- package/dist/commands/status.d.ts +0 -1
- package/dist/commands/workspace.d.ts +0 -10
- package/dist/index.d.ts +0 -2
- package/dist/lib/api.d.ts +0 -39
- package/dist/lib/config.d.ts +0 -51
package/dist/commands/logs.js
CHANGED
|
@@ -1,91 +1,109 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var logs_exports = {};
|
|
30
|
+
__export(logs_exports, {
|
|
31
|
+
logs: () => logs
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(logs_exports);
|
|
34
|
+
var import_chalk = __toESM(require("chalk"));
|
|
35
|
+
var import_ora = __toESM(require("ora"));
|
|
36
|
+
var import_config = require("../lib/config");
|
|
37
|
+
var import_api = require("../lib/api");
|
|
11
38
|
async function logs(options) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
39
|
+
if (!(0, import_config.isLoggedIn)()) {
|
|
40
|
+
console.log(import_chalk.default.red("Not logged in. Run `dockup login` first."));
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
const config = (0, import_config.getProjectConfig)();
|
|
44
|
+
if (!config) {
|
|
45
|
+
console.log(import_chalk.default.red("Not linked to any service. Run `dockup link` first."));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
console.log(import_chalk.default.cyan(`
|
|
49
|
+
Logs for ${import_chalk.default.bold(config.projectName)}/${import_chalk.default.bold(config.serviceName)}
|
|
50
|
+
`));
|
|
51
|
+
const spinner = (0, import_ora.default)("Connecting to log stream...").start();
|
|
52
|
+
try {
|
|
53
|
+
const service = await import_api.api.getServiceStatus(config.projectSlug, config.serviceSlug);
|
|
54
|
+
spinner.stop();
|
|
55
|
+
const deployments = service.deployments || [];
|
|
56
|
+
if (deployments.length === 0) {
|
|
57
|
+
console.log(import_chalk.default.yellow(" No deployments found"));
|
|
58
|
+
return;
|
|
15
59
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
60
|
+
const latest = deployments[0];
|
|
61
|
+
console.log(import_chalk.default.dim(` Latest deployment: ${latest.id}`));
|
|
62
|
+
console.log(import_chalk.default.dim(` Status: ${latest.status}`));
|
|
63
|
+
console.log(import_chalk.default.dim(` Started: ${new Date(latest.startedAt || latest.createdAt).toLocaleString()}`));
|
|
64
|
+
if (latest.completedAt) {
|
|
65
|
+
console.log(import_chalk.default.dim(` Completed: ${new Date(latest.completedAt).toLocaleString()}`));
|
|
20
66
|
}
|
|
21
|
-
console.log(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
console.log(chalk_1.default.dim(` Started: ${new Date(latest.startedAt || latest.createdAt).toLocaleString()}`));
|
|
38
|
-
if (latest.completedAt) {
|
|
39
|
-
console.log(chalk_1.default.dim(` Completed: ${new Date(latest.completedAt).toLocaleString()}`));
|
|
40
|
-
}
|
|
41
|
-
console.log(chalk_1.default.dim('\n ─────────────────────────────────────────\n'));
|
|
42
|
-
// If there's a build log available
|
|
43
|
-
if (latest.buildLog) {
|
|
44
|
-
const lines = latest.buildLog.split('\n');
|
|
45
|
-
const tailLines = parseInt(options.tail || '100', 10);
|
|
46
|
-
const displayLines = lines.slice(-tailLines);
|
|
47
|
-
for (const line of displayLines) {
|
|
48
|
-
// Colorize common log patterns
|
|
49
|
-
if (line.includes('ERROR') || line.includes('error')) {
|
|
50
|
-
console.log(chalk_1.default.red(` ${line}`));
|
|
51
|
-
}
|
|
52
|
-
else if (line.includes('WARN') || line.includes('warn')) {
|
|
53
|
-
console.log(chalk_1.default.yellow(` ${line}`));
|
|
54
|
-
}
|
|
55
|
-
else if (line.includes('SUCCESS') || line.includes('success') || line.includes('✓')) {
|
|
56
|
-
console.log(chalk_1.default.green(` ${line}`));
|
|
57
|
-
}
|
|
58
|
-
else if (line.startsWith('#') || line.includes('Step')) {
|
|
59
|
-
console.log(chalk_1.default.cyan(` ${line}`));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
console.log(chalk_1.default.dim(` ${line}`));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (lines.length > tailLines) {
|
|
66
|
-
console.log(chalk_1.default.dim(`\n ... ${lines.length - tailLines} more lines (use --tail to see more)`));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
console.log(chalk_1.default.yellow(' No build logs available yet'));
|
|
71
|
-
}
|
|
72
|
-
console.log();
|
|
73
|
-
if (options.follow) {
|
|
74
|
-
console.log(chalk_1.default.dim(' Live log streaming coming soon...'));
|
|
75
|
-
console.log(chalk_1.default.dim(' Press Ctrl+C to exit\n'));
|
|
76
|
-
// Keep the process running for future WebSocket implementation
|
|
77
|
-
process.on('SIGINT', () => {
|
|
78
|
-
console.log(chalk_1.default.dim('\n Disconnected'));
|
|
79
|
-
process.exit(0);
|
|
80
|
-
});
|
|
81
|
-
// For now, just poll every 5 seconds
|
|
82
|
-
// setInterval(async () => {
|
|
83
|
-
// // Poll for new logs
|
|
84
|
-
// }, 5000);
|
|
67
|
+
console.log(import_chalk.default.dim("\n \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n"));
|
|
68
|
+
if (latest.buildLog) {
|
|
69
|
+
const lines = latest.buildLog.split("\n");
|
|
70
|
+
const tailLines = parseInt(options.tail || "100", 10);
|
|
71
|
+
const displayLines = lines.slice(-tailLines);
|
|
72
|
+
for (const line of displayLines) {
|
|
73
|
+
if (line.includes("ERROR") || line.includes("error")) {
|
|
74
|
+
console.log(import_chalk.default.red(` ${line}`));
|
|
75
|
+
} else if (line.includes("WARN") || line.includes("warn")) {
|
|
76
|
+
console.log(import_chalk.default.yellow(` ${line}`));
|
|
77
|
+
} else if (line.includes("SUCCESS") || line.includes("success") || line.includes("\u2713")) {
|
|
78
|
+
console.log(import_chalk.default.green(` ${line}`));
|
|
79
|
+
} else if (line.startsWith("#") || line.includes("Step")) {
|
|
80
|
+
console.log(import_chalk.default.cyan(` ${line}`));
|
|
81
|
+
} else {
|
|
82
|
+
console.log(import_chalk.default.dim(` ${line}`));
|
|
85
83
|
}
|
|
84
|
+
}
|
|
85
|
+
if (lines.length > tailLines) {
|
|
86
|
+
console.log(import_chalk.default.dim(`
|
|
87
|
+
... ${lines.length - tailLines} more lines (use --tail to see more)`));
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
console.log(import_chalk.default.yellow(" No build logs available yet"));
|
|
86
91
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
console.log();
|
|
93
|
+
if (options.follow) {
|
|
94
|
+
console.log(import_chalk.default.dim(" Live log streaming coming soon..."));
|
|
95
|
+
console.log(import_chalk.default.dim(" Press Ctrl+C to exit\n"));
|
|
96
|
+
process.on("SIGINT", () => {
|
|
97
|
+
console.log(import_chalk.default.dim("\n Disconnected"));
|
|
98
|
+
process.exit(0);
|
|
99
|
+
});
|
|
90
100
|
}
|
|
101
|
+
} catch (error) {
|
|
102
|
+
spinner.fail(`Failed to fetch logs: ${error.message}`);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
91
105
|
}
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
logs
|
|
109
|
+
});
|
package/dist/commands/open.js
CHANGED
|
@@ -1,46 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var open_exports = {};
|
|
30
|
+
__export(open_exports, {
|
|
31
|
+
open: () => open
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(open_exports);
|
|
34
|
+
var import_chalk = __toESM(require("chalk"));
|
|
35
|
+
var import_ora = __toESM(require("ora"));
|
|
36
|
+
var import_open = __toESM(require("open"));
|
|
37
|
+
var import_config = require("../lib/config");
|
|
38
|
+
var import_api = require("../lib/api");
|
|
12
39
|
async function open(options) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
console.log(chalk_1.default.yellow('Service has no domain yet'));
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
const url = `https://${service.domain}`;
|
|
39
|
-
console.log(chalk_1.default.dim(`Opening: ${url}`));
|
|
40
|
-
await (0, open_1.default)(url);
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
spinner.fail(`Failed to fetch service: ${error.message}`);
|
|
44
|
-
process.exit(1);
|
|
40
|
+
if (!(0, import_config.isLoggedIn)()) {
|
|
41
|
+
console.log(import_chalk.default.red("Not logged in. Run `dockup login` first."));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
const config = (0, import_config.getProjectConfig)();
|
|
45
|
+
if (!config) {
|
|
46
|
+
console.log(import_chalk.default.red("Not linked to any service. Run `dockup link` first."));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
if (options.dashboard) {
|
|
50
|
+
const dashboardUrl = `${(0, import_config.getApiUrl)().replace("deploy-api", "app")}/projects/${config.projectSlug}/services/${config.serviceSlug}`;
|
|
51
|
+
console.log(import_chalk.default.dim(`Opening dashboard: ${dashboardUrl}`));
|
|
52
|
+
await (0, import_open.default)(dashboardUrl);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const spinner = (0, import_ora.default)("Fetching service URL...").start();
|
|
56
|
+
try {
|
|
57
|
+
const service = await import_api.api.getServiceStatus(config.projectSlug, config.serviceSlug);
|
|
58
|
+
spinner.stop();
|
|
59
|
+
if (!service.domain) {
|
|
60
|
+
console.log(import_chalk.default.yellow("Service has no domain yet"));
|
|
61
|
+
process.exit(1);
|
|
45
62
|
}
|
|
63
|
+
const url = `https://${service.domain}`;
|
|
64
|
+
console.log(import_chalk.default.dim(`Opening: ${url}`));
|
|
65
|
+
await (0, import_open.default)(url);
|
|
66
|
+
} catch (error) {
|
|
67
|
+
spinner.fail(`Failed to fetch service: ${error.message}`);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
46
70
|
}
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
open
|
|
74
|
+
});
|
|
@@ -1,105 +1,139 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
11
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var projects_exports = {};
|
|
30
|
+
__export(projects_exports, {
|
|
31
|
+
listProjects: () => listProjects,
|
|
32
|
+
listServices: () => listServices
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(projects_exports);
|
|
35
|
+
var import_chalk = __toESM(require("chalk"));
|
|
36
|
+
var import_ora = __toESM(require("ora"));
|
|
37
|
+
var import_inquirer = __toESM(require("inquirer"));
|
|
38
|
+
var import_config = require("../lib/config");
|
|
39
|
+
var import_api = require("../lib/api");
|
|
13
40
|
async function listProjects() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
console.log(chalk_1.default.cyan('\n Your Projects:\n'));
|
|
28
|
-
for (const project of projects) {
|
|
29
|
-
const serviceCount = project.serviceCount || 0;
|
|
30
|
-
const dbCount = project.databaseCount || 0;
|
|
31
|
-
console.log(` ${chalk_1.default.bold(project.name)} ${chalk_1.default.dim(`(${project.slug})`)}`);
|
|
32
|
-
console.log(chalk_1.default.dim(` Services: ${serviceCount} | Databases: ${dbCount}`));
|
|
33
|
-
console.log();
|
|
34
|
-
}
|
|
35
|
-
console.log(chalk_1.default.dim(` Total: ${projects.length} project(s)\n`));
|
|
41
|
+
if (!(0, import_config.isLoggedIn)()) {
|
|
42
|
+
console.log(import_chalk.default.red("Not logged in. Run `dockup login` first."));
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
const spinner = (0, import_ora.default)("Loading projects...").start();
|
|
46
|
+
try {
|
|
47
|
+
const projects = await import_api.api.getProjects();
|
|
48
|
+
spinner.stop();
|
|
49
|
+
if (projects.length === 0) {
|
|
50
|
+
console.log(import_chalk.default.yellow("\n No projects found."));
|
|
51
|
+
console.log(import_chalk.default.dim(" Create one at https://app.dockup.ai\n"));
|
|
52
|
+
return;
|
|
36
53
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
54
|
+
console.log(import_chalk.default.cyan("\n Your Projects:\n"));
|
|
55
|
+
for (const project of projects) {
|
|
56
|
+
const serviceCount = project.serviceCount || 0;
|
|
57
|
+
const dbCount = project.databaseCount || 0;
|
|
58
|
+
console.log(` ${import_chalk.default.bold(project.name)} ${import_chalk.default.dim(`(${project.slug})`)}`);
|
|
59
|
+
console.log(import_chalk.default.dim(` Services: ${serviceCount} | Databases: ${dbCount}`));
|
|
60
|
+
console.log();
|
|
40
61
|
}
|
|
62
|
+
console.log(import_chalk.default.dim(` Total: ${projects.length} project(s)
|
|
63
|
+
`));
|
|
64
|
+
} catch (error) {
|
|
65
|
+
spinner.fail(`Failed to load projects: ${error.message}`);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
41
68
|
}
|
|
42
69
|
async function listServices(projectSlug) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
70
|
+
if (!(0, import_config.isLoggedIn)()) {
|
|
71
|
+
console.log(import_chalk.default.red("Not logged in. Run `dockup login` first."));
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
const spinner = (0, import_ora.default)("Loading...").start();
|
|
75
|
+
try {
|
|
76
|
+
if (!projectSlug) {
|
|
77
|
+
const projects = await import_api.api.getProjects();
|
|
78
|
+
spinner.stop();
|
|
79
|
+
if (projects.length === 0) {
|
|
80
|
+
console.log(import_chalk.default.yellow("No projects found."));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const { selected } = await import_inquirer.default.prompt([{
|
|
84
|
+
type: "list",
|
|
85
|
+
name: "selected",
|
|
86
|
+
message: "Select a project:",
|
|
87
|
+
choices: projects.map((p) => ({
|
|
88
|
+
name: `${p.name} ${import_chalk.default.dim(`(${p.slug})`)}`,
|
|
89
|
+
value: p.slug
|
|
90
|
+
}))
|
|
91
|
+
}]);
|
|
92
|
+
projectSlug = selected;
|
|
93
|
+
spinner.start("Loading services...");
|
|
46
94
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (projects.length === 0) {
|
|
54
|
-
console.log(chalk_1.default.yellow('No projects found.'));
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const { selected } = await inquirer_1.default.prompt([{
|
|
58
|
-
type: 'list',
|
|
59
|
-
name: 'selected',
|
|
60
|
-
message: 'Select a project:',
|
|
61
|
-
choices: projects.map(p => ({
|
|
62
|
-
name: `${p.name} ${chalk_1.default.dim(`(${p.slug})`)}`,
|
|
63
|
-
value: p.slug
|
|
64
|
-
}))
|
|
65
|
-
}]);
|
|
66
|
-
projectSlug = selected;
|
|
67
|
-
spinner.start('Loading services...');
|
|
68
|
-
}
|
|
69
|
-
const services = await api_1.api.getServices(projectSlug);
|
|
70
|
-
spinner.stop();
|
|
71
|
-
if (services.length === 0) {
|
|
72
|
-
console.log(chalk_1.default.yellow(`\n No services in ${projectSlug}`));
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
console.log(chalk_1.default.cyan(`\n Services in ${chalk_1.default.bold(projectSlug)}:\n`));
|
|
76
|
-
for (const service of services) {
|
|
77
|
-
const statusColors = {
|
|
78
|
-
running: chalk_1.default.green,
|
|
79
|
-
building: chalk_1.default.yellow,
|
|
80
|
-
deploying: chalk_1.default.blue,
|
|
81
|
-
stopped: chalk_1.default.red,
|
|
82
|
-
error: chalk_1.default.red,
|
|
83
|
-
pending: chalk_1.default.gray
|
|
84
|
-
};
|
|
85
|
-
const statusColor = statusColors[service.status] || chalk_1.default.gray;
|
|
86
|
-
const statusIcons = {
|
|
87
|
-
running: '●',
|
|
88
|
-
building: '◐',
|
|
89
|
-
deploying: '◐',
|
|
90
|
-
stopped: '○',
|
|
91
|
-
error: '✗',
|
|
92
|
-
pending: '○'
|
|
93
|
-
};
|
|
94
|
-
const statusIcon = statusIcons[service.status] || '?';
|
|
95
|
-
console.log(` ${statusColor(statusIcon)} ${chalk_1.default.bold(service.name)} ${chalk_1.default.dim(`(${service.slug})`)}`);
|
|
96
|
-
console.log(chalk_1.default.dim(` Status: ${service.status} | Domain: ${service.domain || 'N/A'}`));
|
|
97
|
-
console.log();
|
|
98
|
-
}
|
|
99
|
-
console.log(chalk_1.default.dim(` Total: ${services.length} service(s)\n`));
|
|
95
|
+
const services = await import_api.api.getServices(projectSlug);
|
|
96
|
+
spinner.stop();
|
|
97
|
+
if (services.length === 0) {
|
|
98
|
+
console.log(import_chalk.default.yellow(`
|
|
99
|
+
No services in ${projectSlug}`));
|
|
100
|
+
return;
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
console.log(import_chalk.default.cyan(`
|
|
103
|
+
Services in ${import_chalk.default.bold(projectSlug)}:
|
|
104
|
+
`));
|
|
105
|
+
for (const service of services) {
|
|
106
|
+
const statusColors = {
|
|
107
|
+
running: import_chalk.default.green,
|
|
108
|
+
building: import_chalk.default.yellow,
|
|
109
|
+
deploying: import_chalk.default.blue,
|
|
110
|
+
stopped: import_chalk.default.red,
|
|
111
|
+
error: import_chalk.default.red,
|
|
112
|
+
pending: import_chalk.default.gray
|
|
113
|
+
};
|
|
114
|
+
const statusColor = statusColors[service.status] || import_chalk.default.gray;
|
|
115
|
+
const statusIcons = {
|
|
116
|
+
running: "\u25CF",
|
|
117
|
+
building: "\u25D0",
|
|
118
|
+
deploying: "\u25D0",
|
|
119
|
+
stopped: "\u25CB",
|
|
120
|
+
error: "\u2717",
|
|
121
|
+
pending: "\u25CB"
|
|
122
|
+
};
|
|
123
|
+
const statusIcon = statusIcons[service.status] || "?";
|
|
124
|
+
console.log(` ${statusColor(statusIcon)} ${import_chalk.default.bold(service.name)} ${import_chalk.default.dim(`(${service.slug})`)}`);
|
|
125
|
+
console.log(import_chalk.default.dim(` Status: ${service.status} | Domain: ${service.domain || "N/A"}`));
|
|
126
|
+
console.log();
|
|
104
127
|
}
|
|
128
|
+
console.log(import_chalk.default.dim(` Total: ${services.length} service(s)
|
|
129
|
+
`));
|
|
130
|
+
} catch (error) {
|
|
131
|
+
spinner.fail(`Failed to load services: ${error.message}`);
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
105
134
|
}
|
|
135
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
136
|
+
0 && (module.exports = {
|
|
137
|
+
listProjects,
|
|
138
|
+
listServices
|
|
139
|
+
});
|