@cloud-cli/dx 1.8.0 → 1.8.2

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.
@@ -10,7 +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
+ export declare function restartContainer(options: ContainerName, { run }: ServerParams): Promise<string>;
14
14
  export declare function startContainer(options: ContainerName, { run }: ServerParams): Promise<boolean>;
15
15
  export declare function stopContainer(options: ContainerName, { run }: ServerParams): Promise<boolean>;
16
16
  export {};
@@ -50,6 +50,7 @@ export async function restartContainer(options, { run }) {
50
50
  const { name } = options;
51
51
  await run('dx.stop', { name });
52
52
  await run('dx.start', { name });
53
+ return name;
53
54
  }
54
55
  export async function startContainer(options, { run }) {
55
56
  const { name } = options;
@@ -95,10 +96,12 @@ export async function stopContainer(options, { run }) {
95
96
  if (!name) {
96
97
  throw new Error('Name is required');
97
98
  }
98
- const container = await findContainer(name);
99
99
  await exec('docker', ['stop', '-t', '5', name]);
100
100
  await exec('docker', ['rm', name]);
101
- await run('dns.remove', { domain: container.host });
102
- await run('dns.reload', {});
101
+ const containers = [await findContainer(name)].filter(Boolean);
102
+ for (const container of containers) {
103
+ await run('dns.remove', { domain: container.host });
104
+ await run('dns.reload', {});
105
+ }
103
106
  return true;
104
107
  }
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-cli/dx",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "Docker container management",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",