How to use Bun for building, testing, and developing elementor-cli.
# macOS/Linux
curl -fsSL https://bun.sh/install | bash
# Verify installation
bun --version# Run directly (no build needed)
bun run src/index.ts
# Run with arguments
bun run src/index.ts config list
bun run src/index.ts pages list --site production
# Watch mode (auto-restart on changes)
bun --watch run src/index.ts# Install all dependencies
bun install
# Add a dependency
bun add <package>
# Add a dev dependency
bun add -d <package>
# Remove a dependency
bun remove <package># Build single executable (Bun runtime)
bun build src/index.ts --outfile dist/elementor-cli --target bun| Flag | Description |
|---|---|
--outfile <path> |
Output file path |
--outdir <path> |
Output directory (for multiple entry points) |
--target bun |
Optimize for Bun runtime |
--target node |
Compatible with Node.js |
--minify |
Minify output |
--sourcemap |
Generate source maps |
--external <pkg> |
Don't bundle this package |
# Run all tests
bun test
# Run specific test file
bun test tests/config-store.test.ts# Check types without emitting
tsc --noEmit# Install
bun add -d @biomejs/biome
# Initialize config
bunx biome init
# Check code
bunx biome check src/
# Format code
bunx biome format --write src/
# Lint and fix
bunx biome lint --apply src/"Cannot find module" errors:
# Clear Bun cache and reinstall
bun pm cache rm
rm -rf node_modules bun.lockb
bun installType errors with Bun APIs:
# Ensure bun-types is installed
bun add -d @types/bunBuild fails with external dependencies:
# Mark problematic packages as external
bun build src/index.ts --outfile dist/cli --external commander