@chidchanun/bcp 0.2.3 → 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 +93 -139
- package/docs/api-manifest.json +1 -1
- package/docs/application-packaging.md +243 -0
- package/docs/deployment.md +94 -7
- package/docs/docs-web-manifest.json +5 -3
- package/docs/platform-manifest.json +14 -5
- 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/index.ts +60 -2
package/docs/deployment.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
npm run build
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
BCP writes the production artifact to `.bcp-framework/build`.
|
|
9
|
+
BCP writes the raw production artifact to `.bcp-framework/build`.
|
|
10
10
|
|
|
11
11
|
```text
|
|
12
12
|
.bcp-framework/build/
|
|
@@ -20,18 +20,79 @@ BCP writes the production artifact to `.bcp-framework/build`.
|
|
|
20
20
|
└─ config.json
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
Use the build directory when the deployment system already manages the application's production dependencies and artifact layout.
|
|
24
|
+
|
|
25
|
+
## Application package — 0.2.4
|
|
26
|
+
|
|
27
|
+
For a deployment-oriented directory, run:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
bcp package
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
or from the framework repository/example script surface:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run package
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`bcp package` runs a fresh production build and creates:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
.bcp-framework/package/
|
|
43
|
+
├─ client/
|
|
44
|
+
├─ server/
|
|
45
|
+
│ └─ server.mjs
|
|
46
|
+
├─ public/ # when present
|
|
47
|
+
├─ manifest.json
|
|
48
|
+
├─ package.json
|
|
49
|
+
├─ package-lock.json # when a safe production lock can be derived
|
|
50
|
+
├─ bcp.package.json
|
|
51
|
+
├─ bcp.deployment.json
|
|
52
|
+
├─ bcp.env.json
|
|
53
|
+
├─ Dockerfile
|
|
54
|
+
├─ .dockerignore
|
|
55
|
+
└─ README.md
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The package manifest excludes development dependencies. With a safely pruned npm v3 lockfile, install runtime dependencies with:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm ci --omit=dev
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If no package lock is included, follow the install command recorded in `bcp.package.json`/`bcp.deployment.json`.
|
|
65
|
+
|
|
66
|
+
BCP does not copy `.env` files into the package. Provide environment values and secrets at deployment/runtime.
|
|
67
|
+
|
|
68
|
+
See [Application Packaging](application-packaging.md) for the full packaging contract.
|
|
69
|
+
|
|
23
70
|
## Start
|
|
24
71
|
|
|
72
|
+
For the raw build:
|
|
73
|
+
|
|
25
74
|
```bash
|
|
26
75
|
npm start
|
|
27
76
|
```
|
|
28
77
|
|
|
29
|
-
|
|
78
|
+
or:
|
|
30
79
|
|
|
31
80
|
```bash
|
|
32
81
|
node .bcp-framework/build/server/server.mjs
|
|
33
82
|
```
|
|
34
83
|
|
|
84
|
+
Inside `.bcp-framework/package`, after production dependencies are installed:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm start
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
which runs:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
node server/server.mjs
|
|
94
|
+
```
|
|
95
|
+
|
|
35
96
|
## Runtime server overrides
|
|
36
97
|
|
|
37
98
|
The build retains the configured server defaults. Deployment can override the public bind address with supported runtime variables:
|
|
@@ -41,22 +102,34 @@ BCP_PORT
|
|
|
41
102
|
BCP_HOSTNAME
|
|
42
103
|
```
|
|
43
104
|
|
|
44
|
-
The CLI also supports:
|
|
105
|
+
The CLI also supports the raw build runtime flow:
|
|
45
106
|
|
|
46
107
|
```bash
|
|
47
108
|
bcp start --port 8080 --hostname 0.0.0.0
|
|
48
109
|
```
|
|
49
110
|
|
|
111
|
+
For a packaged application, provide `BCP_PORT` and `BCP_HOSTNAME` through the runtime environment.
|
|
112
|
+
|
|
50
113
|
## Containers
|
|
51
114
|
|
|
52
|
-
|
|
115
|
+
`bcp package` generates a starter Dockerfile in `.bcp-framework/package`.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
cd .bcp-framework/package
|
|
119
|
+
docker build -t my-bcp-app .
|
|
120
|
+
docker run --rm -p 3000:3000 my-bcp-app
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Pass credentials and environment-specific settings through the container/orchestrator environment rather than baking them into the image.
|
|
53
124
|
|
|
54
|
-
|
|
125
|
+
If you deploy the raw `.bcp-framework/build` directory instead, the image must separately include the runtime dependencies required by the generated server bundle, including React/React DOM when they remain external to the bundle.
|
|
55
126
|
|
|
56
127
|
## Reverse proxies
|
|
57
128
|
|
|
58
129
|
BCP can run behind a reverse proxy or tunnel. Forward the original host correctly when application middleware or absolute URL construction depends on host information.
|
|
59
130
|
|
|
131
|
+
Only enable trusted-proxy handling when the application process is actually isolated behind a trusted proxy/load balancer.
|
|
132
|
+
|
|
60
133
|
## Multiple instances
|
|
61
134
|
|
|
62
135
|
The current response/data cache is process-local. If multiple containers or Node.js processes serve the application, each maintains independent cache entries and invalidation state.
|
|
@@ -68,7 +141,21 @@ Before deployment:
|
|
|
68
141
|
```bash
|
|
69
142
|
npm run typecheck
|
|
70
143
|
npm test
|
|
71
|
-
|
|
144
|
+
bcp package
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Then validate the deployment package:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
cd .bcp-framework/package
|
|
151
|
+
npm ci --omit=dev
|
|
152
|
+
npm start
|
|
72
153
|
```
|
|
73
154
|
|
|
74
|
-
|
|
155
|
+
If `bcp.package.json` reports `lockfile: false`, use its recorded install command instead of `npm ci`.
|
|
156
|
+
|
|
157
|
+
For framework releases themselves, use:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npm run rc:check
|
|
161
|
+
```
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"framework": "bcp",
|
|
4
|
-
"versionTarget": "0.2.
|
|
4
|
+
"versionTarget": "0.2.4",
|
|
5
5
|
"releaseState": "unreleased",
|
|
6
6
|
"sections": [
|
|
7
7
|
{
|
|
8
8
|
"id": "getting-started",
|
|
9
9
|
"title": "Getting Started",
|
|
10
|
-
"description": "Create, configure, deploy and update BCP applications.",
|
|
10
|
+
"description": "Create, configure, package, deploy and update BCP applications.",
|
|
11
11
|
"pages": [
|
|
12
12
|
{ "route": "/docs/getting-started", "source": "getting-started.md", "title": "Getting Started" },
|
|
13
13
|
{ "route": "/docs/configuration", "source": "configuration.md", "title": "Configuration" },
|
|
14
14
|
{ "route": "/docs/environment-validation", "source": "environment-validation.md", "title": "Environment Validation" },
|
|
15
15
|
{ "route": "/docs/application-modules", "source": "application-modules.md", "title": "Application Modules" },
|
|
16
16
|
{ "route": "/docs/project-metadata", "source": "project-metadata.md", "title": "Project Metadata" },
|
|
17
|
+
{ "route": "/docs/application-packaging", "source": "application-packaging.md", "title": "Application Packaging" },
|
|
17
18
|
{ "route": "/docs/deployment", "source": "deployment.md", "title": "Deployment" },
|
|
18
19
|
{ "route": "/docs/updating", "source": "updating.md", "title": "Updating BCP" }
|
|
19
20
|
]
|
|
@@ -104,7 +105,8 @@
|
|
|
104
105
|
}
|
|
105
106
|
],
|
|
106
107
|
"releases": [
|
|
107
|
-
{ "route": "/releases/0.2.
|
|
108
|
+
{ "route": "/releases/0.2.4", "source": "releases/0.2.4.md", "version": "0.2.4", "state": "unreleased" },
|
|
109
|
+
{ "route": "/releases/0.2.3", "source": "releases/0.2.3.md", "version": "0.2.3" },
|
|
108
110
|
{ "route": "/releases/0.2.2", "source": "releases/0.2.2.md", "version": "0.2.2" },
|
|
109
111
|
{ "route": "/releases/0.2.1", "source": "releases/0.2.1.md", "version": "0.2.1" },
|
|
110
112
|
{ "route": "/releases/0.2.0", "source": "releases/0.2.0.md", "version": "0.2.0" },
|
|
@@ -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",
|
|
@@ -58,6 +60,12 @@
|
|
|
58
60
|
"streamingUploads": true,
|
|
59
61
|
"storageEcosystem": true,
|
|
60
62
|
"productionHardening": true,
|
|
63
|
+
"applicationPackaging": true,
|
|
64
|
+
"productionDependencyPruning": true,
|
|
65
|
+
"deploymentManifest": true,
|
|
66
|
+
"environmentPackagingManifest": true,
|
|
67
|
+
"packageIntegrityManifest": true,
|
|
68
|
+
"dockerPackageStarter": true,
|
|
61
69
|
"projectGenerators": true,
|
|
62
70
|
"projectDiagnostics": true,
|
|
63
71
|
"documentationPlatform": true,
|
|
@@ -78,7 +86,7 @@
|
|
|
78
86
|
"s3-compatible"
|
|
79
87
|
],
|
|
80
88
|
"compatibility": {
|
|
81
|
-
"previousBaseline": "0.2.
|
|
89
|
+
"previousBaseline": "0.2.3",
|
|
82
90
|
"intentionalBreakingChangesFromPreviousBaseline": false,
|
|
83
91
|
"migrationGuide": "migration-0.2.md"
|
|
84
92
|
},
|
|
@@ -90,7 +98,8 @@
|
|
|
90
98
|
"documentationPlatform": "documentation-platform.md",
|
|
91
99
|
"apiReference": "api-reference.md",
|
|
92
100
|
"environmentValidation": "environment-validation.md",
|
|
101
|
+
"applicationPackaging": "application-packaging.md",
|
|
93
102
|
"migrationGuide": "migration-0.2.md",
|
|
94
|
-
"releaseNotes": "releases/0.2.
|
|
103
|
+
"releaseNotes": "releases/0.2.4.md"
|
|
95
104
|
}
|
|
96
105
|
}
|
|
@@ -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",
|