Skip to content

Latest commit

 

History

History
160 lines (118 loc) · 5.4 KB

conf-bit-json.md

File metadata and controls

160 lines (118 loc) · 5.4 KB
id title permalink layout category next prev
conf-bit-json
bit.json
docs/conf-bit-json.html
docs
Configuring Bit
conf-config.html
bit-on-the-server.html

The bit.json file is your workspace configuration file. This document specifies all the different configurations that are set in the file.

Overview

First of all, let's take a look at the file:

{
    "env": {
        "compiler": "bit.envs/compilers/[email protected]",
        "tester": "bit.envs/testers/[email protected]"
    },
    "saveDependenciesAsComponents": "true",
    "packageManager": "yarn",
    "packageManagerArgs": ["--production", "--no-optional"],
    "packageManagerProcessOptions": {
        "shell": true
    },
    "useWorkspaces": "",
    "manageWorkspaces": "true",
    "componentsDefaultDirectory": "components/{namespace}/{name}",
    "dependenciesDirectory": "components/.dependencies",
    "dist": {
        "entry": "src",
        "target": "dist"
    },
    "extensions": {
        "ext-docs-parser": {
            "config": {},
            "options": {
                "core": true
            }
        }
    },
    "resolveModules": {
        "modulesDirectories": ["src"],
        "aliases": {
            "@": "someDir"
        }
    },
}

Configurations

env : object

"env": {
        "compiler": "bit.envs/compilers/[email protected]",
        "tester": "none"
    },

The env section configures your compiler and tester environments. If you have a compiler/tester configured, it's full component id and version will be listed here. When no tester/compiler is configured, value will be none. Compilers and testers are not configured manually, but rather by importing them.

saveDependenciesAsComponents : bool

"saveDependenciesAsComponents": "true"

When you import Bit components, they may depend on other Bit components. Those will be installed as npm packages by default, unless you add the saveDependenciesAsComponents with a true value.

packageManager : string

"packageManager": "yarn"

The packageManager section determines which package manager will be used in order to install dependencies.

When not specified, default is npm.

packageManagerArgs : string[]

"packageManagerArgs": ["--production", "--no-optional"]

The packageManagerArgs section allows you to specify npm or yarn install arguments to be used.

packageManagerProcessOptions : object

"packageManagerProcessOptions": {
        "shell": true
    }

The packageManagerProcessOptions section configures additional options for the child-process running the package manager. The available options are the following execa options: shell, env, extendEnv, uid, gid, preferLocal, localDir, timeout.

useWorkspaces : bool

"useWorkspaces": true

The useWorkspaces section determines whether to use yarn workspaces.

manageWorkspaces : bool

"manageWorkspaces": true

The manageWorkspaces section determines whether bit lists the component directories in the root package.json's workspaces section. Bit will list there the componentsDefaultDirectory, dependenciesDirectory, and all custom import paths. Additionally, bit will mark the root package.json as private: true.

Relevant only when packageManager is yarn, and useWorkspaces is true.

componentsDefaultDirectory : string

"componentsDefaultDirectory": "components/{namespace}/{name}"

The componentsDefaultDirectory section configures the directory where Bit will install the components you import. You can specify a path using our DSL, which supports name and namespace.

dependenciesDirectory : string

"dependenciesDirectory": "components/.dependencies"

The dependenciesDirectory configures the directory where Bit will install components that weren't installed directly, but as dependencies to other components. This is relevant only when saveDependenciesAsComponents is set to true.

dist : object

The dist section configures:

  • entry - The entry point for the dist files (e.g. if your component has an 'src' directory that contains all the files, you should set is as the entry point).
  • target - Where the dist files will be placed after components are built. If not defined, dist files will be placed inside the component directory.

extensions : object

The extension section configures your extensions. Those will be listed here after your import them. The extension's configuration and options are listed for each extension.

resolveModules : object

The resolveModules section configures custom module resolution for Bit components. This is similar to Webpack's resolve, and contains 2 objects:

  • moduleDirectories - Add additional paths to resolve components from.
  • aliases - Sets an alias for a directory.