@crc-org/macadam.js 0.0.1-202505091308-41f281b → 0.2.0-202509150634-790fbcd
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
|
@@ -29,6 +29,13 @@ const startResult = await macadam.startVm({
|
|
|
29
29
|
});
|
|
30
30
|
console.log('==> start', startResult);
|
|
31
31
|
|
|
32
|
+
const executeResult = await macadam.executeCommand({
|
|
33
|
+
name: 'my-vm',
|
|
34
|
+
command: 'ls',
|
|
35
|
+
args: [ '/' ],
|
|
36
|
+
});
|
|
37
|
+
console.log('==> execute', executeResult);
|
|
38
|
+
|
|
32
39
|
const stopResult = await macadam.stopVm({
|
|
33
40
|
name: 'my-vm',
|
|
34
41
|
});
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,11 @@ export interface StartVmOptions extends CommonOptions {
|
|
|
21
21
|
export interface StopVmOptions extends CommonOptions {
|
|
22
22
|
name: string;
|
|
23
23
|
}
|
|
24
|
+
export interface ExecuteCommandOptions extends CommonOptions {
|
|
25
|
+
name: string;
|
|
26
|
+
command: string;
|
|
27
|
+
args: string[];
|
|
28
|
+
}
|
|
24
29
|
export interface VmDetails {
|
|
25
30
|
Name: string;
|
|
26
31
|
Image: string;
|
|
@@ -49,6 +54,7 @@ export declare class Macadam {
|
|
|
49
54
|
removeVm(options: RemoveVmOptions): Promise<extensionApi.RunResult>;
|
|
50
55
|
startVm(options: StartVmOptions): Promise<extensionApi.RunResult>;
|
|
51
56
|
stopVm(options: StopVmOptions): Promise<extensionApi.RunResult>;
|
|
57
|
+
executeCommand(options: ExecuteCommandOptions): Promise<extensionApi.RunResult>;
|
|
52
58
|
protected isVmDetails(vm: unknown): vm is VmDetails;
|
|
53
59
|
protected getFinalOptions(runOptions?: extensionApi.RunOptions, containerProvider?: string): extensionApi.RunOptions;
|
|
54
60
|
protected isMachineOwned(realName: string): boolean;
|
package/dist/index.js
CHANGED
|
@@ -180,6 +180,12 @@ class Macadam {
|
|
|
180
180
|
}
|
|
181
181
|
return await extensionApi.process.exec(this.#macadamPath, ['stop', this.realMachineName(options.name)], this.getFinalOptions(options.runOptions, options.containerProvider));
|
|
182
182
|
}
|
|
183
|
+
async executeCommand(options) {
|
|
184
|
+
if (!this.#initialized) {
|
|
185
|
+
throw new Error('component not initialized. You must call init() before');
|
|
186
|
+
}
|
|
187
|
+
return await extensionApi.process.exec(this.#macadamPath, ['ssh', this.realMachineName(options.name), options.command, ...options.args], this.getFinalOptions(options.runOptions, options.containerProvider));
|
|
188
|
+
}
|
|
183
189
|
isVmDetails(vm) {
|
|
184
190
|
return (!!vm &&
|
|
185
191
|
typeof vm === 'object' &&
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/crc-org/macadam.js.git"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.0
|
|
7
|
+
"version": "0.2.0-202509150634-790fbcd",
|
|
8
8
|
"description": "An NPM library to work with macadam from Node projects",
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
10
|
"publishConfig": {
|