# Configuration

## Introduction

You can overwrite default configuration options that will be taken into effect
when running the different buflib commands by adding a file in root of your
project with the name ".buflib.json".

example:

```json
{
  "libRootFolderName": "buflib",
  "componentsPath": "./components",
  "stylePrefix": "bl-",
  "lib": {
    "exportComponents": true,
    "entry": "./index.js",
    "componentPrefix": "Bl"
  },
  "templates": {
    "component": {
      "path": "./templates/component.js",
      "extension": "jsx"
    },
    "style": {
      "path": "./templates/component.scss",
      "extension": "scss"
    }
  }
}
```

## Options

| Key                           | Type    | Default                                                       | Description                                                                     |
| ----------------------------- | ------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| libRootFolderName [^1]        | String  | "buflib"                                                      | Root folder name.                                                               |
| docsRootFolderName [^2]       | String  | "buflib_docs"                                                 | Documentation root folder name.                                                 |
| componentsPath                | String  | "./components"                                                | Path to where components should be scaffolded.                                  |
| storiesPath                   | String  | "./stories"                                                   | Path to where stories should be [^3]scaffolded.                                 |
| stylePrefix                   | String  | "bl-"                                                         | Prefix to attach to css class names.                                            |
| lib.exportComponents [^4]     | Boolean | `true`                                                        | Whether to write export statements to your entry file on component scaffolding. |
| lib.entry [^5]                | String  | "./index.js"                                                  | Path to entry file.                                                             |
| lib.componentPrefix [^5]      | String  | "Bl"                                                          | Prefix to attach to component names on export.                                  |
| templates.component.path      | String  | "\<global node modules\>/buflib_cli/templates/component.js"   | Path to file to use as template for component scaffolding.                      |
| templates.component.extension | String  | "jsx"                                                         | Extension to add to generated component file.                                   |
| templates.style.path          | String  | "\<global node modules\>/buflib_cli/templates/component.scss" | Path to file to use as template for style scaffolding.                          |
| templates.style.extension     | String  | "scss"                                                        | Extension to add to generated style file.                                       |
| templates.story.path          | String  | "\<global node modules\>/build/templates/story.mdx"           | Path to file to use as template for story scaffolding.                          |
| templates.story.extension     | String  | "mdx"                                                         | Extension to add to generated story file.                                       |

- [^1]:
      Overwrite if you want to use `buflib make-component` in another project
      than buflib.
- [^2]:
      Overwrite if you want to use `buflib make-story` in another project than
      buflib_docs.
- [^3]:
      If the storiePath matches the componentPath, the story will be put in the
      same folder as the component (including component folder in the file
      path).
- [^4]:
      If you are using buflib_cli to scaffold components in a project that is
      not a component library, you typically would want to set this to false.
- [^5]: Only relevant if `lib.exportComponents` is set to `true`.
