overview
Commands Overview
Balda's CLI provides built-in generators and utilities to speed up your workflow. You can also author custom commands.
Commands are stateless so every time you run a command it will start from scratch and you need to handle dependency injection yourself.
Custom commands MUST be placed in the src/commands directory (you can't change this in the config file).
Built-in commands
init: scaffold a new project structurelist: display all available commandsgenerate-command: scaffold a CLI commandgenerate-plugin: scaffold a plugingenerate-queue: scaffold a queue handlergenerate-cron: scaffold a cron job (requiresnode-cronpackage installed)build: build the project for production (Node.js only, requiresesbuild)
Command Usage
Node
# Using npx
npx balda <command> [options]
# Using yarn
yarn balda <command> [options]
# Using pnpm
pnpm balda <command> [options]
Bun
bun run balda <command> [options]
Deno
- Deno is a little bit more complex and requires some setup. First, you need to create the following deno_cli.ts file in your project (name does not matter):
const command = new Deno.Command("node", {
args: ["node_modules/.bin/balda", ...Deno.args],
stdout: "piped",
stderr: "piped",
});
const { code, stdout, stderr } = await command.output();
console.log("Exit code:", code);
const stderrText = new TextDecoder().decode(stderr);
if (stderrText) {
console.error("stderr:", stderrText);
}
const stdoutText = new TextDecoder().decode(stdout);
if (stdoutText) {
console.log("stdout:", stdoutText);
} else {
console.log("No output from command");
}
export {};
- Then you can run any command like this:
deno run -A deno_cli.ts <command> [options]