@sdk-it/cli 0.46.10 → 0.47.0
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 +26 -18
- package/dist/bin.d.ts +1 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +226 -226
- package/dist/bin.js.map +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +120 -91
- package/dist/index.js.map +3 -3
- package/dist/lib/cli.d.ts +0 -1
- package/dist/lib/cli.d.ts.map +1 -1
- package/dist/lib/commands/init.d.ts.map +1 -1
- package/dist/lib/generate.d.ts.map +1 -1
- package/dist/lib/generators/dart.d.ts.map +1 -1
- package/dist/lib/generators/python.d.ts.map +1 -1
- package/dist/lib/generators/readme.d.ts.map +1 -1
- package/dist/lib/generators/typescript.d.ts.map +1 -1
- package/dist/lib/options.d.ts +6 -0
- package/dist/lib/options.d.ts.map +1 -1
- package/dist/lib/project/analysis.d.ts +1 -1
- package/dist/lib/project/analysis.d.ts.map +1 -1
- package/dist/lib/project/cache.d.ts +1 -1
- package/dist/lib/project/cache.d.ts.map +1 -1
- package/dist/lib/project/compiler.d.ts.map +1 -1
- package/dist/lib/project/config.d.ts +3 -1
- package/dist/lib/project/config.d.ts.map +1 -1
- package/dist/lib/project/output.d.ts.map +1 -1
- package/dist/lib/project.d.ts.map +1 -1
- package/dist/lib/types.d.ts +1 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/startup.d.ts +2 -0
- package/dist/startup.d.ts.map +1 -0
- package/package.json +24 -13
- package/dist/lib/commands/find-framework.d.ts +0 -10
- package/dist/lib/commands/find-framework.d.ts.map +0 -1
- package/dist/lib/commands/find-spec-file.d.ts +0 -2
- package/dist/lib/commands/find-spec-file.d.ts.map +0 -1
- package/dist/lib/commands/guess-default-package-name.d.ts +0 -2
- package/dist/lib/commands/guess-default-package-name.d.ts.map +0 -1
- package/dist/lib/generators/apiref.d.ts +0 -13
- package/dist/lib/generators/apiref.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -32,15 +32,16 @@ npx @sdk-it/cli@latest generate typescript \
|
|
|
32
32
|
--spec ./openapi.json \
|
|
33
33
|
--output ./src/generated/api \
|
|
34
34
|
--name MyApi \
|
|
35
|
+
--package-name @acme/my-api \
|
|
35
36
|
--mode minimal
|
|
36
37
|
```
|
|
37
38
|
|
|
38
39
|
Use it:
|
|
39
40
|
|
|
40
41
|
```typescript
|
|
41
|
-
import {
|
|
42
|
+
import { createMyApi } from './src/generated/api/index.ts';
|
|
42
43
|
|
|
43
|
-
const client =
|
|
44
|
+
const client = createMyApi({
|
|
44
45
|
baseUrl: 'https://api.example.com',
|
|
45
46
|
});
|
|
46
47
|
|
|
@@ -57,19 +58,20 @@ HTTP responses throw typed errors exported by the generated SDK.
|
|
|
57
58
|
npx @sdk-it/cli@latest generate typescript [options]
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
| Option | Description
|
|
61
|
-
| -------------------------- |
|
|
62
|
-
| `--spec`, `-s` | Local path or remote URL to an OpenAPI JSON or YAML document
|
|
63
|
-
| `--output`, `-o` | Output directory
|
|
64
|
-
| `--name`, `-n` |
|
|
65
|
-
| `--
|
|
66
|
-
| `--
|
|
67
|
-
| `--
|
|
68
|
-
| `--
|
|
69
|
-
| `--
|
|
70
|
-
| `--
|
|
71
|
-
| `--
|
|
72
|
-
| `--
|
|
61
|
+
| Option | Description | Default |
|
|
62
|
+
| -------------------------- | ------------------------------------------------------------------- | --------- |
|
|
63
|
+
| `--spec`, `-s` | Local path or remote URL to an OpenAPI JSON or YAML document | Required |
|
|
64
|
+
| `--output`, `-o` | Output directory | Required |
|
|
65
|
+
| `--name`, `-n` | Name in the generated exports, such as `create<Name>` | Required |
|
|
66
|
+
| `--package-name` | npm name of the generated package, in `package.json` and the README | Required |
|
|
67
|
+
| `--mode`, `-m` | `minimal` source files or a `full` standalone project | `minimal` |
|
|
68
|
+
| `--useTsExtension [value]` | Include `.ts` in generated imports | `true` |
|
|
69
|
+
| `--formatter <command>` | Command used to format the generated source directory | |
|
|
70
|
+
| `--no-default-formatter` | Skip the default Prettier formatter | |
|
|
71
|
+
| `--readme false` | Skip the generated API README | |
|
|
72
|
+
| `--pagination <config>` | Configure pagination, such as `false` or `guess=false` | `true` |
|
|
73
|
+
| `--no-install` | Skip dependency installation in `full` mode | |
|
|
74
|
+
| `--verbose`, `-v` | Show generator and installation output | `false` |
|
|
73
75
|
|
|
74
76
|
`minimal` mode writes client source files directly to `--output`. `full` mode
|
|
75
77
|
writes source files under `<output>/src`, adds `package.json` and `tsconfig.json`,
|
|
@@ -81,6 +83,8 @@ For a custom formatter, include the generated path explicitly:
|
|
|
81
83
|
npx @sdk-it/cli@latest generate typescript \
|
|
82
84
|
--spec ./openapi.json \
|
|
83
85
|
--output ./src/generated/api \
|
|
86
|
+
--name MyApi \
|
|
87
|
+
--package-name @acme/my-api \
|
|
84
88
|
--formatter "prettier ./src/generated/api --write"
|
|
85
89
|
```
|
|
86
90
|
|
|
@@ -91,14 +95,18 @@ npx @sdk-it/cli@latest generate typescript \
|
|
|
91
95
|
--spec https://raw.githubusercontent.com/MaximilianKoestler/hcloud-openapi/refs/heads/main/openapi/hcloud.json \
|
|
92
96
|
--output ./src/generated/hetzner \
|
|
93
97
|
--name Hetzner \
|
|
98
|
+
--package-name @acme/hetzner \
|
|
94
99
|
--mode minimal
|
|
95
100
|
```
|
|
96
101
|
|
|
97
102
|
```typescript
|
|
98
|
-
import {
|
|
103
|
+
import { createHetzner } from './src/generated/hetzner/index.ts';
|
|
99
104
|
|
|
100
|
-
const hetzner =
|
|
101
|
-
|
|
105
|
+
const hetzner = createHetzner({
|
|
106
|
+
baseUrl: 'https://api.hetzner.cloud/v1',
|
|
107
|
+
credentials: {
|
|
108
|
+
APIToken: process.env.HETZNER_API_TOKEN,
|
|
109
|
+
},
|
|
102
110
|
});
|
|
103
111
|
|
|
104
112
|
const result = await hetzner.request('GET /servers', {});
|
package/dist/bin.d.ts
CHANGED
package/dist/bin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC"}
|