Home

Configuration

You can configure how your projects build on CodeSandbox CI by creating a file called ci.json in a folder called .codesandbox in the root of your repository.

Configuration Format

These are all the configuration options you can set, remember that they are all optional.

{
  // which script in package.json to run to install instead of `npm ci` or `yarn install`,
  // can be `false` if you want to skip this step
  "installCommand": "install",
  // which script in package.json to run to build,
  // can be `false` if you want to skip this step
  "buildCommand": "build",
  // if you have a monorepo, put the paths of the packages here. We'll infer the package names.
  // globs are supported
  "packages": ["packages/react", "packages/react-dom"],
  // if you don't publish from the package directory, specify per dependency
  // where the contents of the built dependency are. These files will be uploaded
  // to our registry
  "publishDirectory": {
    "react": "build/node_modules/react"
    "react-dom": "build/node_modules/react-dom"
  },
  // a list of sandboxes that you want generated for a PR, if this list
  // is not set we will default to `vanilla`. The built library will automatically
  // be installed in the fork of these sandboxes in the place of the library. So if
  // you have a sandbox with `lodash`, and you built `lodash` and `vue`, we will only
  // replace `lodash` with the built version.
  "sandboxes": ["vanilla", "new", "github/reduxjs/redux/tree/master/examples/todomvc"]
}

Monorepo Example

Monorepos are quite common, here's an example configuration for a monorepo:

{
  "packages": ["./", "packages/vue-template-compiler"],
}

This builds two libraries: `vue`, which is in the root of the repository, and `vue-template-compiler`, which resides in the `packages` folder.

We handle auto linking of these dependencies, this means that we rewrite the dependencies to the newly built versions of CodeSandbox CI. In this example, `vue` uses `vue-template-compiler`, so we've updated `package.json` of `vue` to point to our built `vue-template-compiler`.