@chidchanun/bcp 0.2.2 → 0.2.4
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 +117 -121
- package/docs/api-manifest.json +2 -2
- package/docs/api-reference.md +21 -2
- package/docs/application-packaging.md +243 -0
- package/docs/database-migrations.md +79 -19
- package/docs/database.md +197 -28
- package/docs/deployment.md +94 -7
- package/docs/docs-web-manifest.json +7 -4
- package/docs/platform-manifest.json +24 -5
- package/docs/releases/0.2.3.md +77 -0
- package/docs/releases/0.2.4.md +152 -0
- package/package.json +1 -1
- package/packages/cli/src/application-packaging.ts +1162 -0
- package/packages/cli/src/args.ts +2 -0
- package/packages/cli/src/bootstrap.ts +1 -0
- package/packages/cli/src/database-migrations.ts +91 -21
- package/packages/cli/src/index.ts +60 -2
- package/packages/client/src/database-mysql.ts +291 -0
- package/packages/client/src/database-postgresql.ts +355 -0
- package/packages/client/src/database-sqlite.ts +445 -0
- package/packages/client/src/database.mjs +709 -57
- package/packages/client/src/database.ts +347 -182
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"framework": "bcp",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
5
5
|
"releaseState": "unreleased",
|
|
6
|
-
"baseline": "
|
|
6
|
+
"baseline": "application-packaging",
|
|
7
7
|
"runtime": {
|
|
8
8
|
"node": ">=24.11.0",
|
|
9
9
|
"react": "19",
|
|
10
|
-
"buildTarget": "standalone-node"
|
|
10
|
+
"buildTarget": "standalone-node",
|
|
11
|
+
"packageTarget": "standalone-node"
|
|
11
12
|
},
|
|
12
13
|
"publicEntrypoints": [
|
|
13
14
|
"bcp",
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
"cliCommands": [
|
|
26
27
|
"dev",
|
|
27
28
|
"build",
|
|
29
|
+
"package",
|
|
28
30
|
"start",
|
|
29
31
|
"routes",
|
|
30
32
|
"update",
|
|
@@ -46,6 +48,11 @@
|
|
|
46
48
|
"middlewareV2": true,
|
|
47
49
|
"jwtCookieSessions": true,
|
|
48
50
|
"databaseMigrations": true,
|
|
51
|
+
"databaseAdapterContract": true,
|
|
52
|
+
"databasePostgresql": true,
|
|
53
|
+
"databaseSqlite": true,
|
|
54
|
+
"databaseLifecycleV2": true,
|
|
55
|
+
"databaseMigrationProviderConsistency": true,
|
|
49
56
|
"validation": true,
|
|
50
57
|
"structuredErrors": true,
|
|
51
58
|
"logging": true,
|
|
@@ -53,6 +60,12 @@
|
|
|
53
60
|
"streamingUploads": true,
|
|
54
61
|
"storageEcosystem": true,
|
|
55
62
|
"productionHardening": true,
|
|
63
|
+
"applicationPackaging": true,
|
|
64
|
+
"productionDependencyPruning": true,
|
|
65
|
+
"deploymentManifest": true,
|
|
66
|
+
"environmentPackagingManifest": true,
|
|
67
|
+
"packageIntegrityManifest": true,
|
|
68
|
+
"dockerPackageStarter": true,
|
|
56
69
|
"projectGenerators": true,
|
|
57
70
|
"projectDiagnostics": true,
|
|
58
71
|
"documentationPlatform": true,
|
|
@@ -61,6 +74,11 @@
|
|
|
61
74
|
"configurationDiagnostics": true,
|
|
62
75
|
"configCheckCli": true
|
|
63
76
|
},
|
|
77
|
+
"databaseProviders": [
|
|
78
|
+
"mysql",
|
|
79
|
+
"postgresql",
|
|
80
|
+
"sqlite"
|
|
81
|
+
],
|
|
64
82
|
"storageProviders": [
|
|
65
83
|
"local",
|
|
66
84
|
"amazon-s3",
|
|
@@ -68,7 +86,7 @@
|
|
|
68
86
|
"s3-compatible"
|
|
69
87
|
],
|
|
70
88
|
"compatibility": {
|
|
71
|
-
"previousBaseline": "0.2.
|
|
89
|
+
"previousBaseline": "0.2.3",
|
|
72
90
|
"intentionalBreakingChangesFromPreviousBaseline": false,
|
|
73
91
|
"migrationGuide": "migration-0.2.md"
|
|
74
92
|
},
|
|
@@ -80,7 +98,8 @@
|
|
|
80
98
|
"documentationPlatform": "documentation-platform.md",
|
|
81
99
|
"apiReference": "api-reference.md",
|
|
82
100
|
"environmentValidation": "environment-validation.md",
|
|
101
|
+
"applicationPackaging": "application-packaging.md",
|
|
83
102
|
"migrationGuide": "migration-0.2.md",
|
|
84
|
-
"releaseNotes": "releases/0.2.
|
|
103
|
+
"releaseNotes": "releases/0.2.4.md"
|
|
85
104
|
}
|
|
86
105
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# BCP Framework 0.2.3
|
|
2
|
+
|
|
3
|
+
## Database Platform v2
|
|
4
|
+
|
|
5
|
+
BCP `0.2.3` turns the framework database layer into a provider-neutral SQL platform while preserving the existing `bcp/database` application API.
|
|
6
|
+
|
|
7
|
+
### Database adapter contract
|
|
8
|
+
|
|
9
|
+
- `BcpDatabase` delegates connection, query, execute, transaction and disconnect behavior through `DatabaseAdapter`.
|
|
10
|
+
- Custom adapters can be injected directly or through lazy factories.
|
|
11
|
+
- Provider implementations are separated into MySQL, PostgreSQL and SQLite runtime modules.
|
|
12
|
+
- Provider drivers remain optional dependencies and are loaded lazily.
|
|
13
|
+
|
|
14
|
+
### PostgreSQL
|
|
15
|
+
|
|
16
|
+
- Added built-in PostgreSQL support through `pg`.
|
|
17
|
+
- `DATABASE_URL=postgresql://...` selects PostgreSQL automatically.
|
|
18
|
+
- `DB_DRIVER=postgresql`, `postgres` and `pg` are supported provider names.
|
|
19
|
+
- Query parameters use PostgreSQL `$1`, `$2`, ... placeholders.
|
|
20
|
+
- Transactions use dedicated pool clients with `BEGIN`, `COMMIT`, `ROLLBACK` and guaranteed client release.
|
|
21
|
+
|
|
22
|
+
### SQLite
|
|
23
|
+
|
|
24
|
+
- Added built-in SQLite support through `better-sqlite3`.
|
|
25
|
+
- Supports file paths, `:memory:`, `sqlite:` and `file:` database locations.
|
|
26
|
+
- Common `.sqlite`, `.sqlite3` and `.db` `DATABASE_URL` values infer SQLite automatically.
|
|
27
|
+
- File-backed databases create missing parent directories before opening the native database.
|
|
28
|
+
- Adapter operations are serialized so async transaction callbacks do not interleave unrelated operations on one SQLite connection.
|
|
29
|
+
|
|
30
|
+
### Connection lifecycle
|
|
31
|
+
|
|
32
|
+
- Added explicit `database.connect()`.
|
|
33
|
+
- Added explicit `database.disconnect()`.
|
|
34
|
+
- Existing `database.close()` remains backward compatible and aliases the disconnect lifecycle.
|
|
35
|
+
- Disconnecting resets the facade so a later operation can initialize a fresh provider connection.
|
|
36
|
+
- Failed adapter initialization resets cleanly and can be retried.
|
|
37
|
+
- `close()` is safe after failed adapter initialization.
|
|
38
|
+
|
|
39
|
+
### Migration consistency
|
|
40
|
+
|
|
41
|
+
The existing CLI remains unchanged:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
bcp db create create_users
|
|
45
|
+
bcp db migrate
|
|
46
|
+
bcp db status
|
|
47
|
+
bcp db rollback
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Migration bookkeeping now selects its internal SQL dialect from the active database provider:
|
|
51
|
+
|
|
52
|
+
- MySQL uses `AUTO_INCREMENT` and `?` placeholders.
|
|
53
|
+
- PostgreSQL uses `BIGSERIAL` and `$1`, `$2` placeholders.
|
|
54
|
+
- SQLite uses `INTEGER PRIMARY KEY AUTOINCREMENT` and `?` placeholders.
|
|
55
|
+
|
|
56
|
+
BCP only makes the internal `_bcp_migrations` bookkeeping provider-aware. Application migration SQL is intentionally not translated between SQL dialects.
|
|
57
|
+
|
|
58
|
+
### Packaging and validation
|
|
59
|
+
|
|
60
|
+
- Added Database Platform v2 package smoke coverage.
|
|
61
|
+
- Packed framework validation checks provider modules, bundled optional-driver references, lifecycle APIs and migration dialect support.
|
|
62
|
+
- Added unit coverage for SQLite option resolution, provider inference, lifecycle reconnect behavior, failed adapter initialization and migration dialects.
|
|
63
|
+
|
|
64
|
+
## Compatibility
|
|
65
|
+
|
|
66
|
+
`0.2.3` does not intentionally remove public application entrypoints from the `0.2.2` baseline.
|
|
67
|
+
|
|
68
|
+
Existing MySQL applications can continue using:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import {
|
|
72
|
+
db,
|
|
73
|
+
createDatabase,
|
|
74
|
+
} from "bcp/database";
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
without changing their application-facing database calls.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# BCP Framework 0.2.4 — Application Packaging
|
|
2
|
+
|
|
3
|
+
> **Release state:** unreleased development target until validation, RC checks, tagging and npm publication complete.
|
|
4
|
+
|
|
5
|
+
BCP Framework `0.2.4` adds a deployment-oriented application packaging layer on top of the existing standalone Node.js production build.
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- new `bcp package` CLI command
|
|
10
|
+
- every package starts from a fresh production build
|
|
11
|
+
- deployment output under `.bcp-framework/package/`
|
|
12
|
+
- production-only `package.json`
|
|
13
|
+
- npm v3 production lockfile pruning when it can be performed safely
|
|
14
|
+
- `npm ci --omit=dev` deployment contract when a production lock is available
|
|
15
|
+
- safe `npm install --omit=dev` fallback when a lock cannot be derived
|
|
16
|
+
- `bcp.package.json` artifact/integrity manifest
|
|
17
|
+
- `bcp.deployment.json` runtime/deployment contract
|
|
18
|
+
- `bcp.env.json` environment metadata without secret values
|
|
19
|
+
- generated Dockerfile and `.dockerignore`
|
|
20
|
+
- SHA-256 inventory for packaged files
|
|
21
|
+
- unit and prepared-package smoke coverage
|
|
22
|
+
|
|
23
|
+
## Command
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bcp package
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The command performs:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
production environment/config validation
|
|
33
|
+
↓
|
|
34
|
+
fresh bcp build
|
|
35
|
+
↓
|
|
36
|
+
standalone-node packaging
|
|
37
|
+
↓
|
|
38
|
+
production dependency metadata
|
|
39
|
+
↓
|
|
40
|
+
deployment + environment manifests
|
|
41
|
+
↓
|
|
42
|
+
file integrity inventory
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Output
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
.bcp-framework/package/
|
|
49
|
+
├── client/
|
|
50
|
+
├── server/
|
|
51
|
+
│ └── server.mjs
|
|
52
|
+
├── public/ # when present
|
|
53
|
+
├── manifest.json
|
|
54
|
+
├── package.json
|
|
55
|
+
├── package-lock.json # when safely derivable
|
|
56
|
+
├── bcp.package.json
|
|
57
|
+
├── bcp.deployment.json
|
|
58
|
+
├── bcp.env.json
|
|
59
|
+
├── Dockerfile
|
|
60
|
+
├── .dockerignore
|
|
61
|
+
└── README.md
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The current package target remains:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
standalone-node
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Production dependency pruning
|
|
71
|
+
|
|
72
|
+
Application source `devDependencies` are not copied to the package manifest.
|
|
73
|
+
|
|
74
|
+
When an npm lockfile v3 can be reduced safely to the production dependency graph, BCP writes the reduced lockfile and deployment uses:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm ci --omit=dev
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If the lockfile contains unsupported metadata such as unsafe workspace links, BCP leaves it out and explicitly records the fallback:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm install --omit=dev
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Secret safety
|
|
87
|
+
|
|
88
|
+
Application packaging never copies `.env` files into the deployment artifact.
|
|
89
|
+
|
|
90
|
+
`bcp.env.json` records declared environment variable names discovered from example files only. It explicitly records that environment values and environment files are not embedded.
|
|
91
|
+
|
|
92
|
+
Provide credentials, database URLs, session secrets and storage keys through the deployment environment or a secret manager.
|
|
93
|
+
|
|
94
|
+
## Container starter
|
|
95
|
+
|
|
96
|
+
The package includes a Node 24 Alpine Dockerfile. A basic flow is:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd .bcp-framework/package
|
|
100
|
+
docker build -t my-bcp-app .
|
|
101
|
+
docker run --rm -p 3000:3000 my-bcp-app
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Compatibility
|
|
105
|
+
|
|
106
|
+
`0.2.4` does not intentionally remove or rename the `0.2.3` public package entrypoints.
|
|
107
|
+
|
|
108
|
+
Existing applications may continue using:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
bcp build
|
|
112
|
+
bcp start
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`bcp package` is additive and is intended for deployment artifact creation.
|
|
116
|
+
|
|
117
|
+
## Reproducibility scope
|
|
118
|
+
|
|
119
|
+
The packaging layer normalizes production dependency metadata and writes sorted file inventories with SHA-256 digests.
|
|
120
|
+
|
|
121
|
+
The existing production build still contains build-time identity/timestamp metadata, so `0.2.4` does not claim byte-for-byte reproducible artifacts across separate build invocations.
|
|
122
|
+
|
|
123
|
+
## Validation
|
|
124
|
+
|
|
125
|
+
Before publication run:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npm run typecheck
|
|
129
|
+
npm run test:unit
|
|
130
|
+
npm run test:integration
|
|
131
|
+
npm run test:e2e
|
|
132
|
+
npm run test:package
|
|
133
|
+
npm run rc:check
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
For an application-level packaging smoke test:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
bcp package
|
|
140
|
+
cd .bcp-framework/package
|
|
141
|
+
npm ci --omit=dev
|
|
142
|
+
npm start
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
If `bcp.package.json` reports that no lockfile was included, use the install command recorded in that manifest.
|
|
146
|
+
|
|
147
|
+
## Related documentation
|
|
148
|
+
|
|
149
|
+
- [Application Packaging](../application-packaging.md)
|
|
150
|
+
- [Deployment](../deployment.md)
|
|
151
|
+
- [Production Hardening](../production-hardening.md)
|
|
152
|
+
- [Configuration](../configuration.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chidchanun/bcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "BCP Framework - a React full-stack framework with file-based routing, SSR, APIs, middleware, islands, caching and standalone production builds.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|