Skip to content

Commit a3ed893

Browse files
committed
docs: add nodejs API documents
Signed-off-by: peefy <[email protected]>
1 parent cded73a commit a3ed893

File tree

6 files changed

+98
-2
lines changed

6 files changed

+98
-2
lines changed

blog/2024-04-17-newsletter/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ app: AppConfig {
8383
import { execProgram, ExecProgramArgs } from "kcl-lib";
8484

8585
function main() {
86-
const result = execProgram(ExecProgramArgs(["__test__/test_data/schema.k"]));
86+
const result = execProgram(new ExecProgramArgs(["__test__/test_data/schema.k"]));
8787
console.log(result.yamlResult); // 'app:\n replicas: 2'
8888
}
8989

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
sidebar_position: 6
3+
---
4+
5+
# Node.js API
6+
7+
## Installation
8+
9+
```shell
10+
npm install kcl-lib
11+
```
12+
13+
## Quick Start
14+
15+
```typescript
16+
import { execProgram, ExecProgramArgs } from "kcl-lib";
17+
18+
function main() {
19+
const result = execProgram(new ExecProgramArgs(["path/to/kcl.k"]));
20+
console.log(result.yamlResult);
21+
}
22+
23+
main();
24+
```

i18n/zh-CN/docusaurus-plugin-content-blog/2024-04-17-newsletter/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ app: AppConfig {
8383
import { execProgram, ExecProgramArgs } from "kcl-lib";
8484

8585
function main() {
86-
const result = execProgram(ExecProgramArgs(["__test__/test_data/schema.k"]));
86+
const result = execProgram(new ExecProgramArgs(["__test__/test_data/schema.k"]));
8787
console.log(result.yamlResult); // 'app:\n replicas: 2'
8888
}
8989

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
sidebar_position: 6
3+
---
4+
5+
# Node.js API
6+
7+
## 添加依赖
8+
9+
```shell
10+
npm install kcl-lib
11+
```
12+
13+
## 快速开始
14+
15+
```typescript
16+
import { execProgram, ExecProgramArgs } from "kcl-lib";
17+
18+
function main() {
19+
const result = execProgram(new ExecProgramArgs(["path/to/kcl.k"]));
20+
console.log(result.yamlResult);
21+
}
22+
23+
main();
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
sidebar_position: 6
3+
---
4+
5+
# Node.js API
6+
7+
## 添加依赖
8+
9+
```shell
10+
npm install kcl-lib
11+
```
12+
13+
## 快速开始
14+
15+
```typescript
16+
import { execProgram, ExecProgramArgs } from "kcl-lib";
17+
18+
function main() {
19+
const result = execProgram(new ExecProgramArgs(["path/to/kcl.k"]));
20+
console.log(result.yamlResult);
21+
}
22+
23+
main();
24+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
sidebar_position: 6
3+
---
4+
5+
# Node.js API
6+
7+
## Installation
8+
9+
```shell
10+
npm install kcl-lib
11+
```
12+
13+
## Quick Start
14+
15+
```typescript
16+
import { execProgram, ExecProgramArgs } from "kcl-lib";
17+
18+
function main() {
19+
const result = execProgram(new ExecProgramArgs(["path/to/kcl.k"]));
20+
console.log(result.yamlResult);
21+
}
22+
23+
main();
24+
```

0 commit comments

Comments
 (0)