Skip to content

Commit

Permalink
Merge pull request #341 from Peefy/nodejs-api-doc
Browse files Browse the repository at this point in the history
docs: add nodejs API documents
  • Loading branch information
Peefy authored Apr 23, 2024
2 parents 3703c4e + 2414ab2 commit 6c926ac
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 4 deletions.
4 changes: 2 additions & 2 deletions blog/2024-04-17-newsletter/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ app: AppConfig {
import { execProgram, ExecProgramArgs } from "kcl-lib";

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

main();
Expand Down
24 changes: 24 additions & 0 deletions docs/reference/xlang-api/nodejs-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
sidebar_position: 6
---

# Node.js API

## Installation

```shell
npm install kcl-lib
```

## Quick Start

```typescript
import { execProgram, ExecProgramArgs } from "kcl-lib";

function main() {
const result = execProgram(new ExecProgramArgs(["path/to/kcl.k"]));
console.log(result.yamlResult);
}

main();
```
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ app: AppConfig {
import { execProgram, ExecProgramArgs } from "kcl-lib";

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

main();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
sidebar_position: 6
---

# Node.js API

## 添加依赖

```shell
npm install kcl-lib
```

## 快速开始

```typescript
import { execProgram, ExecProgramArgs } from "kcl-lib";

function main() {
const result = execProgram(new ExecProgramArgs(["path/to/kcl.k"]));
console.log(result.yamlResult);
}

main();
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
sidebar_position: 6
---

# Node.js API

## 添加依赖

```shell
npm install kcl-lib
```

## 快速开始

```typescript
import { execProgram, ExecProgramArgs } from "kcl-lib";

function main() {
const result = execProgram(new ExecProgramArgs(["path/to/kcl.k"]));
console.log(result.yamlResult);
}

main();
```
24 changes: 24 additions & 0 deletions versioned_docs/version-0.8/reference/xlang-api/nodejs-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
sidebar_position: 6
---

# Node.js API

## Installation

```shell
npm install kcl-lib
```

## Quick Start

```typescript
import { execProgram, ExecProgramArgs } from "kcl-lib";

function main() {
const result = execProgram(new ExecProgramArgs(["path/to/kcl.k"]));
console.log(result.yamlResult);
}

main();
```

0 comments on commit 6c926ac

Please sign in to comment.