@sdk-it/vite 0.46.0 → 0.46.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 +57 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @sdk-it/vite
|
|
2
|
+
|
|
3
|
+
Generate a TypeScript SDK during Vite development and builds.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev @sdk-it/vite @sdk-it/spec @sdk-it/typescript
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Use an OpenAPI file
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { defineConfig } from 'vite';
|
|
15
|
+
|
|
16
|
+
import sdkIt from '@sdk-it/vite';
|
|
17
|
+
|
|
18
|
+
export default defineConfig({
|
|
19
|
+
plugins: [
|
|
20
|
+
sdkIt('./openapi.yaml', {
|
|
21
|
+
output: './src/sdk',
|
|
22
|
+
name: 'Example',
|
|
23
|
+
mode: 'minimal',
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Relative paths are resolved from Vite's project root. Local specification
|
|
30
|
+
files are watched during development, and generation also runs at build
|
|
31
|
+
start. You can pass an OpenAPI object or a function that resolves to an
|
|
32
|
+
OpenAPI object or local path instead.
|
|
33
|
+
|
|
34
|
+
## Use a TypeScript backend project
|
|
35
|
+
|
|
36
|
+
First initialize the SDK-IT project workflow:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx @sdk-it/cli@latest init
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then add the plugin without an OpenAPI argument:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { defineConfig } from 'vite';
|
|
46
|
+
|
|
47
|
+
import sdkIt from '@sdk-it/vite';
|
|
48
|
+
|
|
49
|
+
export default defineConfig({
|
|
50
|
+
plugins: [sdkIt()],
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Project mode loads the SDK-IT project config and uses the same generation
|
|
55
|
+
path as the CLI. Install `@sdk-it/cli` alongside the plugin for this mode.
|
|
56
|
+
Pass `sdkIt({ config: 'config/sdk-it.ts' })` to use a non-default config
|
|
57
|
+
location.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdk-it/vite",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"chalk": "^5.6.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@sdk-it/cli": "0.46.
|
|
33
|
+
"@sdk-it/cli": "0.46.2",
|
|
34
34
|
"openapi3-ts": "4.5.0",
|
|
35
35
|
"vite": "^6.0.0 || ^7.0.0",
|
|
36
|
-
"@sdk-it/spec": "0.46.
|
|
37
|
-
"@sdk-it/typescript": "0.46.
|
|
36
|
+
"@sdk-it/spec": "0.46.2",
|
|
37
|
+
"@sdk-it/typescript": "0.46.2",
|
|
38
38
|
"chalk": "^5.6.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|