API Reference
Import from @aplok/bedrock-builder to run builds, generators, and checks from Node.
Every command function accepts a loaded config plus an options object, and returns a report.
import { loadConfig, build, harness } from "@aplok/bedrock-builder";
const config = await loadConfig("./config.json");
await build(config, { release: false });
await harness(config, { strict: true });Config
| Export | Description |
|---|---|
loadConfig(path?) |
Load plus validate. Throws ConfigError with exitCode 2 on failure. |
loadConfigLenient(path?) |
Load without disk validation, for repair flows. |
validateConfig(config, fs) |
Check packs, manifests, entry, deploy target. |
BedrockConfig |
Resolved config type. Paths are absolute. |
Build and ship
| Export | Description |
|---|---|
build(config, { release, clean, typecheck, stats, json }) |
Bundle plus copy packs. Returns BuildReport with timings and counts. |
pack(config, { output, level, typecheck, json }) |
Release build plus .mcaddon zip. Throws PackError with exitCode 4. |
clean(config, { json }) |
Remove dist plus cache. |
collectBuildStats(out, bundle) |
Size plus biggest files for --stats. |
buildBundle(config, { release }) |
esbuild the entry only. Throws BundlerError with exitCode 7. |
Watch and deploy
| Export | Description |
|---|---|
watch(config, { types, stop }) |
Rebuild on save until stopped. |
startWatch(config, options) |
Returns a session with stop() plus done. |
deploy(config, { release, watch, types, stop }) |
Build plus copy into the game. Throws DeployTargetError with exitCode 3. |
startDeployWatch(config, options) |
Deploy watch session with stop(). |
resolveDeployTarget(config) |
Resolve BP, RP, and root paths for the target. |
createPackWatcher(config) |
Chokidar watcher with temp, git, node_modules, and gitignore skips. |
SaveBatcher |
100ms save batcher shared by watch and deploy. |
Verify
| Export | Description |
|---|---|
doctor(config, { fix, json }) |
Check config, packs, entry, deploy target, plus extension health checks. |
harness(config, { build, strict, json }) |
Build plus cross-check dist. Throws HarnessError with exitCode 11. |
harnessCheck(out, { strict }) |
Check a dist dir directly, no config needed. |
Generate
| Export | Description |
|---|---|
create(config, opts) |
Run one generator. Throws GenerateError with exitCode 5 on conflict. |
CREATE_TYPES |
All 27 generator type names. |
planWeapon plus 26 more |
Per-type planners taking a Tree, config, and options. |
Tree, planTree, hasConflict |
Plan, check, and flush file writes. |
mergeLang, mergeItemTexture plus 6 more |
Registry merge helpers. |
validateName, validateIdentifier, deriveNamespace
|
Naming helpers. |
Extensions
| Export | Description |
|---|---|
defineProcessor(stage) |
Validate a processor with match plus remap, pre, transform, post hooks. |
registerProcessor(stage) |
Add or replace by name. |
loadExtensions(config) |
Load from the extensions array. |
inspectExtensions(config) |
Status per spec: ok, missing, or broken. |
ExtensionApi |
Generic extension API: register and settings. Media codecs belong to the extensions that use them. |
The core package does not export audio, PNG, or TGA processors. Install and configure the extension that owns the media format instead.
Project setup
| Export | Description |
|---|---|
init(name, options) |
Create a project. Throws InitError with exitCode 8. |
buildInitFiles(input) |
File list for a create, no disk writes. |
version(v, options) |
Write one version everywhere. |
manifest(options) |
Rewrite UUIDs plus cross-link packs. |
rewriteManifests(root, options) |
Lower level manifest rewrite. |
folders(config), listFolderOptions(config) |
Canonical folder picker plus listing. |