Skip to main content
Command Line Interface

tsci build

tsci build runs the TSCircuit evaluator and writes circuit.json files.

Usage

tsci build [path] [--ignore-errors] [--ignore-warnings] [--all-images] [--transpile]

Arguments

  • path (optional) – path to a source file or directory. If omitted, the command searches for a project entrypoint such as index.tsx or the mainEntrypoint defined in tscircuit.config.json. In addition, all files matching the *.circuit.tsx pattern are built automatically.

Output

Output files are placed in a dist/ directory relative to your project. The main entrypoint produces dist/circuit.json. Each *.circuit.tsx file generates its own subdirectory. For example, src/blink.circuit.tsx becomes dist/src/blink/circuit.json.

Options

  • --ignore-errors – do not exit with code 1 on evaluation errors.
  • --ignore-warnings – suppress warning messages.
  • --all-images – emit every renderable image (PCB, schematic, 3D preview) for each built circuit into the matching dist subdirectory.
  • --transpile – emit bundler-friendly JavaScript alongside the generated circuit.json. See Transpiling circuit entrypoints for details.

Targeting specific sources

  • tsci build path/to/file.circuit.tsx – builds the given file, even if it does not match the includeBoardFiles glob in tscircuit.config.json.
  • tsci build path/to/directory – scans only the files inside path/to/directory that both satisfy the includeBoardFiles glob and reside within the directory. Files outside the directory or filtered out by the glob are skipped.

Use this command before publishing or in CI to ensure your circuits evaluate correctly.

Transpiling circuit entrypoints

Pass the --transpile flag when you need browser-friendly or Node.js-friendly bundles of the same entry file you used to build circuit.json. The flag runs an extra Rollup pass that writes:

  • dist/<entry>/index.js – an ESM bundle
  • dist/<entry>.cjs – a CommonJS bundle
  • dist/<entry>.d.ts – generated type declarations that reflect the JSX surface of your entry file

This extra work is useful when you want to re-use the same TSCircuit entrypoint in a documentation site, demo, or other tooling without re-running the evaluator.

Example project

Spin up a scratch directory with tsci init to reproduce the transpile flow locally:

mkdir tsci-transpile-demo
cd tsci-transpile-demo
tsci init

Replace the generated index.tsx with a tiny RC circuit:

index.tsx
/// <reference types="tscircuit" />
import React from "react"

export default () => (
<board>
<resistor resistance="1k" footprint="0402" name="R1" schX={3} pcbX={3} />
<capacitor
capacitance="1000pF"
footprint="0402"
name="C1"
schX={-3}
pcbX={-3}
/>
<trace from=".R1 > .pin1" to=".C1 > .pin1" />
</board>
)

Then run the transpile build:

tsci build --transpile

The build writes dist/index/circuit.json as usual, then finishes by bundling the entrypoint and printing the paths to the emitted ESM, CJS, and type declaration artifacts.

You can inspect the generated files with tree dist:

dist
├── index
│ └── circuit.json
├── index.cjs
├── index.d.ts
└── index.js

2 directories, 4 files