@cloud-cli/dx 1.7.3 → 1.8.1
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/containers.d.ts +1 -0
- package/dist/containers.js +10 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/store.js +1 -1
- package/package.json +1 -1
package/dist/containers.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface ContainerName {
|
|
|
10
10
|
export declare function getLogs({ name, lines }: GetLogsOptions): Promise<string>;
|
|
11
11
|
export declare function startAll(_: any, cli: any): Promise<boolean>;
|
|
12
12
|
export declare function refreshContainer(options: ContainerName, { run }: ServerParams): Promise<void>;
|
|
13
|
+
export declare function restartContainer(options: ContainerName, { run }: ServerParams): Promise<void>;
|
|
13
14
|
export declare function startContainer(options: ContainerName, { run }: ServerParams): Promise<boolean>;
|
|
14
15
|
export declare function stopContainer(options: ContainerName, { run }: ServerParams): Promise<boolean>;
|
|
15
16
|
export {};
|
package/dist/containers.js
CHANGED
|
@@ -46,6 +46,11 @@ export async function refreshContainer(options, { run }) {
|
|
|
46
46
|
await run('dx.prune', {});
|
|
47
47
|
await run('dx.start', { name });
|
|
48
48
|
}
|
|
49
|
+
export async function restartContainer(options, { run }) {
|
|
50
|
+
const { name } = options;
|
|
51
|
+
await run('dx.stop', { name });
|
|
52
|
+
await run('dx.start', { name });
|
|
53
|
+
}
|
|
49
54
|
export async function startContainer(options, { run }) {
|
|
50
55
|
const { name } = options;
|
|
51
56
|
if (!name) {
|
|
@@ -90,10 +95,12 @@ export async function stopContainer(options, { run }) {
|
|
|
90
95
|
if (!name) {
|
|
91
96
|
throw new Error('Name is required');
|
|
92
97
|
}
|
|
93
|
-
const container = await findContainer(name);
|
|
94
98
|
await exec('docker', ['stop', '-t', '5', name]);
|
|
95
99
|
await exec('docker', ['rm', name]);
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
const containers = [await findContainer(name)].filter(Boolean);
|
|
101
|
+
for (const container of containers) {
|
|
102
|
+
await run('dns.remove', { domain: container.host });
|
|
103
|
+
await run('dns.reload', {});
|
|
104
|
+
}
|
|
98
105
|
return true;
|
|
99
106
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { init } from '@cloud-cli/cli';
|
|
2
|
-
import { getRunningContainers, getLogs, startContainer, stopContainer, refreshContainer, startAll } from './containers.js';
|
|
2
|
+
import { getRunningContainers, getLogs, startContainer, stopContainer, refreshContainer, startAll, restartContainer } from './containers.js';
|
|
3
3
|
import { addContainer, removeContainer, listContainers, updateContainer, getContainer } from './store.js';
|
|
4
4
|
import { pull, prune } from './images.js';
|
|
5
5
|
import { Config } from './config.js';
|
|
@@ -16,6 +16,7 @@ declare const _default: {
|
|
|
16
16
|
startAll: typeof startAll;
|
|
17
17
|
start: typeof startContainer;
|
|
18
18
|
stop: typeof stopContainer;
|
|
19
|
+
restart: typeof restartContainer;
|
|
19
20
|
ps: typeof getRunningContainers;
|
|
20
21
|
logs: typeof getLogs;
|
|
21
22
|
[init](config?: Config): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init } from '@cloud-cli/cli';
|
|
2
2
|
import { Resource, SQLiteDriver } from '@cloud-cli/store';
|
|
3
3
|
import { Container } from './store.js';
|
|
4
|
-
import { getRunningContainers, getLogs, startContainer, stopContainer, refreshContainer, startAll } from './containers.js';
|
|
4
|
+
import { getRunningContainers, getLogs, startContainer, stopContainer, refreshContainer, startAll, restartContainer } from './containers.js';
|
|
5
5
|
import { addContainer, removeContainer, listContainers, updateContainer, getContainer } from './store.js';
|
|
6
6
|
import { pull, prune } from './images.js';
|
|
7
7
|
import { setConfig } from './config.js';
|
|
@@ -21,6 +21,7 @@ export default {
|
|
|
21
21
|
startAll,
|
|
22
22
|
start: startContainer,
|
|
23
23
|
stop: stopContainer,
|
|
24
|
+
restart: restartContainer,
|
|
24
25
|
ps: getRunningContainers,
|
|
25
26
|
logs: getLogs,
|
|
26
27
|
async [init](config) {
|
package/dist/store.js
CHANGED
|
@@ -47,7 +47,7 @@ export async function addContainer(options) {
|
|
|
47
47
|
const host = options.host;
|
|
48
48
|
const container = new Container({ name, image, volumes, ports, host });
|
|
49
49
|
const id = await container.save();
|
|
50
|
-
container.id = id;
|
|
50
|
+
container.id = Number(id);
|
|
51
51
|
return container;
|
|
52
52
|
}
|
|
53
53
|
export async function removeContainer(options) {
|