@cloud-cli/dx 2.1.0 → 2.1.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/README.md CHANGED
@@ -14,7 +14,7 @@ npm i @cloud-cli/dx
14
14
  cy dx.list
15
15
  cy dx.prune
16
16
  cy dx.pull --image node:latest
17
- cy dx.add --name node-app --image node:latest --volumes 'volume:/container/path' --port '8080' --host 'foo.example.com'
17
+ cy dx.add --name node-app --image node:latest --volumes 'volume:/container/path' --port '8080' --domain 'foo.example.com'
18
18
  cy dx.start --name node-app --env 'FOO=bar'
19
19
  cy dx.logs --name node-app
20
20
  cy dx.stop --name node-app
@@ -69,11 +69,11 @@ export async function startContainer(options, { run }) {
69
69
  }
70
70
  const vars = (await run('env.show', { name }));
71
71
  const { env, envKeys } = await getEnvVars(vars);
72
- const container = await findContainer(name);
72
+ const container = findContainer(name);
73
73
  const volumes = addExecFlag(container.volumes, 'v');
74
74
  const ports = ['-p' + env.PORT + ':' + (container.port || env.PORT)];
75
- if (container.host) {
76
- const domain = container.host;
75
+ if (container.domain) {
76
+ const [domain] = container.domain.split('/');
77
77
  await run('px.update', { domain, target: 'http://localhost:' + env.PORT });
78
78
  await run('dns.add', { domain });
79
79
  }
@@ -113,9 +113,9 @@ export async function stopContainer(options, { run }) {
113
113
  }
114
114
  await exec('docker', ['stop', '-t', '5', name]);
115
115
  await exec('docker', ['rm', name]);
116
- const containers = [await findContainer(name)].filter(Boolean);
116
+ const containers = [findContainer(name)].filter(Boolean);
117
117
  for (const container of containers) {
118
- await run('dns.remove', { domain: container.host });
118
+ await run('dns.remove', { domain: container.domain });
119
119
  }
120
120
  return true;
121
121
  }
package/dist/store.d.ts CHANGED
@@ -4,7 +4,7 @@ interface ContainerName extends ExtraOptions {
4
4
  }
5
5
  interface ContainerUpdateOptions extends ContainerName {
6
6
  image: string;
7
- host?: string;
7
+ domain?: string;
8
8
  volumes?: string;
9
9
  port?: string;
10
10
  }
package/dist/store.js CHANGED
@@ -11,8 +11,8 @@ export function addContainer(options) {
11
11
  throw new Error('Image required');
12
12
  const volumes = options.volumes ? sanitiseVolumes(options.volumes) : '';
13
13
  const port = options.port || '';
14
- const host = options.host;
15
- const container = { name, image, volumes, port, host };
14
+ const domain = options.domain || '';
15
+ const container = { name, image, volumes, port, domain };
16
16
  set(name, container);
17
17
  return container;
18
18
  }
@@ -31,7 +31,7 @@ export function getContainer(options) {
31
31
  const optionSplitter = /,\s*/;
32
32
  export function updateContainer(options) {
33
33
  readTargetName(options);
34
- let { port, volumes, name, image, host } = options;
34
+ let { port, volumes, name, image, domain } = options;
35
35
  const container = get(name);
36
36
  if (!container) {
37
37
  throw new Error('Container not found');
@@ -45,14 +45,14 @@ export function updateContainer(options) {
45
45
  if (image) {
46
46
  container.image = image;
47
47
  }
48
- if (host) {
49
- container.host = host;
48
+ if (domain) {
49
+ container.domain = domain;
50
50
  }
51
51
  set(container.name, container);
52
52
  return container;
53
53
  }
54
54
  export function listContainers(options = {}) {
55
- const keys = ['name', 'image', 'host', 'port', 'volumes'];
55
+ const keys = ['name', 'image', 'domain', 'port', 'volumes'];
56
56
  const list = getAll();
57
57
  const filtered = keys.reduce((list, key) => {
58
58
  if (options[key]) {
package/dist/types.d.ts CHANGED
@@ -5,7 +5,7 @@ export interface Config {
5
5
  export interface Container {
6
6
  name: string;
7
7
  image: string;
8
- host: string;
8
+ domain: string;
9
9
  port: string;
10
10
  volumes: string;
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-cli/dx",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Docker container management",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",