@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 thekubb.config.js
file.- Abstract classes for plugins
Generator
which contains the base with a getter foroptions
and abuild
function.
- Managers classes as the base for all logic
FileManager
which is used to store all files before those are saved to the file system.PluginManager
which contains the logic of when which plugin can be triggered, see pluginManager.
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.