@crc-org/macadam.js 0.0.1-202505091153-d597ec3 → 0.0.1-202506241253-f373979

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
@@ -3,17 +3,7 @@ An NPM library to work with macadam from Node projects
3
3
 
4
4
  ## Installation
5
5
 
6
- The library is published on GitHub NPM registry.
7
-
8
- You need to indicate in `.npmrc` where is located the package, and you need to authenticate with a GitHub token (classic) having `read:packages` scope:
9
-
10
- .npmrc
11
- ```
12
- @crc-org:registry=https://npm.pkg.github.com
13
- //npm.pkg.github.com/:_authToken=<TOKEN>
14
- ```
15
-
16
- Then you can install the package for your project:
6
+ To install the package for your project:
17
7
 
18
8
  ```
19
9
  npm i @crc-org/macadam.js@latest
@@ -39,6 +29,13 @@ const startResult = await macadam.startVm({
39
29
  });
40
30
  console.log('==> start', startResult);
41
31
 
32
+ const executeResult = await macadam.executeCommand({
33
+ name: 'my-vm',
34
+ command: 'ls',
35
+ args: [ '/' ],
36
+ });
37
+ console.log('==> execute', executeResult);
38
+
42
39
  const stopResult = await macadam.stopVm({
43
40
  name: 'my-vm',
44
41
  });
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,9 +4,13 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/crc-org/macadam.js.git"
6
6
  },
7
- "version": "0.0.1-202505091153-d597ec3",
7
+ "version": "0.0.1-202506241253-f373979",
8
8
  "description": "An NPM library to work with macadam from Node projects",
9
9
  "main": "./dist/index.js",
10
+ "publishConfig": {
11
+ "provenance": true,
12
+ "access": "public"
13
+ },
10
14
  "license": "Apache-2.0",
11
15
  "devDependencies": {
12
16
  "@eslint/compat": "^1.2.8",