Skip to content

docs: add nodejs API documents #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
```