Skip to main content
Version: 2.1.x

bsconfig.json

Every BlueScript project has a bsconfig.json file at the project root. The CLI reads this file when compiling, installing packages, and running code on a device.

bscript project create generates the file automatically. You can also edit it by hand.

Example​

bsconfig.json
{
"projectName": "hello-bluescript",
"boardName": "esp32",
"version": "1.0.0",
"vmVersion": "2.0.0",
"srcDir": "./src",
"entryFile": "./src/index.bs",
"dependencies": {},
"espIdfComponents": []
}

Common fields​

These fields are shared across all supported boards.

FieldRequiredDefaultDescription
projectNameYes—Project name. Also used as the main package name during compilation.
boardNameYes—Target board. Supported: esp32, host.
versionNo"1.0.0"Project version string.
vmVersionNoCLI versionBlueScript runtime version this project targets.
srcDirNo"."Directory containing BlueScript (.bs) and C (.c) source files, relative to the project root.
entryFileNo"./index.bs"Entry BlueScript file executed by bscript project run, relative to the project root.
dependenciesNo{}Installed package dependencies. Usually managed by bscript project install.

srcDir and entryFile​

srcDir defines where the compiler looks for source files. Both BlueScript modules and standalone C files must live under this directory.

entryFile is the program that runs first. When you use bscript project run --with-repl or --with-notebook, this file runs before interactive mode starts.

bscript project create sets:

  • srcDir: "./src"
  • entryFile: "./src/index.bs"

If you omit these fields in an existing project, the compiler falls back to the project root:

  • srcDir: "."
  • entryFile: "./index.bs"
Import paths

Relative import paths must resolve to files under srcDir. Importing from outside srcDir (for example with ../) causes a compile error.

dependencies​

Maps package names to Git repository URLs. An optional tag or branch can be appended after #.

{
"dependencies": {
"gpio": "https://github.com/bluescript-lang/pkg-gpio-esp32.git",
"drivers": "https://github.com/example/drivers.git#v1.0.0"
}
}

Use bscript project install to add packages instead of editing this field by hand when possible.

ESP32 fields​

When boardName is "esp32", the following additional fields are available. These fields do not apply to host projects.

FieldRequiredDefaultDescription
espIdfComponentsNo[]ESP-IDF component names to link when compiling Inline C code.
{
"boardName": "esp32",
"espIdfComponents": [
"esp_driver_gpio"
]
}

Bluetooth device names are not configured in bsconfig.json. Pass -d / --device-name to bscript project run, bscript repl, or bscript board flash-runtime instead. See the CLI reference.

See the Inline C tutorial for espIdfComponents usage examples.

Host example​

A minimal bsconfig.json for the host runtime:

bsconfig.json (host)
{
"projectName": "hello-host",
"boardName": "host",
"version": "1.0.0",
"vmVersion": "2.0.0",
"srcDir": "./src",
"entryFile": "./src/index.bs",
"dependencies": {}
}

See Try Without Microcontroller for setup steps.

Generated project layout​

A project created with bscript project create looks like this:

my-app/
├── bsconfig.json
├── src/
│ └── index.bs
├── dist/ (created on compile)
└── packages/ (created when you install packages)