@daileyos/cli 0.2.0 → 0.4.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/api.js +2 -1
- package/dist/api.js.map +1 -1
- package/dist/commands/auth.js +10 -3
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/deploy.js +26 -10
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/images.d.ts +2 -0
- package/dist/commands/images.js +166 -0
- package/dist/commands/images.js.map +1 -0
- package/dist/commands/links.d.ts +2 -0
- package/dist/commands/links.js +72 -0
- package/dist/commands/links.js.map +1 -0
- package/dist/commands/open.js +3 -1
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/resources.d.ts +2 -0
- package/dist/commands/resources.js +122 -0
- package/dist/commands/resources.js.map +1 -0
- package/dist/commands/scale.js +40 -0
- package/dist/commands/scale.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +2 -1
- package/src/commands/auth.ts +11 -3
- package/src/commands/deploy.ts +26 -10
- package/src/commands/images.ts +204 -0
- package/src/commands/links.ts +96 -0
- package/src/commands/open.ts +3 -1
- package/src/commands/resources.ts +147 -0
- package/src/commands/scale.ts +49 -0
- package/src/index.ts +6 -0
package/src/commands/scale.ts
CHANGED
|
@@ -26,6 +26,55 @@ export function registerScaleCommands(program: Command): void {
|
|
|
26
26
|
}),
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
+
program
|
|
30
|
+
.command('stop <idOrName>')
|
|
31
|
+
.description('Stop an app (scale to 0 replicas)')
|
|
32
|
+
.action(
|
|
33
|
+
withErrorHandler(async (idOrName: unknown) => {
|
|
34
|
+
const project = await resolveProject(String(idOrName));
|
|
35
|
+
const spinner = ora(`Stopping "${project.name}"...`).start();
|
|
36
|
+
await api(`/projects/${project.id}/scale`, {
|
|
37
|
+
method: 'POST',
|
|
38
|
+
body: { replicas: 0 },
|
|
39
|
+
});
|
|
40
|
+
spinner.succeed(chalk.green(`Stopped "${project.name}" — scaled to 0 replicas.`));
|
|
41
|
+
console.log(chalk.gray(` Start again: ${chalk.white(`dailey start ${String(idOrName)}`)}`));
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
program
|
|
46
|
+
.command('start <idOrName>')
|
|
47
|
+
.description('Start an app (scale to 1 replica)')
|
|
48
|
+
.option('-r, --replicas <n>', 'Number of replicas to start with', '1')
|
|
49
|
+
.action(
|
|
50
|
+
withErrorHandler(async (idOrName: unknown, opts: { replicas: string }) => {
|
|
51
|
+
const project = await resolveProject(String(idOrName));
|
|
52
|
+
const count = parseInt(opts.replicas, 10) || 1;
|
|
53
|
+
const spinner = ora(`Starting "${project.name}" with ${count} replica${count > 1 ? 's' : ''}...`).start();
|
|
54
|
+
await api(`/projects/${project.id}/scale`, {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
body: { replicas: count },
|
|
57
|
+
});
|
|
58
|
+
spinner.succeed(chalk.green(`Started "${project.name}" with ${count} replica${count > 1 ? 's' : ''}.`));
|
|
59
|
+
console.log(chalk.gray(` View: ${chalk.white(`https://${project.slug}.dailey.cloud`)}`));
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
program
|
|
64
|
+
.command('restart <idOrName>')
|
|
65
|
+
.description('Restart an app (rolling restart, no downtime)')
|
|
66
|
+
.action(
|
|
67
|
+
withErrorHandler(async (idOrName: unknown) => {
|
|
68
|
+
const project = await resolveProject(String(idOrName));
|
|
69
|
+
const spinner = ora(`Restarting "${project.name}"...`).start();
|
|
70
|
+
// Scale to 0 then back to current replicas
|
|
71
|
+
const replicas = Number(project.replicas) || 1;
|
|
72
|
+
await api(`/projects/${project.id}/scale`, { method: 'POST', body: { replicas: 0 } });
|
|
73
|
+
await api(`/projects/${project.id}/scale`, { method: 'POST', body: { replicas } });
|
|
74
|
+
spinner.succeed(chalk.green(`Restarted "${project.name}" with ${replicas} replica${replicas > 1 ? 's' : ''}.`));
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
|
|
29
78
|
program
|
|
30
79
|
.command('status <idOrName>')
|
|
31
80
|
.description('Show app status (pods, replicas, health)')
|
package/src/index.ts
CHANGED
|
@@ -14,6 +14,9 @@ import { registerOpenCommand } from './commands/open.js';
|
|
|
14
14
|
import { registerPlatformCommands } from './commands/platform.js';
|
|
15
15
|
import { registerStorageCommands } from './commands/storage.js';
|
|
16
16
|
import { registerJobCommands } from './commands/jobs.js';
|
|
17
|
+
import { registerImageCommands } from './commands/images.js';
|
|
18
|
+
import { registerLinkCommands } from './commands/links.js';
|
|
19
|
+
import { registerResourceCommands } from './commands/resources.js';
|
|
17
20
|
|
|
18
21
|
const program = new Command();
|
|
19
22
|
|
|
@@ -35,5 +38,8 @@ registerOpenCommand(program);
|
|
|
35
38
|
registerPlatformCommands(program);
|
|
36
39
|
registerStorageCommands(program);
|
|
37
40
|
registerJobCommands(program);
|
|
41
|
+
registerImageCommands(program);
|
|
42
|
+
registerLinkCommands(program);
|
|
43
|
+
registerResourceCommands(program);
|
|
38
44
|
|
|
39
45
|
program.parse();
|