@chidchanun/bcp 0.2.17 → 0.2.19

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.
@@ -0,0 +1,136 @@
1
+ # BCP Framework 0.2.18 — Deployment Platform v2
2
+
3
+ Status: **unreleased**
4
+
5
+ `0.2.18` adds a framework-native deployment lifecycle and hardens prepared npm runtime entrypoints for standalone Node production use.
6
+
7
+ ## Highlights
8
+
9
+ ### New `bcp/deployment` entrypoint
10
+
11
+ ```ts
12
+ import {
13
+ createDeploymentRuntime,
14
+ } from "bcp/deployment";
15
+ ```
16
+
17
+ Deployment runtime provides:
18
+
19
+ - ordered resource startup;
20
+ - reverse-order graceful shutdown;
21
+ - startup rollback;
22
+ - readiness checks;
23
+ - deployment/process diagnostics;
24
+ - deployment/instance/release metadata;
25
+ - `SIGTERM` / `SIGINT` handling;
26
+ - integration with existing BCP shutdown hooks.
27
+
28
+ ### Readiness endpoints
29
+
30
+ ```ts
31
+ return createDeploymentReadinessResponse(
32
+ deployment
33
+ );
34
+ ```
35
+
36
+ Ready runtime returns `200`; non-ready/draining/failed runtime returns `503`.
37
+
38
+ ### Diagnostics
39
+
40
+ ```ts
41
+ return createDeploymentDiagnosticsResponse(
42
+ deployment
43
+ );
44
+ ```
45
+
46
+ Diagnostics include process/runtime identity, uptime and resource lifecycle state plus optional resource diagnostics.
47
+
48
+ ### Runtime identity
49
+
50
+ Supported runtime environment values:
51
+
52
+ ```text
53
+ BCP_DEPLOYMENT_ID
54
+ BCP_INSTANCE_ID
55
+ BCP_RELEASE
56
+ NODE_ENV
57
+ BCP_SHUTDOWN_TIMEOUT_MS
58
+ ```
59
+
60
+ ### Compiled production entrypoints
61
+
62
+ Prepared framework packages now use compiled ESM runtime files for additional server-side entrypoints:
63
+
64
+ ```text
65
+ bcp/config -> config.mjs
66
+ bcp/auth -> auth.mjs
67
+ bcp/deployment -> deployment.mjs
68
+ bcp/server -> server.mjs
69
+ bcp/middleware -> middleware.mjs
70
+ ```
71
+
72
+ Existing compiled server runtimes such as cache/database/jobs/workflow/events/realtime/testing/plugins/observability remain compiled as before.
73
+
74
+ This closes a packaging gap where several server entrypoints still resolved directly to TypeScript in the published package.
75
+
76
+ ## Public API additions
77
+
78
+ ```text
79
+ createDeploymentRuntime
80
+ createDeploymentReadinessResponse
81
+ createDeploymentDiagnosticsResponse
82
+
83
+ DeploymentRuntime
84
+ DeploymentRuntimeOptions
85
+ DeploymentRuntimeState
86
+ DeploymentResource
87
+ DeploymentResourceContext
88
+ DeploymentResourceStatus
89
+ DeploymentReadinessResult
90
+ DeploymentReadinessReport
91
+ DeploymentDiagnosticsReport
92
+ DeploymentMetadata
93
+ DeploymentSignalOptions
94
+ DeploymentShutdownOptions
95
+ ```
96
+
97
+ ## Lifecycle model
98
+
99
+ ```text
100
+ idle
101
+
102
+ starting
103
+
104
+ ready
105
+
106
+ draining
107
+
108
+ stopped
109
+ ```
110
+
111
+ Failures move the runtime to `failed`.
112
+
113
+ ## Compatibility
114
+
115
+ There are no intentional breaking changes from `0.2.17`.
116
+
117
+ Existing production hardening APIs, shutdown hooks, `bcp build`, `bcp package` and application package manifests remain supported.
118
+
119
+ `bcp/deployment` is additive.
120
+
121
+ ## Validation
122
+
123
+ Before tagging/publishing:
124
+
125
+ ```bash
126
+ npm run typecheck
127
+ npm run test:unit
128
+ npm run test:integration
129
+ npm run test:e2e
130
+ npm run test:package
131
+ npm run rc:check
132
+ ```
133
+
134
+ The `0.2.18` package smoke validates the compiled deployment runtime plus compiled config/auth/server/middleware entrypoints from the prepared `.package/bcp` staging directory.
135
+
136
+ Do not tag/publish until the final commit passes the complete RC sequence.
@@ -0,0 +1,125 @@
1
+ # BCP Framework 0.2.19
2
+
3
+ Status: **unreleased**
4
+
5
+ Milestone: **Stability & API Freeze**
6
+
7
+ `0.2.19` is the final `0.2.x` stabilization milestone before the next `0.3.0` application-platform baseline.
8
+
9
+ ## Highlights
10
+
11
+ - freezes the documented `bcp/*` public entrypoint set;
12
+ - freezes the supported CLI command set;
13
+ - freezes prepared npm export resolution including browser boundaries;
14
+ - adds deterministic API snapshot generation;
15
+ - adds an API compatibility gate to RC validation;
16
+ - adds a release-readiness report;
17
+ - adds prepared-package Stability & API Freeze smoke coverage;
18
+ - adds deployment lifecycle idempotency regression coverage;
19
+ - keeps compatibility with `0.2.18` with no intentional breaking changes.
20
+
21
+ ## API freeze snapshot
22
+
23
+ New source of truth:
24
+
25
+ ```text
26
+ docs/api-freeze-snapshot.json
27
+ ```
28
+
29
+ Generate intentionally with:
30
+
31
+ ```bash
32
+ npm run api:snapshot
33
+ ```
34
+
35
+ Validate without changing the snapshot:
36
+
37
+ ```bash
38
+ npm run api:check
39
+ ```
40
+
41
+ The compatibility check prepares the publish package and compares the current package/CLI/API ownership contract against the committed snapshot.
42
+
43
+ ## Release readiness
44
+
45
+ New commands:
46
+
47
+ ```bash
48
+ npm run release:readiness
49
+ npm run release:readiness:report
50
+ ```
51
+
52
+ The persisted report is written locally to:
53
+
54
+ ```text
55
+ .bcp-framework/release-readiness.json
56
+ ```
57
+
58
+ Readiness includes package/lock/manifests version parity, freeze/baseline metadata, release-note/docs presence and public API parity.
59
+
60
+ ## RC pipeline
61
+
62
+ `release:check` now includes:
63
+
64
+ ```text
65
+ typecheck
66
+ full test suite
67
+ API compatibility check
68
+ release readiness check
69
+ release metadata check
70
+ ```
71
+
72
+ `test:package` / `package:check` also include `stability-api-freeze-package-smoke.mjs`.
73
+
74
+ ## Compatibility
75
+
76
+ ```text
77
+ previous baseline: 0.2.18
78
+ intentional breaking changes: false
79
+ freeze state: frozen
80
+ ```
81
+
82
+ The existing public package surface remains unchanged from `0.2.18`:
83
+
84
+ ```text
85
+ bcp
86
+ bcp/island
87
+ bcp/cache
88
+ bcp/config
89
+ bcp/validation
90
+ bcp/error
91
+ bcp/database
92
+ bcp/auth
93
+ bcp/jobs
94
+ bcp/workflow
95
+ bcp/events
96
+ bcp/realtime
97
+ bcp/testing
98
+ bcp/plugins
99
+ bcp/observability
100
+ bcp/deployment
101
+ bcp/server
102
+ bcp/server-only
103
+ bcp/middleware
104
+ ```
105
+
106
+ ## Validation before release
107
+
108
+ Run on the exact release commit:
109
+
110
+ ```bash
111
+ npm run typecheck
112
+ npm run test:unit
113
+ npm run test:integration
114
+ npm run test:e2e
115
+ npm run test:package
116
+ npm run api:check
117
+ npm run release:readiness
118
+ npm run rc:check
119
+ ```
120
+
121
+ Do not tag or publish until the complete RC sequence passes.
122
+
123
+ ## Next baseline
124
+
125
+ `0.3.0` is the next planned BCP Application Platform baseline. Intentional public API changes should be made there with explicit migration and compatibility metadata rather than silently changing the frozen `0.2.19` contract.
package/docs/releasing.md CHANGED
@@ -1,27 +1,31 @@
1
1
  # Releasing BCP Framework
