create-bcp-app 0.2.14 → 0.2.15
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 +57 -4
- package/package.json +1 -1
- package/template/README.md +45 -1
package/README.md
CHANGED
|
@@ -69,17 +69,17 @@ Select storage provider:
|
|
|
69
69
|
|
|
70
70
|
New projects include `bcp.project.json`.
|
|
71
71
|
|
|
72
|
-
Example for the `0.2.
|
|
72
|
+
Example for the `0.2.15` target:
|
|
73
73
|
|
|
74
74
|
```json
|
|
75
75
|
{
|
|
76
76
|
"schemaVersion": 1,
|
|
77
77
|
"framework": "bcp",
|
|
78
78
|
"projectName": "my-app",
|
|
79
|
-
"frameworkPackage": "npm:@chidchanun/bcp@0.2.
|
|
79
|
+
"frameworkPackage": "npm:@chidchanun/bcp@0.2.15",
|
|
80
80
|
"createdWith": {
|
|
81
81
|
"package": "create-bcp-app",
|
|
82
|
-
"version": "0.2.
|
|
82
|
+
"version": "0.2.15"
|
|
83
83
|
},
|
|
84
84
|
"packageManager": "npm",
|
|
85
85
|
"presets": {
|
|
@@ -314,6 +314,59 @@ runTestMiddleware()
|
|
|
314
314
|
|
|
315
315
|
`bcp/testing` is server-only. It can be used with Node `node:test`, Vitest, Jest or another runner; BCP does not install those runners as framework dependencies.
|
|
316
316
|
|
|
317
|
+
## Plugin & Module Platform — 0.2.15+
|
|
318
|
+
|
|
319
|
+
Use `bcp/plugins` to compose reusable server-side application modules with explicit lifecycle and dependencies.
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
import {
|
|
323
|
+
createPluginHost,
|
|
324
|
+
defineModule,
|
|
325
|
+
definePlugin,
|
|
326
|
+
} from "bcp/plugins";
|
|
327
|
+
|
|
328
|
+
const databasePlugin =
|
|
329
|
+
definePlugin({
|
|
330
|
+
name: "database",
|
|
331
|
+
setup(context) {
|
|
332
|
+
context.services.provide(
|
|
333
|
+
"database",
|
|
334
|
+
db
|
|
335
|
+
);
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
const jobsPlugin =
|
|
340
|
+
definePlugin({
|
|
341
|
+
name: "jobs",
|
|
342
|
+
requires: [
|
|
343
|
+
"database",
|
|
344
|
+
],
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
const backendModule =
|
|
348
|
+
defineModule({
|
|
349
|
+
name: "backend",
|
|
350
|
+
plugins: [
|
|
351
|
+
databasePlugin,
|
|
352
|
+
jobsPlugin,
|
|
353
|
+
],
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
const host =
|
|
357
|
+
createPluginHost({
|
|
358
|
+
modules: [
|
|
359
|
+
backendModule,
|
|
360
|
+
],
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
await host.start();
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Plugins can use `setup/start/stop/dispose`, typed config parsers, a shared service registry and an awaited in-process hook bus. Required dependencies start first; shutdown runs in reverse order.
|
|
367
|
+
|
|
368
|
+
`bcp/plugins` is server-only and cannot be imported into page/client bundles.
|
|
369
|
+
|
|
317
370
|
## Storage providers
|
|
318
371
|
|
|
319
372
|
Supported presets are Local Server, Amazon S3 and Cloudflare R2. Storage credentials are server-only and must not use `BCP_PUBLIC_*` variables.
|
|
@@ -352,5 +405,5 @@ npm run generate -- migration create_users
|
|
|
352
405
|
For prerelease/local package verification:
|
|
353
406
|
|
|
354
407
|
```bash
|
|
355
|
-
npx create-bcp-app my-app --bcp file:../chidchanun-bcp-0.2.
|
|
408
|
+
npx create-bcp-app my-app --bcp file:../chidchanun-bcp-0.2.15.tgz
|
|
356
409
|
```
|
package/package.json
CHANGED
package/template/README.md
CHANGED
|
@@ -240,10 +240,54 @@ await withTestTransaction(
|
|
|
240
240
|
);
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
Additional helpers include job/workflow/outbox harnesses, `runTestMiddleware()`, fake clocks and IDs, a fake `RealtimeSocket`, realtime event assertions and `readSseEvents()`.
|
|
243
|
+
Additional helpers include job/workflow/outbox harnesses, `runTestMiddleware()`, page loader/guard/action helpers, fake clocks and IDs, a fake `RealtimeSocket`, realtime event assertions and `readSseEvents()`.
|
|
244
244
|
|
|
245
245
|
BCP does not require Jest or Vitest; these helpers work with Node `node:test` or another runner.
|
|
246
246
|
|
|
247
|
+
## Plugin & Module Platform — BCP 0.2.15+
|
|
248
|
+
|
|
249
|
+
Use `bcp/plugins` to compose reusable server-only application services with explicit dependencies.
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
import {
|
|
253
|
+
createPluginHost,
|
|
254
|
+
definePlugin,
|
|
255
|
+
} from "bcp/plugins";
|
|
256
|
+
|
|
257
|
+
const databasePlugin =
|
|
258
|
+
definePlugin({
|
|
259
|
+
name: "database",
|
|
260
|
+
setup(context) {
|
|
261
|
+
context.services.provide(
|
|
262
|
+
"database",
|
|
263
|
+
db
|
|
264
|
+
);
|
|
265
|
+
},
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
const jobsPlugin =
|
|
269
|
+
definePlugin({
|
|
270
|
+
name: "jobs",
|
|
271
|
+
requires: [
|
|
272
|
+
"database",
|
|
273
|
+
],
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
export const plugins =
|
|
277
|
+
createPluginHost({
|
|
278
|
+
plugins: [
|
|
279
|
+
jobsPlugin,
|
|
280
|
+
databasePlugin,
|
|
281
|
+
],
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Plugin startup follows dependency order and shutdown reverses it. Plugins can use `setup/start/stop/dispose`, config parsers, shared services and async hooks.
|
|
286
|
+
|
|
287
|
+
Use `defineModule()` when a reusable package needs to bundle multiple plugin definitions into one named module.
|
|
288
|
+
|
|
289
|
+
`bcp/plugins` is server-only and cannot be imported from page/client bundles.
|
|
290
|
+
|
|
247
291
|
## Generate framework files
|
|
248
292
|
|
|
249
293
|
```bash
|