From 564eab23afe79e1cb625f2c335efcc30b9b7dd6a Mon Sep 17 00:00:00 2001 From: dswbx Date: Sat, 20 Sep 2025 20:02:56 +0200 Subject: [PATCH] docs: improve CLI documentation formatting --- .../docs/(documentation)/usage/cli.mdx | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/docs/content/docs/(documentation)/usage/cli.mdx b/docs/content/docs/(documentation)/usage/cli.mdx index a369d98..daa3303 100644 --- a/docs/content/docs/(documentation)/usage/cli.mdx +++ b/docs/content/docs/(documentation)/usage/cli.mdx @@ -7,18 +7,16 @@ tags: ["documentation"] The bknd package includes a command-line interface (CLI) that allows you to run a bknd instance and perform various tasks. -``` +```sh npx bknd ``` Here is the output: -``` +```sh $ npx bknd Usage: bknd [options] [command] -⚡ bknd cli v0.17.0 - Options: -V, --version output the version number -h, --help display help for command @@ -41,7 +39,7 @@ Commands: To see all available `run` options, execute `npx bknd run --help`. -``` +```sh $ npx bknd run --help Usage: bknd run [options] @@ -99,7 +97,7 @@ The `app` function is useful if you need a cross-platform way to access the envi If you're using `npx bknd run`, make sure to create a file in a file format that `node` can load, otherwise you may run into an error that the file couldn't be found: -```sh +``` [INF] 2025-03-28 18:02:21 Using config from bknd.config.ts [ERR] 2025-03-28 18:02:21 Failed to load config: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'bknd.config.ts' imported from [...] at packageResolve (node:internal/modules/esm/resolve:857:9) @@ -124,7 +122,7 @@ npx tsx node_modules/.bin/bknd run To start an instance with a Turso/LibSQL database, run the following: -``` +```sh npx bknd run --db-url libsql://your-db.turso.io --db-token ``` @@ -134,7 +132,7 @@ The `--db-token` option is optional and only required if the database is protect To start an instance with an ephemeral in-memory database, run the following: -``` +```sh npx bknd run --memory ``` @@ -144,7 +142,7 @@ Keep in mind that the database is not persisted and will be lost when the proces To see all available `types` options, execute `npx bknd types --help`. -``` +```sh $ npx bknd types --help Usage: bknd types [options] @@ -158,13 +156,13 @@ Options: To generate types for the database, run the following: -``` +```sh npx bknd types ``` This will generate types for your database schema in `bknd-types.d.ts`. The generated file could look like this: -```typescript bknd-types.d.ts +```typescript title="bknd-types.d.ts" import type { DB } from "bknd"; import type { Insertable, Selectable, Updateable, Generated } from "kysely"; @@ -191,7 +189,7 @@ declare module "bknd" { Make sure to add the generated file in your `tsconfig.json` file: -```json tsconfig.json +```json title="tsconfig.json" { "include": ["bknd-types.d.ts"] } @@ -211,7 +209,7 @@ All bknd methods that involve your database schema will be automatically typed. To see all available `config` options, execute `npx bknd config --help`. -``` +```sh $ npx bknd config --help Usage: bknd config [options] @@ -229,13 +227,13 @@ Options: To get the configuration of your app, and to write it to a file, run the following: -``` +```sh npx bknd config --out appconfig.json ``` To get a template configuration instead, run the following: -``` +```sh npx bknd config --default ``` @@ -245,7 +243,7 @@ To automatically sync your configuration to a file, you may also use the [`syncC To see all available `secrets` options, execute `npx bknd secrets --help`. -``` +```sh $ npx bknd secrets --help Usage: bknd secrets [options] @@ -267,7 +265,7 @@ To automatically sync your secrets to a file, you may also use the [`syncSecrets Sync your database can be useful when running in [`code`](/usage/introduction/#code-only-mode) mode. When you're ready to deploy, you can point to the production configuration and sync the database. Schema mutations are only applied when running with the `--force` option. -``` +```bash $ npx bknd sync --help Usage: bknd sync [options]