mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
docs: improve CLI documentation formatting
This commit is contained in:
@@ -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.
|
The bknd package includes a command-line interface (CLI) that allows you to run a bknd instance and perform various tasks.
|
||||||
|
|
||||||
```
|
```sh
|
||||||
npx bknd
|
npx bknd
|
||||||
```
|
```
|
||||||
|
|
||||||
Here is the output:
|
Here is the output:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
$ npx bknd
|
$ npx bknd
|
||||||
Usage: bknd [options] [command]
|
Usage: bknd [options] [command]
|
||||||
|
|
||||||
⚡ bknd cli v0.17.0
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-V, --version output the version number
|
-V, --version output the version number
|
||||||
-h, --help display help for command
|
-h, --help display help for command
|
||||||
@@ -41,7 +39,7 @@ Commands:
|
|||||||
|
|
||||||
To see all available `run` options, execute `npx bknd run --help`.
|
To see all available `run` options, execute `npx bknd run --help`.
|
||||||
|
|
||||||
```
|
```sh
|
||||||
$ npx bknd run --help
|
$ npx bknd run --help
|
||||||
Usage: bknd run [options]
|
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:
|
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
|
[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 [...]
|
[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)
|
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:
|
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 <your-token>
|
npx bknd run --db-url libsql://your-db.turso.io --db-token <your-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:
|
To start an instance with an ephemeral in-memory database, run the following:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
npx bknd run --memory
|
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`.
|
To see all available `types` options, execute `npx bknd types --help`.
|
||||||
|
|
||||||
```
|
```sh
|
||||||
$ npx bknd types --help
|
$ npx bknd types --help
|
||||||
Usage: bknd types [options]
|
Usage: bknd types [options]
|
||||||
|
|
||||||
@@ -158,13 +156,13 @@ Options:
|
|||||||
|
|
||||||
To generate types for the database, run the following:
|
To generate types for the database, run the following:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
npx bknd types
|
npx bknd types
|
||||||
```
|
```
|
||||||
|
|
||||||
This will generate types for your database schema in `bknd-types.d.ts`. The generated file could look like this:
|
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 { DB } from "bknd";
|
||||||
import type { Insertable, Selectable, Updateable, Generated } from "kysely";
|
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:
|
Make sure to add the generated file in your `tsconfig.json` file:
|
||||||
|
|
||||||
```json tsconfig.json
|
```json title="tsconfig.json"
|
||||||
{
|
{
|
||||||
"include": ["bknd-types.d.ts"]
|
"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`.
|
To see all available `config` options, execute `npx bknd config --help`.
|
||||||
|
|
||||||
```
|
```sh
|
||||||
$ npx bknd config --help
|
$ npx bknd config --help
|
||||||
Usage: bknd config [options]
|
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:
|
To get the configuration of your app, and to write it to a file, run the following:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
npx bknd config --out appconfig.json
|
npx bknd config --out appconfig.json
|
||||||
```
|
```
|
||||||
|
|
||||||
To get a template configuration instead, run the following:
|
To get a template configuration instead, run the following:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
npx bknd config --default
|
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`.
|
To see all available `secrets` options, execute `npx bknd secrets --help`.
|
||||||
|
|
||||||
```
|
```sh
|
||||||
$ npx bknd secrets --help
|
$ npx bknd secrets --help
|
||||||
Usage: bknd secrets [options]
|
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.
|
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
|
$ npx bknd sync --help
|
||||||
Usage: bknd sync [options]
|
Usage: bknd sync [options]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user