@contractspec/app.cli-database 3.7.5 → 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.
- package/README.md +64 -42
- package/package.json +8 -7
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
|
-
|
|
7
|
+
## What It Does
|
|
7
8
|
|
|
8
|
-
|
|
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
|
-
|
|
14
|
+
## Running Locally
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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.
|
|
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": "
|
|
16
|
-
"lint:check": "
|
|
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",
|
|
@@ -25,16 +26,16 @@
|
|
|
25
26
|
"schema:compose": "database schema:compose"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@contractspec/lib.schema": "3.7.
|
|
29
|
+
"@contractspec/lib.schema": "3.7.6",
|
|
29
30
|
"prisma": "^7.4.2",
|
|
30
31
|
"minimist": "^1.2.8",
|
|
31
32
|
"execa": "^9.6.1"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@contractspec/tool.typescript": "3.7.
|
|
35
|
-
"@contractspec/tool.tsdown": "3.7.
|
|
35
|
+
"@contractspec/tool.typescript": "3.7.6",
|
|
36
|
+
"@contractspec/tool.tsdown": "3.7.6",
|
|
36
37
|
"@types/minimist": "^1.2.5",
|
|
37
|
-
"tsdown": "^0.21.
|
|
38
|
+
"tsdown": "^0.21.4"
|
|
38
39
|
},
|
|
39
40
|
"types": "./dist/index.d.mts",
|
|
40
41
|
"files": [
|