Skip to content

Commit 0994782

Browse files
committed
doc: readme
1 parent 35c5f71 commit 0994782

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,47 @@
11
# macadam.js
22
An NPM library to work with macadam from Node projects
3+
4+
## Installation
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:
17+
18+
```
19+
npm i @crc-org/macadam.js@latest
20+
```
21+
22+
## Usage
23+
24+
```typescript
25+
import * as macadamjs from '@crc-org/macadam.js';
26+
27+
const macadam = new macadamjs.Macadam('my-ext');
28+
await macadam.init();
29+
await macadam.createVm({
30+
imagePath: '/path/to/image.raw',
31+
username: 'core',
32+
});
33+
const vms = await macadam.listVms({});
34+
console.log('==> vms', vms);
35+
36+
const startResult = await macadam.startVm({});
37+
console.log('==> start', startResult);
38+
39+
const stopResult = await macadam.stopVm({});
40+
console.log('==> stop', stopResult);
41+
42+
const rmResult = await macadam.removeVm({});
43+
console.log('==> rm result', rmResult);
44+
45+
const vms0 = await macadam.listVms({});
46+
console.log('==> vms after rm', vms0);
47+
```

0 commit comments

Comments
 (0)