@brickkit/cli
The brick command's building blocks: the dev and production servers, contract generation, and the OpenAPI pages.
@brickkit/cli exports 6 names: 4 functions, 2 interfaces.
import { buildApplication, emitCompiledApplication, generateClientContract } from "@brickkit/cli";Functions
| Function | Description |
|---|---|
buildApplication | Bundle an exported BrickApp with generated handlers and its original configuration. |
emitCompiledApplication | An ES module of real JS functions; it never stringifies application callbacks. |
generateClientContract | Generate browser metadata and transport types from the app's selected services. |
startDevServer | What brick dev runs: start the application, restart it when its files change, and serve the dashboard beside it. |
buildApplication
function buildApplication(
options: BuildApplicationOptions,
): Promise<{ outdir: string; entry: string; ir: any; }>Bundle an exported BrickApp with generated handlers and its original configuration.
Parameters
| Name | Type | Description |
|---|---|---|
options | BuildApplicationOptions |
Returns Promise<{ outdir: string; entry: string; ir: any; }>
Source: packages/cli/src/build.ts:17
emitCompiledApplication
function emitCompiledApplication(
ir: BrickIR,
runtimeImport = "@brickkit/core",
): stringAn ES module of real JS functions; it never stringifies application callbacks.
Parameters
| Name | Type | Description |
|---|---|---|
ir | BrickIR | |
runtimeImport? | string default "@brickkit/core" |
Returns string
Source: packages/cli/src/compiler/emit.ts:4
generateClientContract
function generateClientContract(app: BrickApp): stringGenerate browser metadata and transport types from the app's selected services.
Parameters
| Name | Type | Description |
|---|---|---|
app | BrickApp |
Returns string
Source: packages/cli/src/client-contract.ts:7
startDevServer
function startDevServer(options: DevServerOptions = {}): Promise<any>What brick dev runs: start the application, restart it when its files
change, and serve the dashboard beside it. With an entry, the app runs in
a worker process that restarts on every change to the entry or the files it
imports, and reports its requests to the dashboard; without one, a server
with the registered services starts in this process.
Parameters
| Name | Type | Description |
|---|---|---|
options? | DevServerOptions default {} | entry, port (else PORT, else 4000), prefix, clientOutput to regenerate the typed client's contract on each start, frontend to launch a frontend command once, and dashboard (port and historyDays, or false). |
Returns Promise<any> — The application, when started in this process.
Throws
- When
frontendis given withoutclientOutput, or the dashboard would use the app's port.
Source: packages/cli/src/runner.ts:236
Interfaces
BuildApplicationOptions
interface BuildApplicationOptionsProperties
| Name | Type | Description |
|---|---|---|
entry | string | A module whose default export is a BrickApp, without starting a server. |
outdir? | string | |
port? | number | |
aot? | boolean | Precompile Elysia's HTTP handlers at build time (default true). |
Source: packages/cli/src/build.ts:7
DevServerOptions
interface DevServerOptionsProperties
| Name | Type | Description |
|---|---|---|
port? | number | |
entry? | string | |
prefix? | string | |
clientOutput? | string | Generate a browser contract before starting the backend and frontend. |
frontend? | string | Frontend command, launched once after the first successful generation. |
dashboard? | { port: number; historyDays?: number } | false | Local dashboard with live requests, traces, errors, and reloads. Needs an entry. historyDays is how long finished requests are kept on disk (default 90); zero keeps live data only. |
Source: packages/cli/src/runner.ts:26