@cloud-cli/dx 1.1.1 → 1.2.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/containers.d.ts +1 -1
- package/dist/containers.js +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/store.d.ts +1 -0
- package/dist/store.js +3 -0
- package/package.json +1 -1
package/dist/containers.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ interface GetLogsOptions {
|
|
|
6
6
|
export declare function getLogs({ name, lines }: GetLogsOptions): Promise<string>;
|
|
7
7
|
interface RunOptions {
|
|
8
8
|
name: string;
|
|
9
|
-
env?: string[];
|
|
9
|
+
env?: string[] | string;
|
|
10
10
|
ports?: string;
|
|
11
11
|
}
|
|
12
12
|
export declare function startContainer(options: RunOptions): Promise<boolean>;
|
package/dist/containers.js
CHANGED
|
@@ -29,6 +29,9 @@ export async function startContainer(options) {
|
|
|
29
29
|
throw new Error('Name is required');
|
|
30
30
|
}
|
|
31
31
|
const env = [];
|
|
32
|
+
if (typeof options.env === 'string') {
|
|
33
|
+
options.env = [options.env];
|
|
34
|
+
}
|
|
32
35
|
if (Array.isArray(options.env)) {
|
|
33
36
|
env.push(...options.env.flatMap((e) => ['-e', e]));
|
|
34
37
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { init } from '@cloud-cli/cli';
|
|
2
2
|
import { getRunningContainers, getLogs, startContainer, stopContainer } from './containers.js';
|
|
3
|
-
import { addContainer, removeContainer, listContainers, updateContainer } from './store.js';
|
|
3
|
+
import { addContainer, removeContainer, listContainers, updateContainer, getContainer } from './store.js';
|
|
4
4
|
import { pull } from './images.js';
|
|
5
5
|
declare function reload(): Promise<void>;
|
|
6
6
|
declare const _default: {
|
|
7
7
|
pull: typeof pull;
|
|
8
8
|
add: typeof addContainer;
|
|
9
9
|
remove: typeof removeContainer;
|
|
10
|
+
get: typeof getContainer;
|
|
10
11
|
list: typeof listContainers;
|
|
11
12
|
update: typeof updateContainer;
|
|
12
13
|
start: typeof startContainer;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { init } from '@cloud-cli/cli';
|
|
|
2
2
|
import { Resource } from '@cloud-cli/store';
|
|
3
3
|
import { Container } from './store.js';
|
|
4
4
|
import { getRunningContainers, getLogs, startContainer, stopContainer } from './containers.js';
|
|
5
|
-
import { addContainer, removeContainer, listContainers, updateContainer } from './store.js';
|
|
5
|
+
import { addContainer, removeContainer, listContainers, updateContainer, getContainer } from './store.js';
|
|
6
6
|
import { pull } from './images.js';
|
|
7
7
|
async function reload() {
|
|
8
8
|
await Resource.create(Container);
|
|
@@ -11,6 +11,7 @@ export default {
|
|
|
11
11
|
pull,
|
|
12
12
|
add: addContainer,
|
|
13
13
|
remove: removeContainer,
|
|
14
|
+
get: getContainer,
|
|
14
15
|
list: listContainers,
|
|
15
16
|
update: updateContainer,
|
|
16
17
|
start: startContainer,
|
package/dist/store.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ interface AddContainerOptions extends ContainerName {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function addContainer(options: AddContainerOptions): Promise<Container>;
|
|
18
18
|
export declare function removeContainer(options: ContainerName): Promise<boolean>;
|
|
19
|
+
export declare function getContainer(options: ContainerName): Promise<Container>;
|
|
19
20
|
interface UpdateOptions extends ContainerName {
|
|
20
21
|
ports?: string;
|
|
21
22
|
volumes?: string;
|
package/dist/store.js
CHANGED
|
@@ -53,6 +53,9 @@ export async function removeContainer(options) {
|
|
|
53
53
|
}
|
|
54
54
|
throw new Error('Container not found: ' + options.name);
|
|
55
55
|
}
|
|
56
|
+
export async function getContainer(options) {
|
|
57
|
+
return await findContainer(options.name);
|
|
58
|
+
}
|
|
56
59
|
const optionSplitter = /,\s*/;
|
|
57
60
|
export async function updateContainer(options) {
|
|
58
61
|
let { ports, volumes, name, image } = options;
|