create-bcp-app 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 +85 -67
- package/package.json +1 -1
- package/src/index.mjs +12 -1
- package/template/README.md +34 -4
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ Generated npm scripts use `bcp` because npm places `node_modules/.bin` on the sc
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"dev": "bcp dev",
|
|
21
21
|
"build": "bcp build",
|
|
22
|
+
"package": "bcp package",
|
|
22
23
|
"start": "bcp start",
|
|
23
24
|
"routes": "bcp routes",
|
|
24
25
|
"generate": "bcp generate",
|
|
@@ -27,6 +28,16 @@ Generated npm scripts use `bcp` because npm places `node_modules/.bin` on the sc
|
|
|
27
28
|
}
|
|
28
29
|
```
|
|
29
30
|
|
|
31
|
+
When Tailwind CSS is selected, the generated packaging script preserves the production CSS step:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"scripts": {
|
|
36
|
+
"package": "npm run css:build:prod && bcp package"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
30
41
|
For direct PowerShell usage, prefer the collision-free local alias:
|
|
31
42
|
|
|
32
43
|
```powershell
|
|
@@ -37,6 +48,7 @@ npm exec -- bcp-framework generate page dashboard/users
|
|
|
37
48
|
npm exec -- bcp-framework routes
|
|
38
49
|
npm exec -- bcp-framework dev
|
|
39
50
|
npm exec -- bcp-framework build
|
|
51
|
+
npm exec -- bcp-framework package
|
|
40
52
|
```
|
|
41
53
|
|
|
42
54
|
Microsoft SQL Server can install another Windows executable named `bcp.exe`, so `bcp-framework` is the recommended interactive Windows command name.
|
|
@@ -65,7 +77,7 @@ Select storage provider:
|
|
|
65
77
|
|
|
66
78
|
Equivalent non-interactive flags are available for CI/scaffolding automation.
|
|
67
79
|
|
|
68
|
-
## Generated project metadata
|
|
80
|
+
## Generated project metadata
|
|
69
81
|
|
|
70
82
|
New projects include:
|
|
71
83
|
|
|
@@ -80,10 +92,10 @@ Example:
|
|
|
80
92
|
"schemaVersion": 1,
|
|
81
93
|
"framework": "bcp",
|
|
82
94
|
"projectName": "my-app",
|
|
83
|
-
"frameworkPackage": "npm:@chidchanun/bcp@0.
|
|
95
|
+
"frameworkPackage": "npm:@chidchanun/bcp@0.2.4",
|
|
84
96
|
"createdWith": {
|
|
85
97
|
"package": "create-bcp-app",
|
|
86
|
-
"version": "0.
|
|
98
|
+
"version": "0.2.4"
|
|
87
99
|
},
|
|
88
100
|
"packageManager": "npm",
|
|
89
101
|
"presets": {
|
|
@@ -95,22 +107,10 @@ Example:
|
|
|
95
107
|
}
|
|
96
108
|
```
|
|
97
109
|
|
|
98
|
-
This manifest records scaffold identity only. It is intended for
|
|
99
|
-
|
|
100
|
-
- `bcp doctor`,
|
|
101
|
-
- `bcp inspect`,
|
|
102
|
-
- upgrade/migration tooling,
|
|
103
|
-
- project-aware documentation,
|
|
104
|
-
- `bcp-docs-web` examples/tooling.
|
|
105
|
-
|
|
106
|
-
It must not contain secrets. Never put database passwords, AWS/R2 credentials, JWT/session secrets or tokens in `bcp.project.json`.
|
|
110
|
+
This manifest records scaffold identity only. It is intended for framework diagnostics, update/migration tooling and project-aware documentation. It must not contain secrets.
|
|
107
111
|
|
|
108
112
|
The file should normally be committed to source control.
|
|
109
113
|
|
|
110
|
-
Existing projects created before `0.1.29` remain valid without it.
|
|
111
|
-
|
|
112
|
-
Read more: `docs/project-metadata.md` in the BCP Framework repository.
|
|
113
|
-
|
|
114
114
|
## Generated application defaults
|
|
115
115
|
|
|
116
116
|
Generated applications include the project-root `@/` alias and TypeScript settings compatible with the BCP bundler.
|
|
@@ -135,12 +135,12 @@ npm exec -- bcp-framework update --check
|
|
|
135
135
|
|
|
136
136
|
When Tailwind is enabled, the project includes:
|
|
137
137
|
|
|
138
|
-
- `tailwindcss
|
|
139
|
-
- `@tailwindcss/cli
|
|
140
|
-
- `concurrently
|
|
141
|
-
- `app/globals.css
|
|
142
|
-
- `/bcp.css` stylesheet setup
|
|
143
|
-
- starter utility classes
|
|
138
|
+
- `tailwindcss`
|
|
139
|
+
- `@tailwindcss/cli`
|
|
140
|
+
- `concurrently`
|
|
141
|
+
- `app/globals.css`
|
|
142
|
+
- `/bcp.css` stylesheet setup
|
|
143
|
+
- starter utility classes
|
|
144
144
|
|
|
145
145
|
Generated commands include:
|
|
146
146
|
|
|
@@ -150,7 +150,7 @@ npm run css:watch
|
|
|
150
150
|
npm run css:build:prod
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
`npm run build`
|
|
153
|
+
`npm run build` and `npm run package` create the production stylesheet before the BCP production build/package flow.
|
|
154
154
|
|
|
155
155
|
## Database presets
|
|
156
156
|
|
|
@@ -162,13 +162,7 @@ The database choice adds starter configuration and the matching driver:
|
|
|
162
162
|
- MongoDB: `mongodb`
|
|
163
163
|
- None: no database dependency
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
```ts
|
|
168
|
-
import "bcp/server-only";
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
For MySQL, the generated helper exposes the BCP database primitives through `bcp/database`.
|
|
165
|
+
For **MySQL**, **PostgreSQL** and **SQLite**, generated `lib/database.ts` exposes the framework database primitives through `bcp/database`. Provider connections are managed behind Database Platform v2 instead of being created directly in generated application code.
|
|
172
166
|
|
|
173
167
|
Generated MySQL environment variables:
|
|
174
168
|
|
|
@@ -180,33 +174,38 @@ DB_PASSWORD=
|
|
|
180
174
|
DB_NAME=bcp_app
|
|
181
175
|
```
|
|
182
176
|
|
|
183
|
-
|
|
177
|
+
Generated PostgreSQL environment variable:
|
|
184
178
|
|
|
185
|
-
|
|
179
|
+
```dotenv
|
|
180
|
+
DATABASE_URL=postgresql://postgres:password@localhost:5432/bcp_app
|
|
181
|
+
```
|
|
186
182
|
|
|
187
|
-
|
|
183
|
+
Generated SQLite environment variable:
|
|
188
184
|
|
|
189
|
-
```
|
|
190
|
-
|
|
185
|
+
```dotenv
|
|
186
|
+
DATABASE_URL=./data/bcp.sqlite
|
|
191
187
|
```
|
|
192
188
|
|
|
193
|
-
and
|
|
189
|
+
`bcp/database` infers PostgreSQL from `postgres://` or `postgresql://` connection URLs. SQLite is inferred from `:memory:`, `sqlite:` / `file:` locations and common `.sqlite`, `.sqlite3` or `.db` file paths. Applications may also configure `DB_DRIVER` explicitly.
|
|
194
190
|
|
|
195
|
-
|
|
191
|
+
Placeholder syntax follows the selected provider:
|
|
196
192
|
|
|
197
|
-
```
|
|
198
|
-
|
|
193
|
+
```text
|
|
194
|
+
MySQL ?
|
|
195
|
+
SQLite ?
|
|
196
|
+
PostgreSQL $1, $2, ...
|
|
199
197
|
```
|
|
200
198
|
|
|
201
|
-
|
|
199
|
+
The generator intentionally does not force an ORM.
|
|
202
200
|
|
|
203
|
-
|
|
204
|
-
lib/
|
|
205
|
-
└─ storage.ts
|
|
201
|
+
## Storage providers
|
|
206
202
|
|
|
207
|
-
storage/
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
Selecting a storage provider creates `lib/storage.ts` and adds provider-specific environment settings.
|
|
204
|
+
|
|
205
|
+
### Local Server
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
npx create-bcp-app my-app --storage local
|
|
210
209
|
```
|
|
211
210
|
|
|
212
211
|
Environment:
|
|
@@ -215,14 +214,6 @@ Environment:
|
|
|
215
214
|
STORAGE_LOCAL_DIRECTORY=./storage
|
|
216
215
|
```
|
|
217
216
|
|
|
218
|
-
`.gitignore` keeps the visible scaffold while ignoring runtime objects:
|
|
219
|
-
|
|
220
|
-
```gitignore
|
|
221
|
-
storage/*
|
|
222
|
-
!storage/.gitkeep
|
|
223
|
-
!storage/README.md
|
|
224
|
-
```
|
|
225
|
-
|
|
226
217
|
The generated helper uses `createLocalStorage()`.
|
|
227
218
|
|
|
228
219
|
### Amazon S3
|
|
@@ -260,17 +251,8 @@ R2_SECRET_ACCESS_KEY=
|
|
|
260
251
|
R2_PREFIX=
|
|
261
252
|
```
|
|
262
253
|
|
|
263
|
-
The helper configures the S3-compatible adapter with:
|
|
264
|
-
|
|
265
|
-
```text
|
|
266
|
-
region: auto
|
|
267
|
-
endpoint: https://<account-id>.r2.cloudflarestorage.com
|
|
268
|
-
```
|
|
269
|
-
|
|
270
254
|
Storage credentials are server-only. Do not expose them through `BCP_PUBLIC_*` variables.
|
|
271
255
|
|
|
272
|
-
The storage preset is only an initial scaffold; application routes/services can later use another BCP adapter while keeping generic storage APIs.
|
|
273
|
-
|
|
274
256
|
## JWT Cookie authentication
|
|
275
257
|
|
|
276
258
|
Selecting `JWT Cookie` creates:
|
|
@@ -293,11 +275,45 @@ BCP_SESSION_SECRET=
|
|
|
293
275
|
|
|
294
276
|
Set this to a cryptographically random secret of at least 32 bytes before real authentication use.
|
|
295
277
|
|
|
296
|
-
The generated `authenticateCredentials(email, password)` returns `null` until the application connects it to its own user store and password-hash verification.
|
|
278
|
+
The generated `authenticateCredentials(email, password)` returns `null` until the application connects it to its own user store and password-hash verification.
|
|
297
279
|
|
|
298
|
-
##
|
|
280
|
+
## Application Packaging — 0.2.4+
|
|
281
|
+
|
|
282
|
+
Generated projects include:
|
|
299
283
|
|
|
300
|
-
|
|
284
|
+
```bash
|
|
285
|
+
npm run package
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
This runs the BCP `standalone-node` application packaging flow and writes:
|
|
289
|
+
|
|
290
|
+
```text
|
|
291
|
+
.bcp-framework/package/
|
|
292
|
+
├─ client/
|
|
293
|
+
├─ server/
|
|
294
|
+
├─ public/ # when present
|
|
295
|
+
├─ package.json
|
|
296
|
+
├─ package-lock.json # when a safe production lock can be derived
|
|
297
|
+
├─ bcp.package.json
|
|
298
|
+
├─ bcp.deployment.json
|
|
299
|
+
├─ bcp.env.json
|
|
300
|
+
├─ Dockerfile
|
|
301
|
+
└─ README.md
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
The deployment package excludes application `devDependencies` and project `.env` values. Supply real secrets through the deployment environment.
|
|
305
|
+
|
|
306
|
+
For a package with a generated production lockfile:
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
cd .bcp-framework/package
|
|
310
|
+
npm ci --omit=dev
|
|
311
|
+
npm start
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
If the package manifest reports that no lockfile was included, use the install command recorded in `bcp.package.json`.
|
|
315
|
+
|
|
316
|
+
## Project generators after creation
|
|
301
317
|
|
|
302
318
|
```bash
|
|
303
319
|
npm run generate -- page dashboard/users
|
|
@@ -341,6 +357,8 @@ Examples:
|
|
|
341
357
|
|
|
342
358
|
```bash
|
|
343
359
|
npx create-bcp-app my-app --tailwind --database mysql --auth jwt-cookie --storage local
|
|
360
|
+
npx create-bcp-app my-app --database postgresql
|
|
361
|
+
npx create-bcp-app my-app --database sqlite
|
|
344
362
|
npx create-bcp-app my-app --storage amazon-s3
|
|
345
363
|
npx create-bcp-app my-app --storage cloudflare-r2
|
|
346
364
|
npx create-bcp-app my-app --no-tailwind --database mongodb
|
|
@@ -350,5 +368,5 @@ npx create-bcp-app my-app --yes
|
|
|
350
368
|
The `--bcp` option is mainly for prerelease/local package verification:
|
|
351
369
|
|
|
352
370
|
```bash
|
|
353
|
-
npx create-bcp-app my-app --bcp file:../chidchanun-bcp-0.
|
|
371
|
+
npx create-bcp-app my-app --bcp file:../chidchanun-bcp-0.2.4.tgz
|
|
354
372
|
```
|
package/package.json
CHANGED
package/src/index.mjs
CHANGED
|
@@ -98,6 +98,8 @@ export async function createBcpApp(
|
|
|
98
98
|
"bcp dev",
|
|
99
99
|
build:
|
|
100
100
|
"bcp build",
|
|
101
|
+
package:
|
|
102
|
+
"bcp package",
|
|
101
103
|
start:
|
|
102
104
|
"bcp start",
|
|
103
105
|
routes:
|
|
@@ -147,6 +149,13 @@ export async function createBcpApp(
|
|
|
147
149
|
storage,
|
|
148
150
|
});
|
|
149
151
|
|
|
152
|
+
if (
|
|
153
|
+
selectedOptions.tailwind
|
|
154
|
+
) {
|
|
155
|
+
packageJson.scripts.package =
|
|
156
|
+
"npm run css:build:prod && bcp package";
|
|
157
|
+
}
|
|
158
|
+
|
|
150
159
|
configureFrameworkDatabaseEntry(
|
|
151
160
|
targetDirectory,
|
|
152
161
|
selectedOptions.database
|
|
@@ -388,7 +397,9 @@ function configureFrameworkDatabaseEntry(
|
|
|
388
397
|
database
|
|
389
398
|
) {
|
|
390
399
|
if (
|
|
391
|
-
database !== "mysql"
|
|
400
|
+
database !== "mysql" &&
|
|
401
|
+
database !== "postgresql" &&
|
|
402
|
+
database !== "sqlite"
|
|
392
403
|
) {
|
|
393
404
|
return;
|
|
394
405
|
}
|
package/template/README.md
CHANGED
|
@@ -20,11 +20,12 @@ npm run routes
|
|
|
20
20
|
npm run generate -- page dashboard/users
|
|
21
21
|
npm run typecheck
|
|
22
22
|
npm run build
|
|
23
|
+
npm run package
|
|
23
24
|
npm start
|
|
24
25
|
npm run update
|
|
25
26
|
```
|
|
26
27
|
|
|
27
|
-
The generated scripts call commands such as `bcp dev`, `bcp generate`, `bcp build` and `bcp start`. npm automatically adds the project's `node_modules/.bin` directory to `PATH` while an npm script is running.
|
|
28
|
+
The generated scripts call commands such as `bcp dev`, `bcp generate`, `bcp build`, `bcp package` and `bcp start`. npm automatically adds the project's `node_modules/.bin` directory to `PATH` while an npm script is running.
|
|
28
29
|
|
|
29
30
|
## Project metadata
|
|
30
31
|
|
|
@@ -40,7 +41,7 @@ Commit this file with the project. Do not put passwords, access keys, session se
|
|
|
40
41
|
|
|
41
42
|
## Generate framework files
|
|
42
43
|
|
|
43
|
-
BCP
|
|
44
|
+
BCP can generate common project files:
|
|
44
45
|
|
|
45
46
|
```bash
|
|
46
47
|
npm run generate -- page dashboard/users
|
|
@@ -80,6 +81,7 @@ npm exec -- bcp-framework generate page dashboard/users
|
|
|
80
81
|
npm exec -- bcp-framework routes
|
|
81
82
|
npm exec -- bcp-framework dev
|
|
82
83
|
npm exec -- bcp-framework build
|
|
84
|
+
npm exec -- bcp-framework package
|
|
83
85
|
```
|
|
84
86
|
|
|
85
87
|
You can also execute the Windows command shim explicitly:
|
|
@@ -115,9 +117,9 @@ npm exec -- bcp-framework inspect --json
|
|
|
115
117
|
|
|
116
118
|
Doctor checks common project/runtime problems while Inspect shows the resolved configuration, routes, dependencies and project metadata BCP sees.
|
|
117
119
|
|
|
118
|
-
## Production
|
|
120
|
+
## Production build
|
|
119
121
|
|
|
120
|
-
Create the standalone production build:
|
|
122
|
+
Create the raw standalone production build:
|
|
121
123
|
|
|
122
124
|
```bash
|
|
123
125
|
npm run build
|
|
@@ -130,3 +132,31 @@ npm start
|
|
|
130
132
|
```
|
|
131
133
|
|
|
132
134
|
The production build is written to `.bcp-framework/build` and runs as a standalone Node.js server.
|
|
135
|
+
|
|
136
|
+
## Deployment package — BCP 0.2.4+
|
|
137
|
+
|
|
138
|
+
Create a fresh production build and deployment-oriented package:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
npm run package
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The output is written to:
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
.bcp-framework/package/
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
It contains the standalone client/server output, a production-only dependency manifest, deployment/environment metadata, file integrity hashes and a starter Dockerfile.
|
|
151
|
+
|
|
152
|
+
BCP intentionally excludes project `.env` files and application `devDependencies` from the deployment package. Provide secrets through your deployment environment.
|
|
153
|
+
|
|
154
|
+
For a package with a generated production lockfile:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
cd .bcp-framework/package
|
|
158
|
+
npm ci --omit=dev
|
|
159
|
+
npm start
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
If `bcp.package.json` reports that no lockfile was included, use the install command recorded in that manifest instead.
|