@chidchanun/bcp 0.1.23 → 0.1.25
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 +658 -578
- package/docs/README.md +317 -318
- package/docs/auth-route-guards.md +14 -0
- package/docs/developer-tools.md +45 -22
- package/docs/file-upload.md +280 -0
- package/docs/releases/0.1.24.md +166 -0
- package/docs/releases/0.1.25.md +132 -0
- package/docs/storage.md +285 -0
- package/package.json +1 -1
- package/packages/bundler/src/server-production-actions.ts +15 -0
- package/packages/bundler/src/server-production-guards.ts +15 -0
- package/packages/client/src/server.ts +40 -0
- package/packages/server/src/dev-route-graph.ts +91 -0
- package/packages/server/src/file-delivery.ts +629 -0
- package/packages/server/src/middleware-dev-server.ts +217 -9
- package/packages/server/src/storage.ts +829 -0
- package/packages/server/src/upload.ts +556 -0
package/docs/README.md
CHANGED
|
@@ -1,321 +1,292 @@
|
|
|
1
1
|
# BCP Framework Documentation Source
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `docs/` directory is the documentation source of truth for BCP Framework and is intentionally organized so it can be consumed later by the **`bcp-docs-web`** documentation website.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **Documentation target:** BCP Framework `0.1.25`
|
|
6
|
+
>
|
|
7
|
+
> The documentation target can be newer than the version currently published to npm. Unreleased behavior must be labeled as a development target until release validation and publication are complete.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Documentation goals
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
The documentation source should make it possible to build `bcp-docs-web` without duplicating framework knowledge into a second repository.
|
|
10
12
|
|
|
11
|
-
The
|
|
13
|
+
The expected relationship is:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
BCP Framework source/tests
|
|
17
|
+
↓
|
|
18
|
+
docs/
|
|
19
|
+
↓
|
|
20
|
+
bcp-docs-web
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Framework source and tests remain authoritative for behavior. Markdown under `docs/` is the authored documentation layer. The future website should primarily render, organize and search this source instead of becoming a separate source of truth.
|
|
24
|
+
|
|
25
|
+
## Content update rule
|
|
12
26
|
|
|
13
27
|
When framework behavior changes:
|
|
14
28
|
|
|
15
|
-
1.
|
|
16
|
-
2.
|
|
17
|
-
3.
|
|
18
|
-
4.
|
|
29
|
+
1. Update framework source.
|
|
30
|
+
2. Add or update regression tests.
|
|
31
|
+
3. Update the matching documentation file under `docs/`.
|
|
32
|
+
4. Update the release note under `docs/releases/` when the change belongs to a release milestone.
|
|
33
|
+
5. Only present the feature as published after release validation and npm publication complete.
|
|
19
34
|
|
|
20
|
-
|
|
35
|
+
## Recommended `bcp-docs-web` navigation
|
|
21
36
|
|
|
22
|
-
|
|
37
|
+
The website should use these top-level groups:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
Getting Started
|
|
41
|
+
Routing & Data
|
|
42
|
+
Authentication
|
|
43
|
+
Database
|
|
44
|
+
Runtime & Infrastructure
|
|
45
|
+
API Reference
|
|
46
|
+
Releases
|
|
47
|
+
```
|
|
23
48
|
|
|
24
49
|
### Getting Started
|
|
25
50
|
|
|
26
|
-
| Website route |
|
|
51
|
+
| Website route | Markdown source | Purpose |
|
|
27
52
|
| --- | --- | --- |
|
|
28
53
|
| `/docs/getting-started` | `getting-started.md` | Create and run a BCP application |
|
|
29
|
-
| `/docs/configuration` | `configuration.md` | Framework configuration |
|
|
30
|
-
| `/docs/application-modules` | `application-modules.md` | Client/server module
|
|
31
|
-
| `/docs/deployment` | `deployment.md` |
|
|
32
|
-
| `/docs/updating` | `updating.md` |
|
|
54
|
+
| `/docs/configuration` | `configuration.md` | Framework configuration and environment behavior |
|
|
55
|
+
| `/docs/application-modules` | `application-modules.md` | Client/server boundaries and module rules |
|
|
56
|
+
| `/docs/deployment` | `deployment.md` | Standalone production deployment |
|
|
57
|
+
| `/docs/updating` | `updating.md` | Framework upgrade workflow |
|
|
33
58
|
|
|
34
|
-
### Routing
|
|
59
|
+
### Routing & Data
|
|
35
60
|
|
|
36
|
-
| Website route |
|
|
61
|
+
| Website route | Markdown source | Purpose |
|
|
37
62
|
| --- | --- | --- |
|
|
38
|
-
| `/docs/routing` | `routing.md` | File-based routing |
|
|
63
|
+
| `/docs/routing` | `routing.md` | File-based page/API routing |
|
|
39
64
|
| `/docs/server-data-loaders` | `server-data-loaders.md` | Server-side page data |
|
|
40
|
-
| `/docs/route-guards` | `route-guards.md` | Scoped
|
|
65
|
+
| `/docs/route-guards` | `route-guards.md` | Scoped route authorization |
|
|
41
66
|
| `/docs/form-actions` | `form-actions.md` | Server mutations and forms |
|
|
42
|
-
| `/docs/server-request-apis` | `server-request-apis.md` | Request
|
|
43
|
-
| `/docs/validation` | `validation.md` | Typed
|
|
44
|
-
| `/docs/error-handling` | `error-handling.md` | Structured HTTP errors
|
|
67
|
+
| `/docs/server-request-apis` | `server-request-apis.md` | Request/cookie/response APIs |
|
|
68
|
+
| `/docs/validation` | `validation.md` | Typed validation |
|
|
69
|
+
| `/docs/error-handling` | `error-handling.md` | Structured HTTP errors |
|
|
70
|
+
| `/docs/file-upload` | `file-upload.md` | Multipart parsing and upload validation |
|
|
71
|
+
| `/docs/storage` | `storage.md` | Storage adapters and production file delivery |
|
|
45
72
|
|
|
46
73
|
### Authentication
|
|
47
74
|
|
|
48
|
-
| Website route |
|
|
75
|
+
| Website route | Markdown source | Purpose |
|
|
49
76
|
| --- | --- | --- |
|
|
50
|
-
| `/docs/authentication` | `authentication.md` | Authentication Core
|
|
51
|
-
| `/docs/auth-route-guards` | `auth-route-guards.md` |
|
|
52
|
-
| `/docs/session-auth` | `session-auth.md` |
|
|
77
|
+
| `/docs/authentication` | `authentication.md` | Authentication Core |
|
|
78
|
+
| `/docs/auth-route-guards` | `auth-route-guards.md` | Auth-aware route guards |
|
|
79
|
+
| `/docs/session-auth` | `session-auth.md` | JWT cookie sessions |
|
|
53
80
|
|
|
54
81
|
### Database
|
|
55
82
|
|
|
56
|
-
| Website route |
|
|
83
|
+
| Website route | Markdown source | Purpose |
|
|
57
84
|
| --- | --- | --- |
|
|
58
|
-
| `/docs/database` | `database.md` |
|
|
85
|
+
| `/docs/database` | `database.md` | MySQL database primitives |
|
|
59
86
|
| `/docs/database-migrations` | `database-migrations.md` | Migration CLI and migration files |
|
|
60
87
|
|
|
61
|
-
### Runtime
|
|
88
|
+
### Runtime & Infrastructure
|
|
62
89
|
|
|
63
|
-
| Website route |
|
|
90
|
+
| Website route | Markdown source | Purpose |
|
|
64
91
|
| --- | --- | --- |
|
|
65
|
-
| `/docs/middleware` | `middleware.md` | Middleware System v2
|
|
66
|
-
| `/docs/hydration` | `hydration.md` | SSR/client
|
|
67
|
-
| `/docs/developer-tools` | `developer-tools.md` | `
|
|
68
|
-
| `/docs/development-logging` | `development-logging.md` | Structured logging
|
|
92
|
+
| `/docs/middleware` | `middleware.md` | Middleware System v2 |
|
|
93
|
+
| `/docs/hydration` | `hydration.md` | SSR/client hydration parity |
|
|
94
|
+
| `/docs/developer-tools` | `developer-tools.md` | `doctor` and `inspect` diagnostics |
|
|
95
|
+
| `/docs/development-logging` | `development-logging.md` | Structured logging and observability |
|
|
69
96
|
| `/docs/caching` | `caching.md` | Cache and revalidation |
|
|
70
|
-
| `/docs/security` | `security.md` |
|
|
97
|
+
| `/docs/security` | `security.md` | Security defaults and request body limits |
|
|
71
98
|
|
|
72
|
-
|
|
99
|
+
## API Reference grouping
|
|
73
100
|
|
|
74
|
-
|
|
101
|
+
`bcp-docs-web` can derive an API-reference navigation layer from the authored guides.
|
|
75
102
|
|
|
76
|
-
Recommended
|
|
103
|
+
Recommended entrypoint groups:
|
|
77
104
|
|
|
78
105
|
```text
|
|
79
|
-
|
|
80
|
-
/
|
|
81
|
-
/
|
|
106
|
+
bcp
|
|
107
|
+
bcp/server
|
|
108
|
+
bcp/auth
|
|
109
|
+
bcp/database
|
|
110
|
+
bcp/validation
|
|
111
|
+
bcp/error
|
|
112
|
+
bcp/cache
|
|
113
|
+
bcp/config
|
|
114
|
+
bcp/middleware
|
|
82
115
|
```
|
|
83
116
|
|
|
84
|
-
The
|
|
117
|
+
The first version of the website does not need generated TypeDoc-style reference pages. It can begin by linking APIs to the guide that owns them, then add generated symbol-level reference later if useful.
|
|
85
118
|
|
|
86
|
-
|
|
119
|
+
Suggested ownership:
|
|
87
120
|
|
|
88
|
-
|
|
121
|
+
| Entrypoint | Primary guide |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `bcp` | `routing.md`, `server-data-loaders.md`, `form-actions.md` |
|
|
124
|
+
| `bcp/server` | `server-request-apis.md`, `file-upload.md`, `storage.md`, `development-logging.md` |
|
|
125
|
+
| `bcp/auth` | `authentication.md`, `auth-route-guards.md` |
|
|
126
|
+
| `bcp/database` | `database.md`, `database-migrations.md` |
|
|
127
|
+
| `bcp/validation` | `validation.md` |
|
|
128
|
+
| `bcp/error` | `error-handling.md` |
|
|
129
|
+
| `bcp/cache` | `caching.md` |
|
|
130
|
+
| `bcp/config` | `configuration.md` |
|
|
131
|
+
| `bcp/middleware` | `middleware.md` |
|
|
89
132
|
|
|
90
|
-
|
|
133
|
+
## Current capability groups
|
|
91
134
|
|
|
92
135
|
### Application
|
|
93
136
|
|
|
94
|
-
-
|
|
95
|
-
-
|
|
137
|
+
- React SSR and hydration
|
|
138
|
+
- file-based page/API routing
|
|
139
|
+
- dynamic routes
|
|
140
|
+
- catch-all and optional catch-all routes
|
|
141
|
+
- route groups
|
|
142
|
+
- layouts and metadata
|
|
96
143
|
- SPA navigation
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
|
|
104
|
-
### Server
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
144
|
+
- server data loaders
|
|
145
|
+
- route guards
|
|
146
|
+
- form actions
|
|
147
|
+
- client islands / partial hydration
|
|
148
|
+
- Fast Refresh
|
|
149
|
+
- deterministic development hydration
|
|
150
|
+
|
|
151
|
+
### Server
|
|
152
|
+
|
|
153
|
+
- request-scoped server APIs
|
|
154
|
+
- request IDs
|
|
155
|
+
- cookies and redirects
|
|
156
|
+
- JWT sessions
|
|
157
|
+
- authentication helpers
|
|
158
|
+
- Middleware System v2
|
|
159
|
+
- typed validation
|
|
160
|
+
- structured errors
|
|
161
|
+
- structured logging
|
|
162
|
+
- multipart file uploads
|
|
163
|
+
- upload validation
|
|
164
|
+
- storage adapter contract
|
|
165
|
+
- local filesystem storage adapter
|
|
166
|
+
- production file delivery
|
|
167
|
+
- validators and byte ranges
|
|
117
168
|
|
|
118
169
|
### Database
|
|
119
170
|
|
|
120
171
|
- `bcp/database`
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
|
|
127
|
-
|
|
172
|
+
- lazy MySQL pool
|
|
173
|
+
- prepared execution
|
|
174
|
+
- query helpers
|
|
175
|
+
- transactions
|
|
176
|
+
- migrations
|
|
177
|
+
- migration status
|
|
178
|
+
- rollback
|
|
128
179
|
|
|
129
|
-
|
|
130
|
-
- JWT cookie sessions
|
|
131
|
-
- Typed users and session data
|
|
132
|
-
- Session rotation
|
|
133
|
-
- `requireAuth()`
|
|
134
|
-
- `requireRole()`
|
|
135
|
-
- Auth-aware route guards
|
|
136
|
-
|
|
137
|
-
### Middleware
|
|
138
|
-
|
|
139
|
-
- Middleware System v2
|
|
140
|
-
- Middleware chains
|
|
141
|
-
- Real `await next()` downstream execution
|
|
142
|
-
- Before/after response interception
|
|
143
|
-
- Shared request context state
|
|
144
|
-
- Matchers
|
|
145
|
-
- Rewrite and redirect
|
|
146
|
-
- Backward-compatible Middleware v1 handlers
|
|
147
|
-
|
|
148
|
-
### Production and DX
|
|
180
|
+
### Developer Experience
|
|
149
181
|
|
|
150
182
|
- `create-bcp-app`
|
|
151
|
-
- Interactive project setup
|
|
152
|
-
- Tailwind preset
|
|
153
|
-
- Database/auth presets
|
|
154
183
|
- `bcp update`
|
|
155
|
-
- `bcp doctor`
|
|
156
|
-
- `bcp inspect`
|
|
157
|
-
-
|
|
158
|
-
- Duplicate React and duplicate BCP installation diagnostics
|
|
184
|
+
- `bcp doctor`
|
|
185
|
+
- `bcp inspect`
|
|
186
|
+
- route inspection
|
|
159
187
|
- `bcp-framework` Windows-safe CLI alias
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
- Configurable log levels
|
|
164
|
-
- Structured development HTTP/SSR timing events
|
|
165
|
-
- Standalone production builds
|
|
166
|
-
- Critical CSS
|
|
167
|
-
- Cache/revalidation
|
|
168
|
-
- Security defaults
|
|
169
|
-
- Unit/integration/E2E/package smoke testing in the framework repository
|
|
170
|
-
|
|
171
|
-
## Suggested homepage hero
|
|
188
|
+
- standalone production build
|
|
189
|
+
- unit/integration/E2E/package tests
|
|
190
|
+
- release/package smoke checks
|
|
172
191
|
|
|
173
|
-
|
|
192
|
+
## BCP 0.1.25 documentation focus
|
|
174
193
|
|
|
175
|
-
|
|
176
|
-
BCP Framework
|
|
177
|
-
A React full-stack framework for building server-rendered applications with routing,
|
|
178
|
-
data loading, server mutations, authentication, databases, validation, structured errors,
|
|
179
|
-
middleware, observability and production tooling.
|
|
180
|
-
```
|
|
194
|
+
### Storage adapters
|
|
181
195
|
|
|
182
|
-
|
|
196
|
+
BCP `0.1.25` introduces the first application-facing storage abstraction through `bcp/server`:
|
|
183
197
|
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
198
|
+
```ts
|
|
199
|
+
import {
|
|
200
|
+
createLocalStorage,
|
|
201
|
+
createStorageResponse,
|
|
202
|
+
normalizeStorageKey,
|
|
203
|
+
StorageError,
|
|
204
|
+
storeUploadedFile,
|
|
205
|
+
} from "bcp/server";
|
|
188
206
|
```
|
|
189
207
|
|
|
190
|
-
The
|
|
208
|
+
The documentation must make these boundaries clear:
|
|
191
209
|
|
|
192
|
-
|
|
210
|
+
- `StorageAdapter` is the application-facing contract.
|
|
211
|
+
- `createLocalStorage()` is the built-in adapter in this milestone.
|
|
212
|
+
- storage keys are logical relative paths, not operating-system paths.
|
|
213
|
+
- absolute paths and traversal segments are rejected.
|
|
214
|
+
- overwrite is opt-in.
|
|
215
|
+
- local metadata persists content type and SHA-256 identity.
|
|
216
|
+
- `createStorageResponse()` supports `GET` and `HEAD`.
|
|
217
|
+
- validators include ETag and Last-Modified behavior.
|
|
218
|
+
- single byte ranges are supported.
|
|
219
|
+
- multiple ranges are intentionally unsupported in `0.1.25` and return `416`.
|
|
220
|
+
- the default cache policy is private/revalidate.
|
|
221
|
+
- public caching must be explicit.
|
|
222
|
+
- storage keys do not replace authentication or authorization.
|
|
193
223
|
|
|
194
|
-
|
|
195
|
-
Getting Started
|
|
196
|
-
Introduction
|
|
197
|
-
Installation
|
|
198
|
-
Project Structure
|
|
199
|
-
Configuration
|
|
200
|
-
Updating
|
|
201
|
-
|
|
202
|
-
Core
|
|
203
|
-
Routing
|
|
204
|
-
Application Modules
|
|
205
|
-
Server Request APIs
|
|
206
|
-
Server Data Loaders
|
|
207
|
-
Route Guards
|
|
208
|
-
Form Actions
|
|
209
|
-
Validation
|
|
210
|
-
Error Handling
|
|
211
|
-
|
|
212
|
-
Authentication
|
|
213
|
-
Authentication Core
|
|
214
|
-
Auth Route Guards
|
|
215
|
-
JWT Sessions
|
|
216
|
-
|
|
217
|
-
Database
|
|
218
|
-
Database
|
|
219
|
-
Migrations
|
|
220
|
-
|
|
221
|
-
Runtime
|
|
222
|
-
Middleware
|
|
223
|
-
Hydration
|
|
224
|
-
Developer Tools
|
|
225
|
-
Logging & Observability
|
|
226
|
-
Caching
|
|
227
|
-
Security
|
|
228
|
-
|
|
229
|
-
Production
|
|
230
|
-
Deployment
|
|
231
|
-
|
|
232
|
-
Releases
|
|
233
|
-
0.1.23
|
|
234
|
-
0.1.22
|
|
235
|
-
0.1.21
|
|
236
|
-
```
|
|
224
|
+
See `storage.md`.
|
|
237
225
|
|
|
238
|
-
|
|
226
|
+
### File Upload
|
|
239
227
|
|
|
240
|
-
|
|
228
|
+
BCP `0.1.24` introduced:
|
|
241
229
|
|
|
242
|
-
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
-
|
|
246
|
-
-
|
|
247
|
-
-
|
|
248
|
-
-
|
|
249
|
-
-
|
|
250
|
-
-
|
|
251
|
-
- light/dark appearance
|
|
252
|
-
- framework version label
|
|
253
|
-
- link to the corresponding source Markdown file in GitHub
|
|
230
|
+
- multipart parsing,
|
|
231
|
+
- request/file size limits,
|
|
232
|
+
- MIME allowlists,
|
|
233
|
+
- extension allowlists,
|
|
234
|
+
- required/optional file fields,
|
|
235
|
+
- safe local file names,
|
|
236
|
+
- traversal protection,
|
|
237
|
+
- overwrite protection,
|
|
238
|
+
- SHA-256 metadata.
|
|
254
239
|
|
|
255
|
-
|
|
240
|
+
Those APIs remain supported in `0.1.25`.
|
|
256
241
|
|
|
257
|
-
|
|
258
|
-
- version selector
|
|
259
|
-
- API symbol index
|
|
260
|
-
- interactive examples
|
|
261
|
-
- edit-on-GitHub links
|
|
242
|
+
`storeUploadedFile()` is the bridge between a validated multipart `File` and a `StorageAdapter`.
|
|
262
243
|
|
|
263
|
-
|
|
244
|
+
See:
|
|
264
245
|
|
|
265
|
-
|
|
246
|
+
- `file-upload.md`
|
|
247
|
+
- `storage.md`
|
|
266
248
|
|
|
267
|
-
|
|
249
|
+
### Production auth guard stabilization
|
|
268
250
|
|
|
269
|
-
|
|
270
|
-
import {
|
|
271
|
-
auth,
|
|
272
|
-
requireAuth,
|
|
273
|
-
} from "bcp/auth";
|
|
251
|
+
The `0.1.24` stabilization cycle unified standalone guard/action authentication imports with the active request-context runtime.
|
|
274
252
|
|
|
275
|
-
|
|
276
|
-
db,
|
|
277
|
-
} from "bcp/database";
|
|
253
|
+
This prevents production-only failures where APIs such as `cookies()`, `getSession()`, `requireAuth()` or `requireRole()` could see a different request-context instance after bundling.
|
|
278
254
|
|
|
279
|
-
|
|
280
|
-
v,
|
|
281
|
-
validateFormData,
|
|
282
|
-
} from "bcp/validation";
|
|
255
|
+
### Development route graph synchronization
|
|
283
256
|
|
|
284
|
-
|
|
285
|
-
badRequest,
|
|
286
|
-
unauthorized,
|
|
287
|
-
} from "bcp/error";
|
|
257
|
+
The `0.1.24` stabilization cycle also fixed a development graph drift where the route scanner could see a new route while the incremental client bundle graph still represented the previous topology.
|
|
288
258
|
|
|
289
|
-
|
|
290
|
-
logger,
|
|
291
|
-
requestLogger,
|
|
292
|
-
} from "bcp/server";
|
|
259
|
+
The development gateway now compares the actual page route graph and refreshes the internal client bundler when pathname/page/layout topology changes.
|
|
293
260
|
|
|
294
|
-
|
|
295
|
-
type MiddlewarePipelineHandler,
|
|
296
|
-
} from "bcp/middleware";
|
|
297
|
-
```
|
|
261
|
+
### Logging and observability
|
|
298
262
|
|
|
299
|
-
|
|
263
|
+
BCP `0.1.23` introduced:
|
|
300
264
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
265
|
+
- `logger`,
|
|
266
|
+
- `createLogger()`,
|
|
267
|
+
- request-scoped `requestLogger()`,
|
|
268
|
+
- log levels,
|
|
269
|
+
- pretty/JSON formats,
|
|
270
|
+
- request IDs,
|
|
271
|
+
- structured development request logging,
|
|
272
|
+
- SSR/import debug timing.
|
|
305
273
|
|
|
306
|
-
|
|
274
|
+
See `development-logging.md`.
|
|
307
275
|
|
|
308
|
-
|
|
276
|
+
### Developer tools
|
|
309
277
|
|
|
310
|
-
|
|
278
|
+
BCP `0.1.22` introduced:
|
|
311
279
|
|
|
312
|
-
-
|
|
313
|
-
-
|
|
314
|
-
-
|
|
280
|
+
- `bcp doctor`,
|
|
281
|
+
- `bcp inspect`,
|
|
282
|
+
- JSON diagnostic output,
|
|
283
|
+
- duplicate React detection,
|
|
284
|
+
- duplicate BCP installation protection,
|
|
285
|
+
- Windows-safe `bcp-framework` CLI alias.
|
|
315
286
|
|
|
316
|
-
|
|
287
|
+
See `developer-tools.md`.
|
|
317
288
|
|
|
318
|
-
##
|
|
289
|
+
## CLI commands
|
|
319
290
|
|
|
320
291
|
```bash
|
|
321
292
|
bcp dev
|
|
@@ -335,135 +306,163 @@ bcp db status
|
|
|
335
306
|
bcp db rollback
|
|
336
307
|
```
|
|
337
308
|
|
|
338
|
-
On Windows systems where Microsoft SQL Server owns
|
|
339
|
-
|
|
340
|
-
Project creation:
|
|
309
|
+
On Windows systems where Microsoft SQL Server owns `bcp.exe`, direct project-local commands should prefer:
|
|
341
310
|
|
|
342
|
-
```
|
|
343
|
-
|
|
311
|
+
```powershell
|
|
312
|
+
npm exec -- bcp-framework doctor
|
|
313
|
+
npm exec -- bcp-framework inspect
|
|
314
|
+
npm exec -- bcp-framework dev
|
|
315
|
+
npm exec -- bcp-framework build
|
|
344
316
|
```
|
|
345
317
|
|
|
346
|
-
|
|
318
|
+
Inside npm scripts, `bcp` remains safe because npm prepends `node_modules/.bin` to `PATH`.
|
|
347
319
|
|
|
348
|
-
|
|
320
|
+
## Release documentation
|
|
349
321
|
|
|
350
|
-
|
|
322
|
+
Release notes live under:
|
|
351
323
|
|
|
352
324
|
```text
|
|
353
|
-
|
|
354
|
-
v2 await next() = execute downstream middleware/application and receive Response
|
|
325
|
+
docs/releases/
|
|
355
326
|
```
|
|
356
327
|
|
|
357
|
-
|
|
328
|
+
Recommended website release routes:
|
|
358
329
|
|
|
359
|
-
|
|
330
|
+
```text
|
|
331
|
+
/releases/0.1.25
|
|
332
|
+
/releases/0.1.24
|
|
333
|
+
/releases/0.1.23
|
|
334
|
+
/releases/0.1.22
|
|
335
|
+
/releases/0.1.21
|
|
336
|
+
/releases/0.1.20
|
|
337
|
+
```
|
|
360
338
|
|
|
361
|
-
|
|
339
|
+
The website should display a clear release state for each version:
|
|
362
340
|
|
|
363
|
-
|
|
341
|
+
```text
|
|
342
|
+
published
|
|
343
|
+
release candidate
|
|
344
|
+
unreleased development target
|
|
345
|
+
```
|
|
364
346
|
|
|
365
|
-
|
|
347
|
+
Do not infer publication state only from the existence of a Markdown release note.
|
|
366
348
|
|
|
367
|
-
|
|
368
|
-
- FormData coercion with `validateFormData()`
|
|
369
|
-
- `success/data` versus `issues/fieldErrors/formErrors`
|
|
370
|
-
- object fields are stripped unless `allowUnknown: true`
|
|
371
|
-
- `refine()` for custom application rules
|
|
372
|
-
- no external validation dependency is required
|
|
349
|
+
## Suggested `bcp-docs-web` content model
|
|
373
350
|
|
|
374
|
-
|
|
351
|
+
A future website can represent each Markdown page with metadata similar to:
|
|
375
352
|
|
|
376
|
-
|
|
353
|
+
```ts
|
|
354
|
+
interface DocPage {
|
|
355
|
+
title: string;
|
|
356
|
+
slug: string;
|
|
357
|
+
section: string;
|
|
358
|
+
sourceFile: string;
|
|
359
|
+
versionTarget?: string;
|
|
360
|
+
releaseState?:
|
|
361
|
+
| "published"
|
|
362
|
+
| "rc"
|
|
363
|
+
| "unreleased";
|
|
364
|
+
}
|
|
365
|
+
```
|
|
377
366
|
|
|
378
|
-
|
|
367
|
+
The metadata does not need to live in frontmatter immediately. The first implementation can use a route manifest in the docs website and consume Markdown files directly.
|
|
379
368
|
|
|
380
|
-
|
|
369
|
+
## Suggested website features
|
|
381
370
|
|
|
382
|
-
|
|
383
|
-
notFound() = activate page 404 UI behavior
|
|
384
|
-
notFoundResponse() = return a JSON 404 HTTP response
|
|
385
|
-
```
|
|
371
|
+
The first useful version of `bcp-docs-web` should prioritize:
|
|
386
372
|
|
|
387
|
-
|
|
373
|
+
1. Sidebar navigation generated from the route/source map.
|
|
374
|
+
2. Markdown rendering with syntax highlighting.
|
|
375
|
+
3. Previous/next page navigation.
|
|
376
|
+
4. Version/development-target banner.
|
|
377
|
+
5. Release note pages.
|
|
378
|
+
6. Search across Markdown content.
|
|
379
|
+
7. Copy buttons for code blocks.
|
|
380
|
+
8. Mobile navigation.
|
|
381
|
+
9. Direct GitHub source/edit links.
|
|
388
382
|
|
|
389
|
-
|
|
390
|
-
- `errorResponse()` for any 4xx/5xx status
|
|
391
|
-
- `toErrorResponse()` for safe catch boundaries
|
|
392
|
-
- `badRequest()`, `unauthorized()`, `forbidden()`, `conflict()` and other convenience helpers
|
|
393
|
-
- standard `{ error: { status, code, message, details? } }` payload
|
|
394
|
-
- error responses default to `Cache-Control: no-store`
|
|
395
|
-
- unknown exceptions become a generic 500 response without exposing the original exception message
|
|
396
|
-
- normal field validation still belongs to `bcp/validation`
|
|
383
|
+
Later additions can include:
|
|
397
384
|
|
|
398
|
-
|
|
385
|
+
- generated API symbol reference,
|
|
386
|
+
- versioned documentation snapshots,
|
|
387
|
+
- interactive examples,
|
|
388
|
+
- framework playgrounds,
|
|
389
|
+
- release comparison pages.
|
|
399
390
|
|
|
400
|
-
##
|
|
391
|
+
## Source conventions
|
|
401
392
|
|
|
402
|
-
|
|
393
|
+
For documentation intended for the website:
|
|
403
394
|
|
|
404
|
-
|
|
395
|
+
- use one H1 per source page,
|
|
396
|
+
- keep heading hierarchy stable,
|
|
397
|
+
- use fenced code blocks with language tags,
|
|
398
|
+
- use relative repository links for other docs,
|
|
399
|
+
- keep API names exactly aligned with public exports,
|
|
400
|
+
- distinguish current behavior from roadmap plans,
|
|
401
|
+
- include security limitations next to the API they affect,
|
|
402
|
+
- prefer runnable examples over pseudo APIs,
|
|
403
|
+
- avoid documenting private/internal modules as public APIs.
|
|
405
404
|
|
|
406
|
-
|
|
405
|
+
## Stable vs development documentation
|
|
407
406
|
|
|
408
|
-
|
|
409
|
-
- multiline template-literal JSX expressions are supported,
|
|
410
|
-
- developers should not need to rewrite multiline `className` values as one-line strings to avoid framework hydration warnings,
|
|
411
|
-
- `CRLF` and standalone `CR` source line endings are normalized to `LF` before development instrumentation,
|
|
412
|
-
- React Refresh instrumentation must not change the semantic value of JSX attributes,
|
|
413
|
-
- the framework fix does not suppress genuine hydration mismatches caused by random values, locale differences, browser-only initial branches, changing external data or invalid HTML,
|
|
414
|
-
- `suppressHydrationWarning` is not a general-purpose solution.
|
|
407
|
+
`main` can contain documentation for the next release before npm publication.
|
|
415
408
|
|
|
416
|
-
|
|
409
|
+
Therefore the website must distinguish:
|
|
417
410
|
|
|
418
|
-
|
|
411
|
+
```text
|
|
412
|
+
Documentation target != necessarily current npm stable version
|
|
413
|
+
```
|
|
419
414
|
|
|
420
|
-
|
|
415
|
+
For example, while `0.1.25` is under release validation, `docs/storage.md` can describe the `0.1.25` development target, but the website should not label it as published until the release is actually available.
|
|
421
416
|
|
|
422
|
-
|
|
417
|
+
## Release validation
|
|
423
418
|
|
|
424
|
-
|
|
425
|
-
- non-zero exit codes for blocking doctor failures,
|
|
426
|
-
- React / React DOM version and package-root parity,
|
|
427
|
-
- duplicate `bcp` / `@chidchanun/bcp` installation detection,
|
|
428
|
-
- config and development environment inspection,
|
|
429
|
-
- page/API route summaries,
|
|
430
|
-
- `--json` output for CI and automation,
|
|
431
|
-
- the recommendation to verify local releases from packed `.tgz` artifacts installed under the existing `bcp` dependency key rather than linked staging directories.
|
|
419
|
+
Before publishing a framework release:
|
|
432
420
|
|
|
433
|
-
|
|
421
|
+
```bash
|
|
422
|
+
npm run typecheck
|
|
423
|
+
npm run test:unit
|
|
424
|
+
npm run test:e2e
|
|
425
|
+
npm run test:package
|
|
426
|
+
npm run rc:check
|
|
427
|
+
```
|
|
434
428
|
|
|
435
|
-
|
|
429
|
+
Release validation should include packed-package smoke verification and representative production application testing.
|
|
436
430
|
|
|
437
|
-
|
|
431
|
+
## Documentation QA checklist
|
|
438
432
|
|
|
439
|
-
|
|
433
|
+
Before a docs release or website sync:
|
|
440
434
|
|
|
441
|
-
-
|
|
442
|
-
-
|
|
443
|
-
-
|
|
444
|
-
-
|
|
445
|
-
-
|
|
446
|
-
-
|
|
447
|
-
-
|
|
448
|
-
-
|
|
449
|
-
-
|
|
435
|
+
- all linked Markdown files exist,
|
|
436
|
+
- examples use public exports,
|
|
437
|
+
- version numbers are current,
|
|
438
|
+
- unreleased features are labeled correctly,
|
|
439
|
+
- Windows CLI instructions use the safe alias where needed,
|
|
440
|
+
- security caveats are present for uploads/storage/authentication,
|
|
441
|
+
- route names match the current router,
|
|
442
|
+
- release notes match the framework version,
|
|
443
|
+
- no generated `.bcp-framework` paths are presented as user-authored source files.
|
|
450
444
|
|
|
451
|
-
|
|
445
|
+
## Roadmap
|
|
452
446
|
|
|
453
|
-
|
|
447
|
+
After `0.1.25`, the current planned framework direction is:
|
|
454
448
|
|
|
455
|
-
|
|
449
|
+
1. S3-compatible / cloud storage integration.
|
|
450
|
+
2. Production upload streaming.
|
|
451
|
+
3. Broader storage adapter ecosystem.
|
|
452
|
+
4. Additional production hardening.
|
|
456
453
|
|
|
457
|
-
|
|
454
|
+
These are roadmap items, not published API guarantees.
|
|
458
455
|
|
|
459
|
-
|
|
456
|
+
## Repository authority
|
|
460
457
|
|
|
461
|
-
|
|
462
|
-
npm run typecheck
|
|
463
|
-
npm run test:unit
|
|
464
|
-
npm run rc:check
|
|
465
|
-
```
|
|
458
|
+
The framework repository remains authoritative for:
|
|
466
459
|
|
|
467
|
-
|
|
460
|
+
```text
|
|
461
|
+
source
|
|
462
|
+
public exports
|
|
463
|
+
tests
|
|
464
|
+
docs
|
|
465
|
+
release notes
|
|
466
|
+
```
|
|
468
467
|
|
|
469
|
-
|
|
468
|
+
`bcp-docs-web` should be treated as the presentation/search/navigation layer for this content rather than a competing documentation source.
|