diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d8bfbf686..c6077d1439 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -134,6 +134,20 @@ We recommend adding `./build/debug` to your `$PATH` so that you can run `bun-deb $ bun-debug ``` +## Running debug builds + +The `bd` package.json script compiles and runs a debug build of Bun without printing the output of the build process if it fails. + +1. Builds a debug build of Bun +2. Only prints the output of the build process if it fails +3. Runs it passing through any arguments + +```sh +$ bun bd +$ bun bd test foo.test.ts +$ bun bd ./foo.ts +``` + ## Code generation scripts Several code generation scripts are used during Bun's build process. These are run automatically when changes are made to certain files. diff --git a/package.json b/package.json index 07963fb5de..cfc27daf7f 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ }, "scripts": { "build": "bun run build:debug", + "bd": "(bun run --silent build:debug &> /tmp/bun.debug.build.log || (cat /tmp/bun.debug.build.log && rm -rf /tmp/bun.debug.build.log && exit 1)) && rm -f /tmp/bun.debug.build.log && ./build/debug/bun-debug", "build:debug": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Debug -B build/debug", "build:valgrind": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Debug -DENABLE_BASELINE=ON -ENABLE_VALGRIND=ON -B build/debug-valgrind", "build:release": "bun ./scripts/build.mjs -GNinja -DCMAKE_BUILD_TYPE=Release -B build/release",