Skip to content

Commit

Permalink
Chore/grouping (#1276)
Browse files Browse the repository at this point in the history
* feat: refactor barrelFiles export + `extension` to override import/export extname

* chore: cleanup

* feat: Removal of `group.output` in favour of `group.name`(no need to specify the output/root)
  • Loading branch information
stijnvanhulle authored Sep 29, 2024
1 parent b4bea8f commit ebbfac2
Show file tree
Hide file tree
Showing 173 changed files with 3,052 additions and 2,215 deletions.
20 changes: 20 additions & 0 deletions .changeset/quiet-lemons-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"@kubb/plugin-svelte-query": major
"@kubb/plugin-react-query": major
"@kubb/plugin-solid-query": major
"@kubb/plugin-vue-query": major
"@kubb/plugin-client": major
"@kubb/plugin-faker": major
"@kubb/plugin-redoc": major
"@kubb/plugin-msw": major
"@kubb/plugin-oas": major
"@kubb/plugin-swr": major
"@kubb/plugin-zod": major
"@kubb/plugin-ts": major
"@kubb/react": major
"@kubb/core": major
"@kubb/cli": major
"@kubb/fs": major
---

Removal of `group.output` in favour of `group.name`(no need to specify the output/root)
6 changes: 4 additions & 2 deletions docs/blog/v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { pluginTanstackQuery } from '@kubb/plugin-tanstack-query'
- Removal of `output.exportType`
- Rename of `exportType` with `barrelType` for `output.barrelType` and every plugin
- Removal of `extName` in every plugin in favour of one `output.extension`
````
```
root: '.',
input: {
path: './petStore.yaml',
Expand All @@ -68,7 +68,9 @@ output: {
}
},
},
````
```
- Refactor of grouping(use of name instead of output) and output based on `output` of the current plugin


## Thanks

Expand Down
38 changes: 35 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@ title: Changelog

# Changelog

## 3.0.0-alpha.31
- [`plugin-client`](/plugins/client/): Generate `${tag}Service` controller file related to group x when using `group`(no need to specify `group.exportAs`)
- [`plugin-core`](/plugins/core/): Removal of `group.exportAs`
- [`plugin-core`](/plugins/core/): Removal of `group.output` in favour of `group.name`(no need to specify the output/root)
```typescript [kubb.config.ts]
import { defineConfig } from "@kubb/core"
import { pluginOas } from "@kubb/plugin-oas"
import { pluginTs } from "@kubb/plugin-ts"
import { pluginClient } from '@kubb/plugin-client'

export default defineConfig({
root: '.',
input: {
path: './petStore.yaml',
},
output: {
path: './src/gen',
clean: true,
},
plugins: [
pluginOas({ generators: [] }),
pluginClient({
output: {
path: './clients/axios',
},
group: { type: 'tag', output: './clients/axios/{{tag}}Service' }, // [!code --]
group: { type: 'tag', name: ({ group }) => `${group}Service` }, // [!code ++]
}),
],
})
```

## 3.0.0-alpha.30
- [`plugin-core`](/plugins/core/): Removal of `output.extName` in favour of `output.extension`
- [`plugin-core`](/plugins/core/): Removal of `exportType` in favour of `barrelType`
Expand Down Expand Up @@ -77,9 +109,9 @@ z.union([z.literal(true), z.literal(false)]) // [!code ++]
- Separate plugin/package for Solid-Query: `@kubb/plugin-solid-query`

```typescript twoslash [kubb.config.ts]
import {defineConfig} from "@kubb/core"
import {pluginOas} from "@kubb/plugin-oas"
import {pluginTs} from "@kubb/plugin-ts"
import { defineConfig } from "@kubb/core"
import { pluginOas } from "@kubb/plugin-oas"
import { pluginTs } from "@kubb/plugin-ts"
import { pluginSolidQuery } from '@kubb/plugin-solid-query' // [!code ++]
import { pluginTanstackQuery } from '@kubb/plugin-tanstack-query' // [!code --]
Expand Down
7 changes: 6 additions & 1 deletion e2e/kubb.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ const baseConfig = {
output: {
path: './clients/axios',
},
group: { type: 'tag', output: './clients/axios/{{tag}}Service' },
group: {
type: 'tag',
name({ group }) {
return `${group}Service`
},
},
}),
pluginZod({
output: {
Expand Down
Loading

0 comments on commit ebbfac2

Please sign in to comment.