2
2
 
3
- The source repository is a private npm workspace package for development. Release artifacts are staged separately so monorepo-only paths cannot accidentally become the published package contract.
3
+ BCP Framework is developed in a private npm workspace layout and staged into separate publish artifacts so monorepo-only paths cannot accidentally become the public package contract.
4
4
 
5
- BCP Framework and `create-bcp-app` are prepared for public release under the MIT License. Normal build and test tooling never performs a real `npm publish` automatically. The dedicated release publish command requires explicit confirmation and a matching Git tag.
6
-
7
- The selected public npm identities are:
5
+ The public npm identities are:
8
6
 
9
7
  ```text
10
8
  @chidchanun/bcp
11
9
  create-bcp-app
12
10
  ```
13
11
 
14
- Application source continues importing from `bcp`. `create-bcp-app` stores the scoped framework package behind the dependency key `bcp` using an npm alias.
12
+ Application source continues importing through the dependency key `bcp`.
15
13
 
16
14
  ## 1. Synchronize versions
17
15
 
18
- Use the version helper instead of editing package metadata manually:
16
+ Use the version helper:
17
+
18
+ ```bash
19
+ npm run version:set -- <version>
20
+ ```
21
+
22
+ For the current development target:
19
23
 
20
24
  ```bash
21
- npm run version:set -- 0.1.10
25
+ npm run version:set -- 0.2.19
22
26
  ```
