@chidchanun/bcp 0.1.28 → 0.1.29

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,112 @@
1
+ # Project Metadata
2
+
3
+ BCP Framework `0.1.29` makes generated project presets explicit through `bcp.project.json`.
4
+
5
+ `create-bcp-app` writes this file after applying the selected project options.
6
+
7
+ Example:
8
+
9
+ ```json
10
+ {
11
+ "schemaVersion": 1,
12
+ "framework": "bcp",
13
+ "projectName": "my-app",
14
+ "frameworkPackage": "npm:@chidchanun/bcp@0.1.29",
15
+ "createdWith": {
16
+ "package": "create-bcp-app",
17
+ "version": "0.1.29"
18
+ },
19
+ "packageManager": "npm",
20
+ "presets": {
21
+ "tailwind": true,
22
+ "database": "mysql",
23
+ "auth": "jwt-cookie",
24
+ "storage": "cloudflare-r2"
25
+ }
26
+ }
27
+ ```
28
+
29
+ ## Purpose
30
+
31
+ The metadata file records scaffold choices without requiring later tools to infer them from source code.
32
+
33
+ It is intended for:
34
+
35
+ - `bcp doctor`,
36
+ - `bcp inspect`,
37
+ - project migration/update tooling,
38
+ - documentation tooling,
39
+ - `bcp-docs-web` examples and project-aware guidance,
40
+ - future framework upgrade diagnostics.
41
+
42
+ ## Security boundary
43
+
44
+ `bcp.project.json` must not contain credentials or runtime secrets.
45
+
46
+ It records only non-secret configuration identities such as:
47
+
48
+ ```text
49
+ Tailwind enabled/disabled
50
+ Database preset name
51
+ Auth preset name
52
+ Storage provider name
53
+ Package manager
54
+ Framework package specifier
55
+ create-bcp-app version
56
+ ```
57
+
58
+ Do not add values such as:
59
+
60
+ ```text
61
+ AWS_ACCESS_KEY_ID
62
+ AWS_SECRET_ACCESS_KEY
63
+ R2_ACCESS_KEY_ID
64
+ R2_SECRET_ACCESS_KEY
65
+ DATABASE_URL
66
+ passwords
67
+ JWT secrets
68
+ session tokens
69
+ ```
70
+
71
+ Runtime configuration stays in environment variables and server-only configuration.
72
+
73
+ ## Schema version
74
+
75
+ The initial format uses:
76
+
77
+ ```json
78
+ {
79
+ "schemaVersion": 1
80
+ }
81
+ ```
82
+
83
+ Consumers should check `schemaVersion` before relying on optional metadata fields.
84
+
85
+ Unknown future fields should normally be ignored so newer `create-bcp-app` versions remain compatible with older tooling where practical.
86
+
87
+ ## Storage provider metadata
88
+
89
+ Storage choices currently include:
90
+
91
+ ```text
92
+ none
93
+ local
94
+ amazon-s3
95
+ cloudflare-r2
96
+ ```
97
+
98
+ `bcp inspect` can use the metadata first and fall back to inspecting `lib/storage.ts` for older projects without `bcp.project.json`.
99
+
100
+ ## Existing projects
101
+
102
+ Projects created before `0.1.29` do not need this file to keep running.
103
+
104
+ The metadata file is additive. Doctor/inspect can still infer core project information from `package.json`, lockfiles, routes and generated source where possible.
105
+
106
+ If an older project wants to adopt the file manually, keep the schema minimal and do not invent preset values that are not actually in use.
107
+
108
+ ## Source control
109
+
110
+ `bcp.project.json` should normally be committed to source control because it contains project structure metadata, not secrets.
111
+
112
+ This allows CI and documentation tooling to read the same preset identity as local developer tooling.
@@ -0,0 +1,170 @@
1
+ # BCP Framework 0.1.29
2
+
3
+ > **Milestone:** Developer Experience
4
+ >
5
+ > **Release state:** unreleased development target. Do not mark this version as published until local validation, RC checks, tagging and npm publication complete.
6
+
7
+ BCP Framework `0.1.29` focuses on reducing repetitive project setup and making project diagnostics easier to consume locally, in CI and in `bcp-docs-web`.
8
+
9
+ ## Highlights
10
+
11
+ ### Project generators
12
+
13
+ New CLI command:
14
+
15
+ ```bash
16
+ bcp generate <kind>
17
+ ```
18
+
19
+ Supported generators:
20
+
21
+ ```bash
22
+ bcp generate page dashboard/users
23
+ bcp generate api users
24
+ bcp generate middleware
25
+ bcp generate migration create_users
26
+ ```
27
+
28
+ Page, API and middleware generators refuse to replace existing files unless `--force` is explicitly supplied.
29
+
30
+ Migration generation reuses the existing database migration implementation so timestamp/file naming has a single source of truth.
31
+
32
+ ### Doctor / Inspect v2
33
+
34
+ `bcp doctor` now adds project/runtime checks for:
35
+
36
+ - supported dependency lockfiles,
37
+ - duplicate `bcp` / `@chidchanun/bcp` dependency declarations,
38
+ - production hardening environment validity,
39
+ - standalone production build presence,
40
+ - Docker + lockfile reproducibility guidance,
41
+ - configured storage provider detection.
42
+
43
+ `bcp inspect` keeps its previous report fields and adds a `project` section with:
44
+
45
+ ```text
46
+ package manager
47
+ lockfile
48
+ bcp.project.json metadata
49
+ selected create-bcp-app presets
50
+ production build presence
51
+ Dockerfile presence
52
+ framework dependency declarations
53
+ storage provider
54
+ production hardening state
55
+ ```
56
+
57
+ The new fields are additive so existing consumers of the previous JSON fields can continue reading them.
58
+
59
+ ### `bcp.project.json`
60
+
61
+ New projects created by `create-bcp-app` receive a non-secret metadata manifest:
62
+
63
+ ```json
64
+ {
65
+ "schemaVersion": 1,
66
+ "framework": "bcp",
67
+ "projectName": "my-app",
68
+ "createdWith": {
69
+ "package": "create-bcp-app",
70
+ "version": "0.1.29"
71
+ },
72
+ "packageManager": "npm",
73
+ "presets": {
74
+ "tailwind": true,
75
+ "database": "mysql",
76
+ "auth": "jwt-cookie",
77
+ "storage": "local"
78
+ }
79
+ }
80
+ ```
81
+
82
+ The manifest records scaffold identity only. Credentials, passwords, access keys, session secrets and tokens must remain outside this file.
83
+
84
+ Older projects without `bcp.project.json` continue to work. Doctor/inspect fall back to project files where practical.
85
+
86
+ ### Docs-web manifest
87
+
88
+ `docs/docs-web-manifest.json` is now the explicit navigation contract for `bcp-docs-web`.
89
+
90
+ It maps:
91
+
92
+ ```text
93
+ section
94
+ website route
95
+ Markdown source
96
+ title
97
+ release routes
98
+ version target
99
+ release state
100
+ ```
101
+
102
+ The Markdown files under `docs/` remain the authored documentation source of truth. The JSON manifest is navigation/routing metadata, not a competing content source.
103
+
104
+ New authored guides include:
105
+
106
+ - `docs/generators.md`
107
+ - `docs/project-metadata.md`
108
+
109
+ ## Compatibility
110
+
111
+ `0.1.29` is intended to be additive.
112
+
113
+ - Existing page/API routing remains unchanged.
114
+ - Existing database migration commands remain supported.
115
+ - `bcp doctor` retains its existing report structure and adds checks.
116
+ - `bcp inspect` retains its existing fields and adds `project`.
117
+ - Existing projects do not require `bcp.project.json`.
118
+ - `--force` is opt-in and never silently overwrites existing generated files.
119
+
120
+ ## Out of scope
121
+
122
+ The following are not guarantees of `0.1.29`:
123
+
124
+ - generated symbol/API reference documentation,
125
+ - interactive documentation playgrounds,
126
+ - source-code merge behavior for generators,
127
+ - automatic conversion of old projects into `bcp.project.json`,
128
+ - the `0.2.0` API/platform stability baseline.
129
+
130
+ ## Documentation sources
131
+
132
+ Primary documentation for this milestone:
133
+
134
+ ```text
135
+ docs/generators.md
136
+ docs/developer-tools.md
137
+ docs/project-metadata.md
138
+ docs/docs-web-manifest.json
139
+ docs/README.md
140
+ ```
141
+
142
+ ## Validation
143
+
144
+ Before tagging or publishing `0.1.29`, run:
145
+
146
+ ```powershell
147
+ npm run typecheck
148
+ npm run test:unit
149
+ npm run test:integration
150
+ npm run test:package
151
+ npm run test:e2e
152
+ npm run rc:check
153
+ ```
154
+
155
+ The release lockfile must also be synchronized to `0.1.29` before the final tag.
156
+
157
+ Recommended generator smoke checks:
158
+
159
+ ```powershell
160
+ npm exec -- bcp-framework generate page dx-test --root examples/basic-app
161
+ npm exec -- bcp-framework routes --root examples/basic-app
162
+ ```
163
+
164
+ Use a disposable project for destructive `--force` testing.
165
+
166
+ ## Next direction
167
+
168
+ After `0.1.29`, the planned major milestone is **`0.2.0 — Framework Platform`**.
169
+
170
+ The `0.2.0` work should focus on consolidating the existing `0.1.x` surface into a documented platform baseline: API consistency, production stabilization, documentation completeness, migration guidance and compatibility expectations rather than adding unrelated large feature areas.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chidchanun/bcp",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
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",
@@ -8,6 +8,7 @@ export type CliCommand =
8
8
  | "routes"
