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.
@@ -1,96 +1,123 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
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
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.status = status;
7
- const chalk_1 = __importDefault(require("chalk"));
8
- const ora_1 = __importDefault(require("ora"));
9
- const config_1 = require("../lib/config");
10
- const api_1 = require("../lib/api");
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 status_exports = {};
30
+ __export(status_exports, {
31
+ status: () => status
32
+ });
33
+ module.exports = __toCommonJS(status_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 status() {
12
- if (!(0, config_1.isLoggedIn)()) {
13
- console.log(chalk_1.default.red('Not logged in. Run `dockup login` first.'));
14
- process.exit(1);
15
- }
16
- const config = (0, config_1.getProjectConfig)();
17
- if (!config) {
18
- console.log(chalk_1.default.red('Not linked to any service. Run `dockup link` first.'));
19
- process.exit(1);
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
+ const spinner = (0, import_ora.default)("Fetching service status...").start();
49
+ try {
50
+ const service = await import_api.api.getServiceStatus(config.projectSlug, config.serviceSlug);
51
+ spinner.stop();
52
+ console.log(import_chalk.default.cyan(`
53
+ Service Status: ${import_chalk.default.bold(config.serviceName)}
54
+ `));
55
+ const statusColorMap = {
56
+ running: import_chalk.default.green,
57
+ building: import_chalk.default.yellow,
58
+ deploying: import_chalk.default.blue,
59
+ stopped: import_chalk.default.red,
60
+ error: import_chalk.default.red,
61
+ pending: import_chalk.default.gray
62
+ };
63
+ const statusColor = statusColorMap[service.status] || import_chalk.default.gray;
64
+ const statusIconMap = {
65
+ running: "\u25CF",
66
+ building: "\u25D0",
67
+ deploying: "\u25D0",
68
+ stopped: "\u25CB",
69
+ error: "\u2717",
70
+ pending: "\u25CB"
71
+ };
72
+ const statusIcon = statusIconMap[service.status] || "?";
73
+ console.log(` ${import_chalk.default.dim("Status:")} ${statusColor(`${statusIcon} ${service.status.toUpperCase()}`)}`);
74
+ console.log(` ${import_chalk.default.dim("Domain:")} ${import_chalk.default.cyan(service.domain || "N/A")}`);
75
+ console.log(` ${import_chalk.default.dim("Port:")} ${service.port || "N/A"}`);
76
+ console.log(` ${import_chalk.default.dim("Repository:")} ${service.repoUrl || "N/A"}`);
77
+ console.log(` ${import_chalk.default.dim("Branch:")} ${service.branch || "main"}`);
78
+ if (service.memoryLimit || service.cpuLimit) {
79
+ console.log(import_chalk.default.dim("\n Resources:"));
80
+ if (service.memoryLimit) {
81
+ console.log(` ${import_chalk.default.dim("Memory:")} ${service.memoryLimit}MB`);
82
+ }
83
+ if (service.cpuLimit) {
84
+ console.log(` ${import_chalk.default.dim("CPU:")} ${service.cpuLimit} cores`);
85
+ }
20
86
  }
21
- const spinner = (0, ora_1.default)('Fetching service status...').start();
22
- try {
23
- const service = await api_1.api.getServiceStatus(config.projectSlug, config.serviceSlug);
24
- spinner.stop();
25
- console.log(chalk_1.default.cyan(`\n Service Status: ${chalk_1.default.bold(config.serviceName)}\n`));
26
- const statusColorMap = {
27
- running: chalk_1.default.green,
28
- building: chalk_1.default.yellow,
29
- deploying: chalk_1.default.blue,
30
- stopped: chalk_1.default.red,
31
- error: chalk_1.default.red,
32
- pending: chalk_1.default.gray
33
- };
34
- const statusColor = statusColorMap[service.status] || chalk_1.default.gray;
35
- const statusIconMap = {
36
- running: '●',
37
- building: '◐',
38
- deploying: '◐',
39
- stopped: '○',
40
- error: '✗',
41
- pending: '○'
42
- };
43
- const statusIcon = statusIconMap[service.status] || '?';
44
- console.log(` ${chalk_1.default.dim('Status:')} ${statusColor(`${statusIcon} ${service.status.toUpperCase()}`)}`);
45
- console.log(` ${chalk_1.default.dim('Domain:')} ${chalk_1.default.cyan(service.domain || 'N/A')}`);
46
- console.log(` ${chalk_1.default.dim('Port:')} ${service.port || 'N/A'}`);
47
- console.log(` ${chalk_1.default.dim('Repository:')} ${service.repoUrl || 'N/A'}`);
48
- console.log(` ${chalk_1.default.dim('Branch:')} ${service.branch || 'main'}`);
49
- // Resource usage
50
- if (service.memoryLimit || service.cpuLimit) {
51
- console.log(chalk_1.default.dim('\n Resources:'));
52
- if (service.memoryLimit) {
53
- console.log(` ${chalk_1.default.dim('Memory:')} ${service.memoryLimit}MB`);
54
- }
55
- if (service.cpuLimit) {
56
- console.log(` ${chalk_1.default.dim('CPU:')} ${service.cpuLimit} cores`);
57
- }
58
- }
59
- // Latest deployment
60
- const deployments = service.deployments || [];
61
- if (deployments.length > 0) {
62
- const latest = deployments[0];
63
- console.log(chalk_1.default.dim('\n Latest Deployment:'));
64
- console.log(` ${chalk_1.default.dim('ID:')} ${latest.id.substring(0, 8)}`);
65
- console.log(` ${chalk_1.default.dim('Status:')} ${latest.status}`);
66
- console.log(` ${chalk_1.default.dim('Commit:')} ${latest.commitHash?.substring(0, 7) || 'N/A'}`);
67
- if (latest.commitMessage) {
68
- const msg = latest.commitMessage.length > 50
69
- ? latest.commitMessage.substring(0, 50) + '...'
70
- : latest.commitMessage;
71
- console.log(` ${chalk_1.default.dim('Message:')} ${msg}`);
72
- }
73
- if (latest.startedAt) {
74
- console.log(` ${chalk_1.default.dim('Started:')} ${new Date(latest.startedAt).toLocaleString()}`);
75
- }
76
- if (latest.completedAt) {
77
- const duration = new Date(latest.completedAt).getTime() - new Date(latest.startedAt).getTime();
78
- const seconds = Math.floor(duration / 1000);
79
- console.log(` ${chalk_1.default.dim('Duration:')} ${seconds}s`);
80
- }
81
- }
82
- // Custom domains
83
- if (service.customDomains && service.customDomains.length > 0) {
84
- console.log(chalk_1.default.dim('\n Custom Domains:'));
85
- for (const domain of service.customDomains) {
86
- const sslBadge = domain.sslEnabled ? chalk_1.default.green(' [SSL]') : chalk_1.default.yellow(' [No SSL]');
87
- console.log(` ${chalk_1.default.cyan(domain.domain)}${sslBadge}`);
88
- }
89
- }
90
- console.log();
87
+ const deployments = service.deployments || [];
88
+ if (deployments.length > 0) {
89
+ const latest = deployments[0];
90
+ console.log(import_chalk.default.dim("\n Latest Deployment:"));
91
+ console.log(` ${import_chalk.default.dim("ID:")} ${latest.id.substring(0, 8)}`);
92
+ console.log(` ${import_chalk.default.dim("Status:")} ${latest.status}`);
93
+ console.log(` ${import_chalk.default.dim("Commit:")} ${latest.commitHash?.substring(0, 7) || "N/A"}`);
94
+ if (latest.commitMessage) {
95
+ const msg = latest.commitMessage.length > 50 ? latest.commitMessage.substring(0, 50) + "..." : latest.commitMessage;
96
+ console.log(` ${import_chalk.default.dim("Message:")} ${msg}`);
97
+ }
98
+ if (latest.startedAt) {
99
+ console.log(` ${import_chalk.default.dim("Started:")} ${new Date(latest.startedAt).toLocaleString()}`);
100
+ }
101
+ if (latest.completedAt) {
102
+ const duration = new Date(latest.completedAt).getTime() - new Date(latest.startedAt).getTime();
103
+ const seconds = Math.floor(duration / 1e3);
104
+ console.log(` ${import_chalk.default.dim("Duration:")} ${seconds}s`);
105
+ }
91
106
  }
92
- catch (error) {
93
- spinner.fail(`Failed to fetch status: ${error.message}`);
94
- process.exit(1);
107
+ if (service.customDomains && service.customDomains.length > 0) {
108
+ console.log(import_chalk.default.dim("\n Custom Domains:"));
109
+ for (const domain of service.customDomains) {
110
+ const sslBadge = domain.sslEnabled ? import_chalk.default.green(" [SSL]") : import_chalk.default.yellow(" [No SSL]");
111
+ console.log(` ${import_chalk.default.cyan(domain.domain)}${sslBadge}`);
112
+ }
95
113
  }
114
+ console.log();
115
+ } catch (error) {
116
+ spinner.fail(`Failed to fetch status: ${error.message}`);
117
+ process.exit(1);
118
+ }
96
119
  }
120
+ // Annotate the CommonJS export names for ESM import in node:
121
+ 0 && (module.exports = {
122
+ status
123
+ });