23
27
 
24
- It synchronizes the release version across:
28
+ It synchronizes:
25
29
 
26
30
  ```text
27
31
  package.json
@@ -30,113 +34,129 @@ create-bcp-app/package.json
30
34
  package-lock.json
31
35
  ```
32
36
 
33
- Review `CHANGELOG.md` after changing the version. The BCP CLI reads the framework version from package metadata instead of a duplicated hard-coded constant.
37
+ Review release notes/changelog after changing the version.
38
+
39
+ ## 2. Stability/API compatibility gate
34
40
 
35
- ## 2. Run the normal release gate
41
+ `0.2.19` freezes the current `0.2.x` public contract in:
42
+
43
+ ```text
44
+ docs/api-freeze-snapshot.json
45
+ ```
46
+
47
+ Validate it with:
36
48
 
37
49
  ```bash
38
- npm run release:check
50
+ npm run api:check
39
51
  ```
40
52
 
41
- This runs type checking, the complete unit/integration/E2E/package test suite, then verifies:
53
+ The checker prepares the exact publish staging package and compares its public exports/browser boundaries plus CLI/API ownership to the committed freeze snapshot.
54
+
55
+ Do not use this as a routine way to make the check pass:
42
56
 
43
- - synchronized semver metadata
44
- - required documentation
45
- - MIT license metadata and license files
46
- - staged public package exports and executable metadata
47
- - public npm access configuration
48
- - exact `v<version>` matching when the check runs from a Git tag
57
+ ```bash
58
+ npm run api:snapshot
59
+ ```
49
60
 
50
- The package smoke test performs clean installs from packed tarballs and verifies that npm actually creates the `bcp` and `create-bcp-app` executables in `node_modules/.bin`.
61
+ Snapshot regeneration is for an explicitly reviewed platform-baseline change. Intentional public API changes should normally move to `0.3.0` rather than silently changing the frozen `0.2.19` surface.
51
62
 
52
- ## 3. Verify npm package names and ownership
63
+ ## 3. Release-readiness metadata
53
64
 
54
- Authenticate to npm before publishing:
65
+ Run:
55
66
 
56
67
  ```bash
57
- npm login
58
- npm whoami
68
+ npm run release:readiness
59
69
  ```
60
70
 
61
- Then run:
71
+ For a local machine-readable report:
62
72
 
