dockup-cli 1.0.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/dist/commands/auth.d.ts +5 -0
- package/dist/commands/auth.js +140 -0
- package/dist/commands/database.d.ts +16 -0
- package/dist/commands/database.js +584 -0
- package/dist/commands/env.d.ts +5 -0
- package/dist/commands/env.js +103 -0
- package/dist/commands/link.d.ts +2 -0
- package/dist/commands/link.js +135 -0
- package/dist/commands/logs.d.ts +4 -0
- package/dist/commands/logs.js +91 -0
- package/dist/commands/open.d.ts +3 -0
- package/dist/commands/open.js +46 -0
- package/dist/commands/projects.d.ts +2 -0
- package/dist/commands/projects.js +105 -0
- package/dist/commands/push.d.ts +3 -0
- package/dist/commands/push.js +135 -0
- package/dist/commands/service.d.ts +8 -0
- package/dist/commands/service.js +133 -0
- package/dist/commands/status.d.ts +1 -0
- package/dist/commands/status.js +96 -0
- package/dist/commands/workspace.d.ts +10 -0
- package/dist/commands/workspace.js +240 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +186 -0
- package/dist/lib/api.d.ts +39 -0
- package/dist/lib/api.js +196 -0
- package/dist/lib/config.d.ts +51 -0
- package/dist/lib/config.js +176 -0
- package/package.json +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function status(): Promise<void>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
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");
|
|
11
|
+
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);
|
|
20
|
+
}
|
|
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();
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
spinner.fail(`Failed to fetch status: ${error.message}`);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function workspaceList(): Promise<void>;
|
|
2
|
+
export declare function workspaceCreate(options: {
|
|
3
|
+
name?: string;
|
|
4
|
+
}): Promise<void>;
|
|
5
|
+
export declare function workspaceSelect(): Promise<void>;
|
|
6
|
+
export declare function workspaceRename(options: {
|
|
7
|
+
name?: string;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
export declare function workspaceDelete(): Promise<void>;
|
|
10
|
+
export declare function workspaceCurrent(): Promise<void>;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.workspaceList = workspaceList;
|
|
40
|
+
exports.workspaceCreate = workspaceCreate;
|
|
41
|
+
exports.workspaceSelect = workspaceSelect;
|
|
42
|
+
exports.workspaceRename = workspaceRename;
|
|
43
|
+
exports.workspaceDelete = workspaceDelete;
|
|
44
|
+
exports.workspaceCurrent = workspaceCurrent;
|
|
45
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
46
|
+
const ora_1 = __importDefault(require("ora"));
|
|
47
|
+
const readline = __importStar(require("readline"));
|
|
48
|
+
const config_1 = require("../lib/config");
|
|
49
|
+
const api_1 = require("../lib/api");
|
|
50
|
+
function question(prompt) {
|
|
51
|
+
const rl = readline.createInterface({
|
|
52
|
+
input: process.stdin,
|
|
53
|
+
output: process.stdout
|
|
54
|
+
});
|
|
55
|
+
return new Promise((resolve) => {
|
|
56
|
+
rl.question(prompt, (answer) => {
|
|
57
|
+
rl.close();
|
|
58
|
+
resolve(answer);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function requireAuth() {
|
|
63
|
+
if (!(0, config_1.isLoggedIn)()) {
|
|
64
|
+
console.log(chalk_1.default.red('Not logged in. Run `dockup login` first.'));
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
async function workspaceList() {
|
|
70
|
+
if (!requireAuth())
|
|
71
|
+
return;
|
|
72
|
+
const spinner = (0, ora_1.default)('Fetching workspaces...').start();
|
|
73
|
+
try {
|
|
74
|
+
const workspaces = await api_1.api.getWorkspaces();
|
|
75
|
+
spinner.stop();
|
|
76
|
+
if (workspaces.length === 0) {
|
|
77
|
+
console.log(chalk_1.default.yellow('\nNo workspaces found. Create one with `dockup workspace create`'));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const currentWs = (0, config_1.getCurrentWorkspace)();
|
|
81
|
+
console.log(chalk_1.default.cyan('\n Your Workspaces:\n'));
|
|
82
|
+
workspaces.forEach((ws) => {
|
|
83
|
+
const isCurrent = currentWs?.id === ws.id;
|
|
84
|
+
const marker = isCurrent ? chalk_1.default.green('● ') : ' ';
|
|
85
|
+
const name = isCurrent ? chalk_1.default.green(ws.name) : ws.name;
|
|
86
|
+
const slug = chalk_1.default.dim(`(${ws.slug})`);
|
|
87
|
+
const dbCount = chalk_1.default.dim(`${ws._count?.databases || 0} databases`);
|
|
88
|
+
console.log(`${marker}${name} ${slug} - ${dbCount}`);
|
|
89
|
+
});
|
|
90
|
+
console.log();
|
|
91
|
+
if (currentWs) {
|
|
92
|
+
console.log(chalk_1.default.dim(`Current workspace: ${currentWs.name}`));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
console.log(chalk_1.default.dim('No workspace selected. Run `dockup workspace select` to choose one.'));
|
|
96
|
+
}
|
|
97
|
+
console.log();
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
spinner.fail(`Failed to fetch workspaces: ${error.message}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async function workspaceCreate(options) {
|
|
104
|
+
if (!requireAuth())
|
|
105
|
+
return;
|
|
106
|
+
let name = options.name;
|
|
107
|
+
if (!name) {
|
|
108
|
+
name = await question('Workspace name: ');
|
|
109
|
+
if (!name || name.trim() === '') {
|
|
110
|
+
console.log(chalk_1.default.red('Name is required'));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
name = name.trim();
|
|
114
|
+
}
|
|
115
|
+
const spinner = (0, ora_1.default)('Creating workspace...').start();
|
|
116
|
+
try {
|
|
117
|
+
const workspace = await api_1.api.createWorkspace(name);
|
|
118
|
+
spinner.succeed(`Workspace "${chalk_1.default.green(workspace.name)}" created successfully`);
|
|
119
|
+
// Auto-select the new workspace
|
|
120
|
+
(0, config_1.setCurrentWorkspace)({
|
|
121
|
+
id: workspace.id,
|
|
122
|
+
name: workspace.name,
|
|
123
|
+
slug: workspace.slug
|
|
124
|
+
});
|
|
125
|
+
console.log(chalk_1.default.dim(`Workspace selected: ${workspace.name}`));
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
spinner.fail(`Failed to create workspace: ${error.message}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async function workspaceSelect() {
|
|
132
|
+
if (!requireAuth())
|
|
133
|
+
return;
|
|
134
|
+
const spinner = (0, ora_1.default)('Fetching workspaces...').start();
|
|
135
|
+
try {
|
|
136
|
+
const workspaces = await api_1.api.getWorkspaces();
|
|
137
|
+
spinner.stop();
|
|
138
|
+
if (workspaces.length === 0) {
|
|
139
|
+
console.log(chalk_1.default.yellow('\nNo workspaces found. Create one with `dockup workspace create`'));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const currentWs = (0, config_1.getCurrentWorkspace)();
|
|
143
|
+
console.log(chalk_1.default.cyan('\n Select a workspace:\n'));
|
|
144
|
+
workspaces.forEach((ws, index) => {
|
|
145
|
+
const isCurrent = currentWs?.id === ws.id;
|
|
146
|
+
const marker = isCurrent ? chalk_1.default.green('●') : ' ';
|
|
147
|
+
console.log(` ${marker} ${index + 1}. ${ws.name} ${chalk_1.default.dim(`(${ws.slug})`)}`);
|
|
148
|
+
});
|
|
149
|
+
console.log();
|
|
150
|
+
const answer = await question('Enter number: ');
|
|
151
|
+
const index = parseInt(answer) - 1;
|
|
152
|
+
if (isNaN(index) || index < 0 || index >= workspaces.length) {
|
|
153
|
+
console.log(chalk_1.default.red('Invalid selection'));
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const selected = workspaces[index];
|
|
157
|
+
(0, config_1.setCurrentWorkspace)({
|
|
158
|
+
id: selected.id,
|
|
159
|
+
name: selected.name,
|
|
160
|
+
slug: selected.slug
|
|
161
|
+
});
|
|
162
|
+
console.log(chalk_1.default.green(`✓ Workspace "${selected.name}" selected`));
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
spinner.fail(`Failed to select workspace: ${error.message}`);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async function workspaceRename(options) {
|
|
169
|
+
if (!requireAuth())
|
|
170
|
+
return;
|
|
171
|
+
const currentWs = (0, config_1.getCurrentWorkspace)();
|
|
172
|
+
if (!currentWs) {
|
|
173
|
+
console.log(chalk_1.default.yellow('No workspace selected. Run `dockup workspace select` first.'));
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
let newName = options.name;
|
|
177
|
+
if (!newName) {
|
|
178
|
+
newName = await question(`New name for "${currentWs.name}" (enter to keep): `);
|
|
179
|
+
if (!newName || newName.trim() === '') {
|
|
180
|
+
newName = currentWs.name;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
newName = newName.trim();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const spinner = (0, ora_1.default)('Renaming workspace...').start();
|
|
187
|
+
try {
|
|
188
|
+
const workspace = await api_1.api.renameWorkspace(currentWs.id, newName);
|
|
189
|
+
spinner.succeed(`Workspace renamed to "${chalk_1.default.green(workspace.name)}"`);
|
|
190
|
+
// Update local config
|
|
191
|
+
(0, config_1.setCurrentWorkspace)({
|
|
192
|
+
id: workspace.id,
|
|
193
|
+
name: workspace.name,
|
|
194
|
+
slug: workspace.slug
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
spinner.fail(`Failed to rename workspace: ${error.message}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async function workspaceDelete() {
|
|
202
|
+
if (!requireAuth())
|
|
203
|
+
return;
|
|
204
|
+
const currentWs = (0, config_1.getCurrentWorkspace)();
|
|
205
|
+
if (!currentWs) {
|
|
206
|
+
console.log(chalk_1.default.yellow('No workspace selected. Run `dockup workspace select` first.'));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
console.log(chalk_1.default.red(`\n WARNING: This will delete "${currentWs.name}" and all its databases!\n`));
|
|
210
|
+
const answer = await question('Type workspace name to confirm: ');
|
|
211
|
+
if (answer !== currentWs.name) {
|
|
212
|
+
console.log(chalk_1.default.dim('Cancelled'));
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const spinner = (0, ora_1.default)('Deleting workspace...').start();
|
|
216
|
+
try {
|
|
217
|
+
await api_1.api.deleteWorkspace(currentWs.id);
|
|
218
|
+
spinner.succeed(`Workspace "${currentWs.name}" deleted`);
|
|
219
|
+
(0, config_1.clearCurrentWorkspace)();
|
|
220
|
+
console.log(chalk_1.default.dim('Run `dockup workspace select` to select another workspace.'));
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
spinner.fail(`Failed to delete workspace: ${error.message}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
async function workspaceCurrent() {
|
|
227
|
+
if (!requireAuth())
|
|
228
|
+
return;
|
|
229
|
+
const currentWs = (0, config_1.getCurrentWorkspace)();
|
|
230
|
+
if (!currentWs) {
|
|
231
|
+
console.log(chalk_1.default.yellow('No workspace selected.'));
|
|
232
|
+
console.log(chalk_1.default.dim('Run `dockup workspace select` to choose one.'));
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
console.log(chalk_1.default.cyan('\n Current Workspace:\n'));
|
|
236
|
+
console.log(` ${chalk_1.default.dim('Name:')} ${currentWs.name}`);
|
|
237
|
+
console.log(` ${chalk_1.default.dim('Slug:')} ${currentWs.slug}`);
|
|
238
|
+
console.log(` ${chalk_1.default.dim('ID:')} ${currentWs.id}`);
|
|
239
|
+
console.log();
|
|
240
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const auth_1 = require("./commands/auth");
|
|
10
|
+
const link_1 = require("./commands/link");
|
|
11
|
+
const push_1 = require("./commands/push");
|
|
12
|
+
const logs_1 = require("./commands/logs");
|
|
13
|
+
const env_1 = require("./commands/env");
|
|
14
|
+
const status_1 = require("./commands/status");
|
|
15
|
+
const open_1 = require("./commands/open");
|
|
16
|
+
const workspace_1 = require("./commands/workspace");
|
|
17
|
+
const database_1 = require("./commands/database");
|
|
18
|
+
const program = new commander_1.Command();
|
|
19
|
+
program
|
|
20
|
+
.name('dockup')
|
|
21
|
+
.description('Dockup CLI - Deploy from your terminal')
|
|
22
|
+
.version('1.0.0');
|
|
23
|
+
// Auth commands
|
|
24
|
+
program
|
|
25
|
+
.command('login')
|
|
26
|
+
.description('Authenticate with Dockup')
|
|
27
|
+
.option('-t, --token <token>', 'Use API token directly')
|
|
28
|
+
.action(auth_1.login);
|
|
29
|
+
program
|
|
30
|
+
.command('logout')
|
|
31
|
+
.description('Log out from Dockup')
|
|
32
|
+
.action(auth_1.logout);
|
|
33
|
+
program
|
|
34
|
+
.command('whoami')
|
|
35
|
+
.description('Show current logged in user')
|
|
36
|
+
.action(auth_1.whoami);
|
|
37
|
+
// Project linking
|
|
38
|
+
program
|
|
39
|
+
.command('link [project/service]')
|
|
40
|
+
.description('Link current directory to a Dockup service')
|
|
41
|
+
.action(link_1.link);
|
|
42
|
+
program
|
|
43
|
+
.command('unlink')
|
|
44
|
+
.description('Unlink current directory from Dockup')
|
|
45
|
+
.action(link_1.unlink);
|
|
46
|
+
// Deploy
|
|
47
|
+
program
|
|
48
|
+
.command('push [branch]')
|
|
49
|
+
.description('Push and deploy to Dockup')
|
|
50
|
+
.option('-f, --force', 'Force deploy without git push')
|
|
51
|
+
.action(push_1.push);
|
|
52
|
+
// Logs
|
|
53
|
+
program
|
|
54
|
+
.command('logs')
|
|
55
|
+
.description('Stream live logs from your service')
|
|
56
|
+
.option('-n, --tail <lines>', 'Number of lines to show', '100')
|
|
57
|
+
.option('-f, --follow', 'Follow log output', true)
|
|
58
|
+
.action(logs_1.logs);
|
|
59
|
+
// Environment variables
|
|
60
|
+
const envCmd = program.command('env').description('Manage environment variables');
|
|
61
|
+
envCmd
|
|
62
|
+
.command('list')
|
|
63
|
+
.alias('ls')
|
|
64
|
+
.description('List environment variables')
|
|
65
|
+
.action(env_1.envList);
|
|
66
|
+
envCmd
|
|
67
|
+
.command('set <key=value>')
|
|
68
|
+
.description('Set an environment variable')
|
|
69
|
+
.option('-s, --secret', 'Mark as secret')
|
|
70
|
+
.action(env_1.envSet);
|
|
71
|
+
envCmd
|
|
72
|
+
.command('remove <key>')
|
|
73
|
+
.alias('rm')
|
|
74
|
+
.description('Remove an environment variable')
|
|
75
|
+
.action(env_1.envRemove);
|
|
76
|
+
// Status
|
|
77
|
+
program
|
|
78
|
+
.command('status')
|
|
79
|
+
.description('Show service status')
|
|
80
|
+
.action(status_1.status);
|
|
81
|
+
// Open in browser
|
|
82
|
+
program
|
|
83
|
+
.command('open')
|
|
84
|
+
.description('Open service in browser')
|
|
85
|
+
.option('-d, --dashboard', 'Open dashboard instead of live URL')
|
|
86
|
+
.action(open_1.open);
|
|
87
|
+
// Workspace commands
|
|
88
|
+
const workspaceCmd = program.command('workspace').alias('ws').description('Manage workspaces');
|
|
89
|
+
workspaceCmd
|
|
90
|
+
.command('list')
|
|
91
|
+
.alias('ls')
|
|
92
|
+
.description('List all workspaces')
|
|
93
|
+
.action(workspace_1.workspaceList);
|
|
94
|
+
workspaceCmd
|
|
95
|
+
.command('create')
|
|
96
|
+
.description('Create a new workspace')
|
|
97
|
+
.option('-n, --name <name>', 'Workspace name')
|
|
98
|
+
.action(workspace_1.workspaceCreate);
|
|
99
|
+
workspaceCmd
|
|
100
|
+
.command('select')
|
|
101
|
+
.alias('use')
|
|
102
|
+
.description('Select a workspace to use')
|
|
103
|
+
.action(workspace_1.workspaceSelect);
|
|
104
|
+
workspaceCmd
|
|
105
|
+
.command('rename')
|
|
106
|
+
.description('Rename the current workspace')
|
|
107
|
+
.option('-n, --name <name>', 'New workspace name')
|
|
108
|
+
.action(workspace_1.workspaceRename);
|
|
109
|
+
workspaceCmd
|
|
110
|
+
.command('delete')
|
|
111
|
+
.alias('rm')
|
|
112
|
+
.description('Delete the current workspace')
|
|
113
|
+
.action(workspace_1.workspaceDelete);
|
|
114
|
+
workspaceCmd
|
|
115
|
+
.command('current')
|
|
116
|
+
.description('Show the current workspace')
|
|
117
|
+
.action(workspace_1.workspaceCurrent);
|
|
118
|
+
// Database commands
|
|
119
|
+
const dbCmd = program.command('db').alias('database').description('Manage databases');
|
|
120
|
+
dbCmd
|
|
121
|
+
.command('list')
|
|
122
|
+
.alias('ls')
|
|
123
|
+
.description('List databases in current workspace')
|
|
124
|
+
.action(database_1.databaseList);
|
|
125
|
+
dbCmd
|
|
126
|
+
.command('create')
|
|
127
|
+
.description('Create a new database')
|
|
128
|
+
.option('-n, --name <name>', 'Database name')
|
|
129
|
+
.option('-t, --type <type>', 'Database type (postgresql, mysql, mongodb, redis)')
|
|
130
|
+
.action(database_1.databaseCreate);
|
|
131
|
+
dbCmd
|
|
132
|
+
.command('rename [id]')
|
|
133
|
+
.description('Rename a database')
|
|
134
|
+
.action(database_1.databaseRename);
|
|
135
|
+
dbCmd
|
|
136
|
+
.command('delete [id]')
|
|
137
|
+
.alias('rm')
|
|
138
|
+
.description('Delete a database')
|
|
139
|
+
.action(database_1.databaseDelete);
|
|
140
|
+
dbCmd
|
|
141
|
+
.command('credentials [id]')
|
|
142
|
+
.alias('creds')
|
|
143
|
+
.description('Get database credentials')
|
|
144
|
+
.action(database_1.databaseCredentials);
|
|
145
|
+
dbCmd
|
|
146
|
+
.command('info [id]')
|
|
147
|
+
.description('Get database details')
|
|
148
|
+
.action(database_1.databaseInfo);
|
|
149
|
+
dbCmd
|
|
150
|
+
.command('logs [slug]')
|
|
151
|
+
.description('View database logs')
|
|
152
|
+
.option('-n, --tail <lines>', 'Number of lines to show', '100')
|
|
153
|
+
.action(database_1.databaseLogs);
|
|
154
|
+
dbCmd
|
|
155
|
+
.command('restart [slug]')
|
|
156
|
+
.description('Restart a database')
|
|
157
|
+
.action(database_1.databaseRestart);
|
|
158
|
+
dbCmd
|
|
159
|
+
.command('size [slug]')
|
|
160
|
+
.description('Show database size')
|
|
161
|
+
.action(database_1.databaseSize);
|
|
162
|
+
// Database backup subcommand
|
|
163
|
+
const backupCmd = dbCmd.command('backup').description('Manage database backups');
|
|
164
|
+
backupCmd
|
|
165
|
+
.command('ls [slug]')
|
|
166
|
+
.alias('list')
|
|
167
|
+
.description('List database backups')
|
|
168
|
+
.action(database_1.databaseBackupList);
|
|
169
|
+
backupCmd
|
|
170
|
+
.command('create [slug]')
|
|
171
|
+
.description('Create a new backup')
|
|
172
|
+
.action(database_1.databaseBackupCreate);
|
|
173
|
+
// Parse arguments
|
|
174
|
+
program.parse();
|
|
175
|
+
// Show help if no command
|
|
176
|
+
if (!process.argv.slice(2).length) {
|
|
177
|
+
console.log(chalk_1.default.cyan(`
|
|
178
|
+
╔══════════════════════════════════════╗
|
|
179
|
+
║ ║
|
|
180
|
+
║ ${chalk_1.default.bold('DOCKUP CLI')} ║
|
|
181
|
+
║ Deploy from your terminal ║
|
|
182
|
+
║ ║
|
|
183
|
+
╚══════════════════════════════════════╝
|
|
184
|
+
`));
|
|
185
|
+
program.outputHelp();
|
|
186
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare class ApiClient {
|
|
2
|
+
private getHeaders;
|
|
3
|
+
get<T = any>(path: string): Promise<T>;
|
|
4
|
+
post<T = any>(path: string, body?: any): Promise<T>;
|
|
5
|
+
put<T = any>(path: string, body?: any): Promise<T>;
|
|
6
|
+
delete<T = any>(path: string): Promise<T>;
|
|
7
|
+
verifyToken(): Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
email: string;
|
|
10
|
+
name: string;
|
|
11
|
+
} | null>;
|
|
12
|
+
getProjects(): Promise<any[]>;
|
|
13
|
+
getServices(projectSlug: string): Promise<any[]>;
|
|
14
|
+
deploy(projectSlug: string, serviceSlug: string, options?: {
|
|
15
|
+
branch?: string;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
getServiceStatus(projectSlug: string, serviceSlug: string): Promise<any>;
|
|
18
|
+
getEnvVariables(projectSlug: string, serviceSlug: string): Promise<any[]>;
|
|
19
|
+
setEnvVariable(projectSlug: string, serviceSlug: string, key: string, value: string, isSecret?: boolean): Promise<void>;
|
|
20
|
+
deleteEnvVariable(projectSlug: string, serviceSlug: string, key: string): Promise<void>;
|
|
21
|
+
getWorkspaces(): Promise<any[]>;
|
|
22
|
+
createWorkspace(name: string): Promise<any>;
|
|
23
|
+
renameWorkspace(id: string, name: string): Promise<any>;
|
|
24
|
+
deleteWorkspace(id: string): Promise<void>;
|
|
25
|
+
getDatabases(projectSlug: string): Promise<any[]>;
|
|
26
|
+
createDatabase(projectSlug: string, name: string, dbType: string, dbVersion?: string): Promise<any>;
|
|
27
|
+
getDatabase(projectSlug: string, dbSlug: string): Promise<any>;
|
|
28
|
+
renameDatabase(projectSlug: string, dbSlug: string, name: string): Promise<any>;
|
|
29
|
+
deleteDatabase(projectSlug: string, dbSlug: string): Promise<void>;
|
|
30
|
+
getDatabaseCredentials(projectSlug: string, dbSlug: string): Promise<any>;
|
|
31
|
+
restartDatabase(projectSlug: string, dbSlug: string): Promise<any>;
|
|
32
|
+
getDatabaseLogs(projectSlug: string, dbSlug: string, tail?: number): Promise<any>;
|
|
33
|
+
getDatabaseSize(projectSlug: string, dbSlug: string): Promise<any>;
|
|
34
|
+
getDatabaseBackups(projectSlug: string, dbSlug: string): Promise<any>;
|
|
35
|
+
createDatabaseBackup(projectSlug: string, dbSlug: string): Promise<any>;
|
|
36
|
+
deleteDatabaseBackup(projectSlug: string, dbSlug: string, backupId: string): Promise<any>;
|
|
37
|
+
}
|
|
38
|
+
export declare const api: ApiClient;
|
|
39
|
+
export {};
|