Skip to content

@kubb/core 🦙 ​

The core contains the building blocks for all plugins.

Features ​

  • Read and write to the file system(Windows, Mac and Linux support).
  • Format code/source with Prettier.
  • Types needed to create a plugin and the types needed for the lifecycle/pluginManager.
  • Basic utilities such as isPromise, isURL, createJSDocBlockText, cache,...
  • createPlugin functionality to set up a plugin.
  • defineConfig functionality to set up the kubb.config.js file.
  • Abstract classes for plugins
    • Generator which contains the base with a getter for options and a build function.
  • Managers classes as the base for all logic

Installation ​

shell
bun add @kubb/core
shell
pnpm add @kubb/core
shell
npm install @kubb/core
shell
yarn add @kubb/core

Usage ​

typescript
import { write } from '@kubb/fs'
import { build } from '@kubb/core'

const { error, files, pluginManager } = await build({
  config: {
    root: '.',
    input: {
      data: '',
    },
    output: {
      path: './gen',
    },
  },
})

for (const file of files) {
  await write(file.source, file.path)
}

Start the build process based on a defined config(see UserConfig type). This will trigger the different plugins and their created lifecycle methods.

Released under the MIT License.