@contractspec/app.cli-database 3.7.6 → 3.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +64 -42
  2. package/package.json +5 -4
package/README.md CHANGED
@@ -1,55 +1,77 @@
1
1
  # @contractspec/app.cli-database
2
2
 
3
- Website: https://contractspec.io/
3
+ Website: https://contractspec.io
4
4
 
5
+ **CLI tool for single-database management: import, generate, migrate, seed, and schema operations. Wraps Prisma with ContractSpec schema conventions.**
5
6
 
6
- Prisma wrapper and CLI tools for managing database schemas, migrations, and seeding within the LSSM monorepo.
7
+ ## What It Does
7
8
 
8
- ## Purpose
9
+ - Uses `@contractspec/lib.schema` for schema definitions.
10
+ - Uses Prisma for database operations and migrations.
11
+ - Commands dispatched via minimist argument parsing.
12
+ - Related ContractSpec packages include `@contractspec/lib.schema`, `@contractspec/tool.tsdown`, `@contractspec/tool.typescript`.
9
13
 
10
- To abstract and standardize Prisma usage across multiple services and verticals. It provides a unified CLI (`database`) to handle common database tasks like migrations (`dbs:migrate`), client generation (`dbs:generate`), and seeding (`dbs:seed`).
14
+ ## Running Locally
11
15
 
12
- ## Installation
13
-
14
- ```bash
15
- npm install @contractspec/app.cli-database
16
- # or
17
- bun add @contractspec/app.cli-database
18
- ```
19
-
20
- ## Key Concepts
21
-
22
- - **Unified Config**: Centralizes Prisma configuration.
23
- - **CLI Wrapper**: Wraps standard Prisma commands for consistent execution in the monorepo environment.
24
- - **Seeding**: Standardized seeding entry point.
25
-
26
- ## Exports
27
-
28
- - `cli`: The command-line interface.
29
- - `prisma`: Re-exports `@prisma/client`.
16
+ From `packages/apps/cli-database`:
17
+ - `bun run dev`
18
+ - `bun run build`
30
19
 
31
20
  ## Usage
32
21
 
33
- ### CLI Commands
34
-
35
- Run via package scripts:
36
-
37
22
  ```bash
38
- # Generate Prisma Client
39
- bun database generate
40
-
41
- # Run migrations
42
- bun database migrate:dev
43
-
44
- # Seed database
45
- bun database seed
23
+ npx database --help
24
+ # or
25
+ bunx database --help
46
26
  ```
47
27
 
48
- ### In Code
49
-
50
- ```ts
51
- import { PrismaClient } from '@contractspec/app.cli-database';
52
-
53
- const prisma = new PrismaClient();
54
- const users = await prisma.user.findMany();
55
- ```
28
+ ## Architecture
29
+
30
+ - Uses `@contractspec/lib.schema` for schema definitions.
31
+ - Uses Prisma for database operations and migrations.
32
+ - Commands dispatched via minimist argument parsing.
33
+ - `src/cli.ts` is the CLI entrypoint.
34
+ - `src/index.ts` is the root public barrel and package entrypoint.
35
+
36
+ ## Public Entry Points
37
+
38
+ - Binary `database` points to `dist/cli.js`.
39
+ - Export `.` resolves through `./dist/index.mjs`.
40
+ - Export `./cli` resolves through `./dist/cli.mjs`.
41
+ - Export `./commands/check` resolves through `./dist/commands/check.mjs`.
42
+ - Export `./commands/generate` resolves through `./dist/commands/generate.mjs`.
43
+ - Export `./commands/import` resolves through `./dist/commands/import.mjs`.
44
+ - Export `./commands/migrate` resolves through `./dist/commands/migrate.mjs`.
45
+ - Export `./commands/schema-compose` resolves through `./dist/commands/schema-compose.mjs`.
46
+ - Export `./commands/schema-generate` resolves through `./dist/commands/schema-generate.mjs`.
47
+ - Export `./commands/seed` resolves through `./dist/commands/seed.mjs`.
48
+ - Export `./lib/config` resolves through `./dist/lib/config.mjs`.
49
+ - The package publishes 12 total export subpaths; keep docs aligned with `package.json`.
50
+
51
+ ## Local Commands
52
+
53
+ - `bun run dev` — bun run build --watch
54
+ - `bun run build` — tsdown
55
+ - `bun run lint` — bun run lint:fix
56
+ - `bun run lint:check` — biome check .
57
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
58
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
59
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
60
+ - `bun run clean` — rm -rf dist
61
+ - `bun run prisma:format` — prisma format
62
+ - `bun run prisma:import` — database import
63
+ - `bun run prisma:check` — database check
64
+ - `bun run dbs:generate` — database generate
65
+ - `bun run dbs:migrate` — database migrate:dev
66
+ - `bun run dbs:deploy` — database migrate:deploy
67
+ - `bun run dbs:status` — database migrate:status
68
+ - `bun run dbs:seed` — database seed
69
+
70
+ ## Recent Updates
71
+
72
+ - Replace eslint+prettier by biomejs to optimize speed.
73
+
74
+ ## Notes
75
+
76
+ - Do not change CLI argument signatures without updating docs and CI scripts.
77
+ - Prisma schema generation is order-sensitive — test migrations carefully.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/app.cli-database",
3
- "version": "3.7.6",
3
+ "version": "3.7.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "database": "dist/cli.js"
@@ -12,8 +12,9 @@
12
12
  "build": "tsdown",
13
13
  "dev": "bun run build --watch",
14
14
  "lint": "bun run lint:fix",
15
- "lint:fix": "eslint src --fix",
16
- "lint:check": "eslint src",
15
+ "lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
16
+ "lint:check": "biome check .",
17
+ "prisma:format": "prisma format",
17
18
  "prisma:import": "database import",
18
19
  "prisma:check": "database check",
19
20
  "dbs:generate": "database generate",
@@ -34,7 +35,7 @@
34
35
  "@contractspec/tool.typescript": "3.7.6",
35
36
  "@contractspec/tool.tsdown": "3.7.6",
36
37
  "@types/minimist": "^1.2.5",
37
- "tsdown": "^0.21.0"
38
+ "tsdown": "^0.21.4"
38
39
  },
39
40
  "types": "./dist/index.d.mts",
40
41
  "files": [