63
73
  ```bash
64
- npm run release:name-check
74
+ npm run release:readiness:report
65
75
  ```
66
76
 
67
- The default RC package names are locked by `scripts/release-env.mjs` to:
77
+ Output:
68
78
 
69
79
  ```text
70
- @chidchanun/bcp
71
- create-bcp-app
80
+ .bcp-framework/release-readiness.json
72
81
  ```
73
82
 
74
- The check queries both package names. If a package is not present in the registry, the name is treated as currently available. If it already exists, the current npm account must be listed as an owner or the check fails.
83
+ The readiness check covers package/lock/manifests version parity, previous-baseline metadata, release docs, public entrypoint parity, CLI parity and stability capability flags.
75
84
 
76
- The defaults may still be overridden deliberately for a future rename:
85
+ ## 4. Run the normal release gate
77
86
 
78
87
  ```bash
79
- BCP_PACKAGE_NAME=@another-scope/bcp npm run release:name-check
88
+ npm run release:check
80
89
  ```
81
90
 
82
- PowerShell:
91
+ For `0.2.19`, this runs:
92
+
93
+ ```text
94
+ typecheck
95
+ full unit/integration/E2E/package test suite
96
+ API compatibility gate
97
+ release-readiness gate
98
+ release metadata validation
99
+ ```
83
100
 
84
- ```powershell
85
- $env:BCP_PACKAGE_NAME="@another-scope/bcp"
101
+ The package smoke suite performs real `npm pack` operations, clean installs and executable checks. Stability package smoke also verifies the prepared package against the freeze snapshot.
102
+
103
+ ## 5. Verify npm package names and ownership
104
+
105
+ Authenticate first:
106
+
107
+ ```bash
108
+ npm login
109
+ npm whoami
110
+ ```
111
+
112
+ Then:
113
+
114
+ ```bash
86
115
  npm run release:name-check
87
116
  ```
88
117
 
89
- The Release Check workflow also accepts the optional repository variables:
118
+ Defaults are locked by `scripts/release-env.mjs` to:
90
119
 
91
120
  ```text
92
- BCP_PACKAGE_NAME
93
- BCP_CREATE_PACKAGE_NAME
121
+ @chidchanun/bcp
122
+ create-bcp-app
94
123
  ```
95
124
 
96
- When those variables are unset or empty, the locked defaults above are used. Package-name availability can change at any time, so treat this check as a point-in-time release gate rather than a permanent reservation.
125
+ A deliberate future rename may override `BCP_PACKAGE_NAME` / `BCP_CREATE_PACKAGE_NAME`.
97
126
 
98
- ## 4. Verify the release version against npm
99
-
100
- Run:
127
+ ## 6. Verify version availability
101
128
 
102
129
  ```bash
103
130
  npm run release:version-check
104
131
  ```
105
132
 
106
- This separately checks the exact local release version against both selected npm package names.
107
-
108
- The gate fails when:
133
+ The gate fails if the exact version already exists or if the local stable version cannot advance the selected registry release.
109
134
 
110
- - `<package>@<local-version>` already exists and therefore cannot be republished
111
- - the local version is older than or equal to the registry's current latest version
135
+ Published npm versions are immutable; use a new patch version for a post-publication fix.
112
136
 
113
- A published npm version is immutable. If a packaging defect is discovered after publication, increment the patch version instead of trying to replace the existing version.
114
-
115
- ## 5. Run npm publish dry-run and clean-install smoke
137
+ ## 7. Publish dry-run and clean-install smoke
116
138
 
117
139
  ```bash
118
140
  npm run release:dry-run
119
141
  ```
120
142
 
121
- This performs `npm publish --dry-run` for both staged packages, packs fresh tarballs, installs the framework tarball into a temporary clean project, verifies the installed `bcp` executable, installs the `create-bcp-app` tarball separately, and verifies its generated executable.
122
-
123
- No package is uploaded to the npm registry.
143
+ This performs npm publish dry-runs, packs fresh tarballs and validates clean installs without uploading a package.
124
144
 
125
- Artifacts are written to:
145
+ Artifacts are written under:
126
146
 
127
147
  ```text
