kubb-labs / kubb

The ultimate toolkit for working with APIs.
https://kubb.dev
MIT License
729 stars 67 forks source link

Main `index.ts` not being created using `barrelType: 'all'` #1398

Open burt202 opened 1 day ago

burt202 commented 1 day ago

What version of kubb is running?

3.0.5

What platform is your computer?

Linux

What version of external packages are you using(@tanstack-query, MSW, React, Vue, ...)

See linked repo below

What steps can reproduce the bug?

Im trying to upgrade our setup to v3, which takes a yml openapi docs link and spits out generated TS for it. In v2, an index.ts file gets created alongside the types.ts but i cant seem to get this working in v3. Im aware of the new barrelType option and think im using it correctly to the docs

For repro, clone repo linked below and npm ci and npm run generate

https://github.com/burt202/kubb-test/tree/master

Any help would be appreciated as to what im doing wrong. Cheers!

How often does this bug happen?

Every time

What is the expected behavior?

Index file should be created with the contents export * from "./types"

Swagger/OpenAPI file?

No response

Additional information

No response

linear[bot] commented 1 day ago

KUBB-69 Main `index.ts` not being created using `barrelType: 'all'`

stijnvanhulle commented 9 hours ago

v3.0.6 will resolve your issue.

You will need to use barrelType: 'propagate', instead on plugin level so the output could still use the barrel file.

See https://www.kubb.dev/plugins/plugin-react-query/#output-barreltype-1

burt202 commented 4 hours ago

Thanks for the quick reply. This is still not working for me using v3.0.6 using the following config:

import {defineConfig}  from '@kubb/core'
import {pluginOas}  from '@kubb/plugin-oas'
import {pluginTs}  from '@kubb/plugin-ts'

export default defineConfig({
  root: '.',
  input: {
    path: 'docs/main.yml'
  },
  output: {
    path: 'generated/',
    barrelType: 'all',
    clean: true
  },
  plugins: [
    pluginOas({
      generators: [],
    }),
    pluginTs({
      output: {
        path: "./types.ts",
        barrelType: 'propagate'
      }
    })
  ]
})

Repro code: https://github.com/burt202/kubb-test

The generation runs without error but no index.ts file is created. Where am I going wrong?

Cheers!