9
9
  | "update"
10
10
  | "db"
11
+ | "generate"
11
12
  | "doctor"
12
13
  | "inspect"
13
14
  | "help"
@@ -20,6 +21,13 @@ export type DatabaseCliAction =
20
21
  | "create"
21
22
  | "help";
22
23
 
24
+ export type GenerateCliKind =
25
+ | "page"
26
+ | "api"
27
+ | "middleware"
28
+ | "migration"
29
+ | "help";
30
+
23
31
  export interface CliOptions {
24
32
  command: CliCommand;
25
33
 
@@ -37,9 +45,15 @@ export interface CliOptions {
37
45
 
38
46
  json?: boolean;
39
47
 
48
+ force?: boolean;
49
+
40
50
  dbAction?: DatabaseCliAction;
41
51
 
42
52
  dbMigrationName?: string;
53
+
54
+ generateKind?: GenerateCliKind;
55
+
56
+ generateName?: string;
43
57
  }
44
58
 
45
59
  export function parseCliArgs(
@@ -68,12 +82,21 @@ export function parseCliArgs(
68
82
  let json =
69
83
  false;
70
84
 
85
+ let force =
86
+ false;
87
+
71
88
  let dbAction:
72
89
  DatabaseCliAction | undefined;
73
90
 
74
91
  let dbMigrationName:
75
92
  string | undefined;
76
93
 
94
+ let generateKind:
95
+ GenerateCliKind | undefined;
96
+
97
+ let generateName:
98
+ string | undefined;
99
+
77
100
  let commandSet = false;
78
101
 
79
102
  for (
@@ -92,6 +115,11 @@ export function parseCliArgs(
92
115
  command === "db"
93
116
  ) {
94
117
  dbAction = "help";
118
+ } else if (
119
+ commandSet &&
120
+ command === "generate"
121
+ ) {
122
+ generateKind = "help";
95
123
  } else {
96
124
  command = "help";
97
125
  }
@@ -224,6 +252,14 @@ export function parseCliArgs(
224
252
  continue;
225
253
  }
226
254
 
255
+ if (
256
+ argument === "--force"
257
+ ) {
258
+ force =
259
+ true;
260
+ continue;
261
+ }
262
+
227
263
  if (
228
264
  argument.startsWith("-")
229
265
  ) {
@@ -299,6 +335,45 @@ export function parseCliArgs(
299
335
  );
300
336
  }
301
337
 
338
+ if (
339
+ commandSet &&
340
+ command === "generate"
341
+ ) {
342
+ if (
343
+ generateKind === undefined
344
+ ) {
345
+ if (
346
+ argument === "page" ||
347
+ argument === "api" ||
348
+ argument === "middleware" ||
349
+ argument === "migration" ||
350
+ argument === "help"
351
+ ) {
352
+ generateKind =
353
+ argument;
354
+ continue;
355
+ }
356
+
357
+ throw new Error(
358
+ `Unknown generator: ${argument}`
359
+ );
360
+ }
361
+
362
+ if (
363
+ generateKind !== "middleware" &&
364
+ generateKind !== "help" &&
365
+ generateName === undefined
366
+ ) {
367
+ generateName =
368
+ argument;
369
+ continue;
370
+ }
371
+
372
+ throw new Error(
373
+ `Unexpected argument: ${argument}`
374
+ );
375
+ }
376
+
302
377
  if (commandSet) {
303
378
  throw new Error(
304
379
  `Unexpected argument: ${argument}`
@@ -312,6 +387,7 @@ export function parseCliArgs(
312
387
  argument === "routes" ||
313
388
  argument === "update" ||
314
389
  argument === "db" ||
390
+ argument === "generate" ||
315
391
  argument === "doctor" ||
316
392
  argument === "inspect" ||
317
393
  argument === "help" ||
@@ -349,6 +425,15 @@ export function parseCliArgs(
349
425
  );
350
426
  }
351
427
 
428
+ if (
429
+ force &&
430
+ command !== "generate"
431
+ ) {
432
+ throw new Error(
433
+ "Option --force is only valid with `bcp generate`."
434
+ );
435
+ }
436
+
352
437
  return {
353
438
  command,
354
439
  rootDirectory,
@@ -362,12 +447,23 @@ export function parseCliArgs(
362
447
  json: true,
363
448
  }
364
449
  : {}),
450
+ ...(force
451
+ ? {
452
+ force: true,
453
+ }
454
+ : {}),
365
455
  ...(command === "db"
366
456
  ? {
367
457
  dbAction,
368
458
  dbMigrationName,
369
459
  }
370
460
  : {}),
461
+ ...(command === "generate"
462
+ ? {
463
+ generateKind,
464
+ generateName,
465
+ }
466
+ : {}),
371
467
  };
372
468
  }
373
469