create-bcp-app 0.2.3 → 0.2.5
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 +89 -63
- package/package.json +1 -1
- package/src/index.mjs +9 -0
- package/template/README.md +62 -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.5",
|
|
84
96
|
"createdWith": {
|
|
85
97
|
"package": "create-bcp-app",
|
|
86
|
-
"version": "0.
|
|
98
|
+
"version": "0.2.5"
|
|
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,7 +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
|
-
For **MySQL**, **PostgreSQL** and **SQLite**, generated `lib/database.ts` exposes the framework database primitives through `bcp/database`. Provider connections are managed behind
|
|
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.
|
|
166
166
|
|
|
167
167
|
Generated MySQL environment variables:
|
|
168
168
|
|
|
@@ -200,13 +200,7 @@ The generator intentionally does not force an ORM.
|
|
|
200
200
|
|
|
201
201
|
## Storage providers
|
|
202
202
|
|
|
203
|
-
Selecting a storage provider creates
|
|
204
|
-
|
|
205
|
-
```text
|
|
206
|
-
lib/storage.ts
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
and adds provider-specific environment settings.
|
|
203
|
+
Selecting a storage provider creates `lib/storage.ts` and adds provider-specific environment settings.
|
|
210
204
|
|
|
211
205
|
### Local Server
|
|
212
206
|
|
|
@@ -214,31 +208,12 @@ and adds provider-specific environment settings.
|
|
|
214
208
|
npx create-bcp-app my-app --storage local
|
|
215
209
|
```
|
|
216
210
|
|
|
217
|
-
Generated structure:
|
|
218
|
-
|
|
219
|
-
```text
|
|
220
|
-
lib/
|
|
221
|
-
└─ storage.ts
|
|
222
|
-
|
|
223
|
-
storage/
|
|
224
|
-
├─ .gitkeep
|
|
225
|
-
└─ README.md
|
|
226
|
-
```
|
|
227
|
-
|
|
228
211
|
Environment:
|
|
229
212
|
|
|
230
213
|
```dotenv
|
|
231
214
|
STORAGE_LOCAL_DIRECTORY=./storage
|
|
232
215
|
```
|
|
233
216
|
|
|
234
|
-
`.gitignore` keeps the visible scaffold while ignoring runtime objects:
|
|
235
|
-
|
|
236
|
-
```gitignore
|
|
237
|
-
storage/*
|
|
238
|
-
!storage/.gitkeep
|
|
239
|
-
!storage/README.md
|
|
240
|
-
```
|
|
241
|
-
|
|
242
217
|
The generated helper uses `createLocalStorage()`.
|
|
243
218
|
|
|
244
219
|
### Amazon S3
|
|
@@ -276,17 +251,8 @@ R2_SECRET_ACCESS_KEY=
|
|
|
276
251
|
R2_PREFIX=
|
|
277
252
|
```
|
|
278
253
|
|
|
279
|
-
The helper configures the S3-compatible adapter with:
|
|
280
|
-
|
|
281
|
-
```text
|
|
282
|
-
region: auto
|
|
283
|
-
endpoint: https://<account-id>.r2.cloudflarestorage.com
|
|
284
|
-
```
|
|
285
|
-
|
|
286
254
|
Storage credentials are server-only. Do not expose them through `BCP_PUBLIC_*` variables.
|
|
287
255
|
|
|
288
|
-
The storage preset is only an initial scaffold; application routes/services can later use another BCP adapter while keeping generic storage APIs.
|
|
289
|
-
|
|
290
256
|
## JWT Cookie authentication
|
|
291
257
|
|
|
292
258
|
Selecting `JWT Cookie` creates:
|
|
@@ -309,11 +275,71 @@ BCP_SESSION_SECRET=
|
|
|
309
275
|
|
|
310
276
|
Set this to a cryptographically random secret of at least 32 bytes before real authentication use.
|
|
311
277
|
|
|
312
|
-
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.
|
|
313
279
|
|
|
314
|
-
|
|
280
|
+
Generated auth stays in backward-compatible stateless JWT-cookie mode by default.
|
|
281
|
+
|
|
282
|
+
BCP `0.2.5+` can opt into revocable server-side auth state without changing the generated auth route structure:
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
import {
|
|
286
|
+
createAuth,
|
|
287
|
+
createMemoryAuthSessionStore,
|
|
288
|
+
} from "bcp/auth";
|
|
289
|
+
|
|
290
|
+
const sessionStore =
|
|
291
|
+
createMemoryAuthSessionStore();
|
|
292
|
+
|
|
293
|
+
const frameworkAuth =
|
|
294
|
+
createAuth<AuthenticatedUser>({
|
|
295
|
+
store:
|
|
296
|
+
sessionStore,
|
|
297
|
+
idleTimeout:
|
|
298
|
+
60 * 30,
|
|
299
|
+
});
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
The memory store is intended for development/tests. Multi-process production deployments should implement `AuthSessionStore` using shared durable storage.
|
|
303
|
+
|
|
304
|
+
Authentication Platform v2 also provides `logoutAll()`, session/user revocation APIs and `createGuestGuard()` for login/register pages.
|
|
305
|
+
|
|
306
|
+
## Application Packaging — 0.2.4+
|
|
307
|
+
|
|
308
|
+
Generated projects include:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
npm run package
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
This runs the BCP `standalone-node` application packaging flow and writes:
|
|
315
|
+
|
|
316
|
+
```text
|
|
317
|
+
.bcp-framework/package/
|
|
318
|
+
├─ client/
|
|
319
|
+
├─ server/
|
|
320
|
+
├─ public/ # when present
|
|
321
|
+
├─ package.json
|
|
322
|
+
├─ package-lock.json # when a safe production lock can be derived
|
|
323
|
+
├─ bcp.package.json
|
|
324
|
+
├─ bcp.deployment.json
|
|
325
|
+
├─ bcp.env.json
|
|
326
|
+
├─ Dockerfile
|
|
327
|
+
└─ README.md
|
|
328
|
+
```
|
|
315
329
|
|
|
316
|
-
|
|
330
|
+
The deployment package excludes application `devDependencies` and project `.env` values. Supply real secrets through the deployment environment.
|
|
331
|
+
|
|
332
|
+
For a package with a generated production lockfile:
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
cd .bcp-framework/package
|
|
336
|
+
npm ci --omit=dev
|
|
337
|
+
npm start
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
If the package manifest reports that no lockfile was included, use the install command recorded in `bcp.package.json`.
|
|
341
|
+
|
|
342
|
+
## Project generators after creation
|
|
317
343
|
|
|
318
344
|
```bash
|
|
319
345
|
npm run generate -- page dashboard/users
|
|
@@ -368,5 +394,5 @@ npx create-bcp-app my-app --yes
|
|
|
368
394
|
The `--bcp` option is mainly for prerelease/local package verification:
|
|
369
395
|
|
|
370
396
|
```bash
|
|
371
|
-
npx create-bcp-app my-app --bcp file:../chidchanun-bcp-0.2.
|
|
397
|
+
npx create-bcp-app my-app --bcp file:../chidchanun-bcp-0.2.5.tgz
|
|
372
398
|
```
|
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
|
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
|
|
|
@@ -38,9 +39,37 @@ It records non-secret scaffold choices such as Tailwind, database, authenticatio
|
|
|
38
39
|
|
|
39
40
|
Commit this file with the project. Do not put passwords, access keys, session secrets or tokens in it.
|
|
40
41
|
|
|
42
|
+
## Authentication — BCP 0.2.5+
|
|
43
|
+
|
|
44
|
+
Projects created with the `JWT Cookie` preset remain stateless by default and use the generated `lib/auth.ts` helpers.
|
|
45
|
+
|
|
46
|
+
BCP Authentication Platform v2 can opt into revocable server-side session state:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import {
|
|
50
|
+
createAuth,
|
|
51
|
+
createMemoryAuthSessionStore,
|
|
52
|
+
} from "bcp/auth";
|
|
53
|
+
|
|
54
|
+
const sessionStore =
|
|
55
|
+
createMemoryAuthSessionStore();
|
|
56
|
+
|
|
57
|
+
export const appAuth =
|
|
58
|
+
createAuth({
|
|
59
|
+
store:
|
|
60
|
+
sessionStore,
|
|
61
|
+
idleTimeout:
|
|
62
|
+
60 * 30,
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The memory store is intended for local development/tests. Use a shared durable `AuthSessionStore` implementation for multi-process or multi-container production deployments.
|
|
67
|
+
|
|
68
|
+
Authentication Platform v2 also provides session revocation, `logoutAll()`, rotation with revocation, and `createGuestGuard()` for guest-only pages such as login/register routes.
|
|
69
|
+
|
|
41
70
|
## Generate framework files
|
|
42
71
|
|
|
43
|
-
BCP
|
|
72
|
+
BCP can generate common project files:
|
|
44
73
|
|
|
45
74
|
```bash
|
|
46
75
|
npm run generate -- page dashboard/users
|
|
@@ -80,6 +109,7 @@ npm exec -- bcp-framework generate page dashboard/users
|
|
|
80
109
|
npm exec -- bcp-framework routes
|
|
81
110
|
npm exec -- bcp-framework dev
|
|
82
111
|
npm exec -- bcp-framework build
|
|
112
|
+
npm exec -- bcp-framework package
|
|
83
113
|
```
|
|
84
114
|
|
|
85
115
|
You can also execute the Windows command shim explicitly:
|
|
@@ -115,9 +145,9 @@ npm exec -- bcp-framework inspect --json
|
|
|
115
145
|
|
|
116
146
|
Doctor checks common project/runtime problems while Inspect shows the resolved configuration, routes, dependencies and project metadata BCP sees.
|
|
117
147
|
|
|
118
|
-
## Production
|
|
148
|
+
## Production build
|
|
119
149
|
|
|
120
|
-
Create the standalone production build:
|
|
150
|
+
Create the raw standalone production build:
|
|
121
151
|
|
|
122
152
|
```bash
|
|
123
153
|
npm run build
|
|
@@ -130,3 +160,31 @@ npm start
|
|
|
130
160
|
```
|
|
131
161
|
|
|
132
162
|
The production build is written to `.bcp-framework/build` and runs as a standalone Node.js server.
|
|
163
|
+
|
|
164
|
+
## Deployment package — BCP 0.2.4+
|
|
165
|
+
|
|
166
|
+
Create a fresh production build and deployment-oriented package:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npm run package
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The output is written to:
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
.bcp-framework/package/
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
It contains the standalone client/server output, a production-only dependency manifest, deployment/environment metadata, file integrity hashes and a starter Dockerfile.
|
|
179
|
+
|
|
180
|
+
BCP intentionally excludes project `.env` files and application `devDependencies` from the deployment package. Provide secrets through your deployment environment.
|
|
181
|
+
|
|
182
|
+
For a package with a generated production lockfile:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
cd .bcp-framework/package
|
|
186
|
+
npm ci --omit=dev
|
|
187
|
+
npm start
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
If `bcp.package.json` reports that no lockfile was included, use the install command recorded in that manifest instead.
|