128
148
  .package/artifacts/
129
149
  ```
130
150
 
131
- ## 6. Run the complete Release Candidate gate
151
+ ## 8. Complete Release Candidate gate
132
152
 
133
- For the final local RC check:
153
+ Immediately before tagging:
134
154
 
135
155
  ```bash
136
156
  npm run rc:check
137
157
  ```
138
158
 
139
- This is equivalent to:
159
+ Equivalent high-level sequence:
140
160
 
141
161
  ```bash
142
162
  npm run release:check
@@ -145,15 +165,16 @@ npm run release:version-check
145
165
  npm run release:dry-run
146
166
  ```
147
167
 
148
- Run this immediately before creating the release tag.
168
+ The exact commit that passes this sequence must be the release-tag commit.
149
169
 
150
- ## 7. Inspect package contents
170
+ ## 9. Inspect prepared package contents
151
171
 
152
172
  Review:
153
173
 
154
174
  ```text
155
175
  .package/bcp/package.json
156
176
  .package/bcp/LICENSE
177
+ .package/bcp/docs/api-freeze-snapshot.json
157
178
  .package/create-bcp-app/package.json
158
179
  .package/artifacts/*.tgz
159
180
  ```
@@ -165,156 +186,60 @@ npm pack --dry-run .package/bcp
165
186
  npm pack --dry-run .package/create-bcp-app
166
187
  ```
167
188
 
168
- The framework package is published as:
189
+ ## 10. Create the release tag
169
190
 
170
- ```text
171
- @chidchanun/bcp
172
- ```
173
-
174
- but exposes application import paths through the npm alias key:
175
-
176
- ```text
177
- bcp
178
- bcp/island
179
- bcp/cache
180
- bcp/config
181
- bcp/middleware
182
- ```
183
-
184
- and the executable:
185
-
186
- ```text
187
- bcp
188
- ```
189
-
190
- A newly generated application's `package.json` pins the selected framework release exactly so a later plain package-manager install cannot silently move BCP to a different release:
191
-
192
- ```json
193
- {
194
- "scripts": {
195
- "update": "bcp update"
196
- },
197
- "dependencies": {
198
- "bcp": "npm:@chidchanun/bcp@0.1.10"
199
- }
200
- }
201
- ```
202
-
203
- The explicit updater is responsible for resolving and installing later framework releases.
204
-
205
- ## 8. Create the release tag
206
-
207
- Only after `npm run rc:check` passes and `CHANGELOG.md` is ready:
191
+ For `0.2.19`:
208
192
 
209
193
  ```bash
210
194
  git status
211
- git tag -a v0.1.10 -m "BCP Framework v0.1.10"
212
- git push origin v0.1.10
195
+ git tag -a v0.2.19 -m "BCP Framework v0.2.19"
196
+ git push origin v0.2.19
213
197
  ```
214
198
 
215
- Use the actual version from `package.json` in the tag.
216
-
217
- The GitHub Release Check workflow validates a `v*` tag, rechecks the npm target version, and uploads the npm tarballs as workflow artifacts. It does not publish them.
199
+ Always use the exact version in `package.json`.
218
200
 
219
- ## 9. Guarded publish
201
+ ## 11. Guarded publish
220
202
 
221
- After the tag workflow artifacts have been reviewed, publish from an authenticated local npm session with:
203
+ After reviewing the tag/RC result:
222
204
 
223
205
  ```bash
224
206
  npm run release:publish:yes
225
207
  ```
226
208
 
227
- This explicit script is preferred over forwarding `--yes` through `npm run`, because npm CLI argument forwarding can vary by npm/platform version.
228
-
229
- The command refuses to publish unless all of these conditions are true:
209
+ The publish command requires a clean working tree, the exact `v<version>` tag at HEAD, npm authentication, successful release gates and an unpublished target version.
230
210
 
231
- - explicit publish confirmation is present
232
- - the git working tree is clean
233
- - HEAD has the exact tag `v<package-version>`
234
- - npm authentication succeeds
235
- - the RC checks succeed again
236
- - staged package names and versions match the selected release
237
- - the target version has not already been accepted by npm
238
-
239
- Stable BCP releases use this npm dist-tag by default, including stable `0.x` releases:
211
+ Stable BCP releases publish to:
240
212
 
241
213
  ```text
242
214
  latest
243
215
  ```
244
216
 
245
- Use `BCP_DIST_TAG` only when intentionally publishing a separate channel such as `next` or `beta`:
246
-
247
- ```bash
248
- BCP_DIST_TAG=beta npm run release:publish:yes
249
- ```
250
-
251
- PowerShell example:
252
-
253
- ```powershell
254
- $env:BCP_DIST_TAG="beta"
255
- npm run release:publish:yes
256
- ```
257
-
258
- The framework publishes first. After `npm publish` succeeds, the release script accepts either normal version visibility or the selected dist-tag pointing at the new version. This prevents npm registry/security-processing delays from being misclassified as a failed publish.
259
-
260
- Using `latest` for stable releases is also part of the updater contract: `bcp update` resolves `@chidchanun/bcp@latest` by default.
261
-
262
- ## 10. Recover from a partial publish
217
+ Use `BCP_DIST_TAG` only for intentionally separate channels such as `next` or `beta`.
263
218
 
264
- If the framework package was accepted by npm but publishing `create-bcp-app` failed, fix the external issue without changing that release commit or tag, then use:
219
+ If a partial publish occurs after one package succeeds, resume with:
265
220
 
266
221
  ```bash
267
222
  npm run release:resume
268
223
  ```
269
224
 
270
- Resume mode intentionally does not run `release:version-check` or `npm publish --dry-run` for the already-published version. It still runs the complete local release checks and package smoke tests, verifies package ownership, skips package versions already accepted by npm, and attempts only the missing package.
271
-
272
- Do not use resume mode to overwrite or replace an existing npm version; npm versions are immutable.
273
-
274
- ## 11. Install or update the stable release
275
-
276
- The recommended new-project path is:
277
-
278
- ```bash
279
- npx create-bcp-app@latest my-app
280
- ```
281
-
282
- A generated application keeps the documented `bcp` import name through an npm alias and pins the selected framework version exactly.
283
-
284
- For an existing project already on an updater-capable release:
285
-
286
- ```bash
287
- npm run update
288
- ```
289
-
290
- For a project on BCP 0.1.9 or older, bootstrap the updater once with:
225
+ ## 0.2.19 release checklist
291
226
 
292
227
  ```bash
293
- npx @chidchanun/bcp@latest update
228
+ npm run version:set -- 0.2.19
229
+ npm run typecheck
230
+ npm run test:unit
231
+ npm run test:integration
232
+ npm run test:e2e
233
+ npm run test:package
234
+ npm run api:check
235
+ npm run release:readiness
236
+ npm run rc:check
294
237
  ```
295
238
 
296
- A manual install that preserves the `bcp` import name is:
239
+ Only after all checks pass:
297
240
 
298
241
  ```bash
299
- npm install bcp@npm:@chidchanun/bcp@latest react react-dom
300
- ```
301
-
302
- Application code then continues using:
303
-
304
- ```ts
305
- import {
306
- Link,
307
- } from "bcp";
242
+ git tag -a v0.2.19 -m "BCP Framework v0.2.19"
243
+ git push origin v0.2.19
244
+ npm run release:publish:yes
308
245
  ```
309
-
310
- The scoped package can also be installed directly as `@chidchanun/bcp@latest`, but applications using the framework's documented `bcp` import path should prefer the alias form above.
311
-
312
- ## 12. Trusted publishing
313
-
314
- For subsequent releases, prefer npm Trusted Publishing with GitHub Actions instead of a long-lived write token. npm supports GitHub Actions OIDC publishing and recommends trusted publishing for CI-based releases.
315
-
316
- After the npm package settings are available, configure the repository/workflow as a trusted publisher and move the real publish action into the guarded GitHub release workflow.
317
-
318
- ## License
319
-
320
- BCP Framework and `create-bcp-app` use the MIT License. See `LICENSE` and `create-bcp-app/LICENSE`.