zenko 0.1.9 → 0.1.10-beta.2
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 +11 -21
- package/dist/cli.cjs +337 -95
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +337 -95
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +231 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -47
- package/dist/index.d.ts +1 -47
- package/dist/index.mjs +228 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -17,30 +17,25 @@ Unlike most OpenAPI generators, Zenko does not create a client. Instead you are
|
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
20
|
-
### One-time Usage
|
|
20
|
+
### One-time Usage (Bun)
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
# Use directly with
|
|
24
|
-
npx zenko input.yaml output.ts
|
|
25
|
-
|
|
26
|
-
# Or with bunx
|
|
23
|
+
# Use directly with bunx (no installation required)
|
|
27
24
|
bunx zenko input.yaml output.ts
|
|
28
25
|
```
|
|
29
26
|
|
|
30
|
-
### Install for Repeated Use
|
|
27
|
+
### Install for Repeated Use (Bun runtime)
|
|
31
28
|
|
|
32
29
|
```bash
|
|
33
30
|
# Install globally
|
|
34
|
-
npm install -g zenko
|
|
35
31
|
bun install -g zenko
|
|
36
32
|
|
|
37
33
|
# Or install locally
|
|
38
|
-
npm install zenko
|
|
39
34
|
bun add zenko
|
|
40
|
-
yarn add zenko
|
|
41
|
-
pnpm add zenko
|
|
42
35
|
```
|
|
43
36
|
|
|
37
|
+
> 💡 Need pure Node.js support? Install [`zenko-node`](../zenko-node/README.md) for an equivalent CLI and library powered by `js-yaml`.
|
|
38
|
+
|
|
44
39
|
## Usage
|
|
45
40
|
|
|
46
41
|
### Command Line
|
|
@@ -103,18 +98,13 @@ The config file controls generation for multiple specs and can also configure ty
|
|
|
103
98
|
### Programmatic Usage
|
|
104
99
|
|
|
105
100
|
```typescript
|
|
106
|
-
import {
|
|
107
|
-
import * as fs from "fs"
|
|
108
|
-
import { load } from "js-yaml"
|
|
109
|
-
|
|
110
|
-
// Load your OpenAPI spec
|
|
111
|
-
const spec = load(fs.readFileSync("api.yaml", "utf8")) as OpenAPISpec
|
|
101
|
+
import { generateFromDocument, type OpenAPISpec } from "zenko"
|
|
112
102
|
|
|
113
|
-
|
|
114
|
-
const
|
|
103
|
+
const specText = await Bun.file("api.yaml").text()
|
|
104
|
+
const spec = Bun.YAML.parse(specText) as OpenAPISpec
|
|
115
105
|
|
|
116
|
-
|
|
117
|
-
|
|
106
|
+
const { output } = generateFromDocument(spec)
|
|
107
|
+
await Bun.write("types.ts", output)
|
|
118
108
|
```
|
|
119
109
|
|
|
120
110
|
#### ES Modules
|
|
@@ -284,7 +274,7 @@ bun test
|
|
|
284
274
|
bun run build
|
|
285
275
|
|
|
286
276
|
# Test with example spec
|
|
287
|
-
zenko src/resources/petstore.yaml output.ts
|
|
277
|
+
zenko ../zenko-core/src/resources/petstore.yaml output.ts
|
|
288
278
|
|
|
289
279
|
# Format code
|
|
290
280
|
bun run format
|