@strav/cli 0.4.30 → 0.4.31
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/package.json +6 -6
- package/src/cli/bootstrap.ts +12 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strav/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI framework and code generators for the Strav framework",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"strav": "./src/cli/strav.ts"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@strav/kernel": "0.4.
|
|
38
|
-
"@strav/http": "0.4.
|
|
39
|
-
"@strav/database": "0.4.
|
|
40
|
-
"@strav/queue": "0.4.
|
|
41
|
-
"@strav/signal": "0.4.
|
|
37
|
+
"@strav/kernel": "0.4.31",
|
|
38
|
+
"@strav/http": "0.4.31",
|
|
39
|
+
"@strav/database": "0.4.31",
|
|
40
|
+
"@strav/queue": "0.4.31",
|
|
41
|
+
"@strav/signal": "0.4.31"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"chalk": "^5.6.2",
|
package/src/cli/bootstrap.ts
CHANGED
|
@@ -2,7 +2,7 @@ import Configuration from '@strav/kernel/config/configuration'
|
|
|
2
2
|
import Database from '@strav/database/database/database'
|
|
3
3
|
import SchemaRegistry from '@strav/database/schema/registry'
|
|
4
4
|
import DatabaseIntrospector from '@strav/database/database/introspector'
|
|
5
|
-
import Application from '@strav/kernel/core/application'
|
|
5
|
+
import Application, { app } from '@strav/kernel/core/application'
|
|
6
6
|
import type ServiceProvider from '@strav/kernel/core/service_provider'
|
|
7
7
|
import { getDatabasePaths } from '../config/loader.ts'
|
|
8
8
|
|
|
@@ -52,12 +52,18 @@ export interface WithProvidersOptions {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
* Bootstrap
|
|
55
|
+
* Bootstrap the global Application with the given service providers.
|
|
56
56
|
*
|
|
57
|
-
*
|
|
58
|
-
* in dependency order, and returns
|
|
59
|
-
*
|
|
60
|
-
*
|
|
57
|
+
* Registers all providers on the global `app` singleton from `@strav/kernel`,
|
|
58
|
+
* boots them in dependency order, and returns it. Signal handlers for
|
|
59
|
+
* graceful shutdown are installed automatically unless `options.signalHandlers`
|
|
60
|
+
* is `false`.
|
|
61
|
+
*
|
|
62
|
+
* The global singleton is intentional: handler code (queue handlers, scheduled
|
|
63
|
+
* tasks, route handlers, etc.) commonly imports `app` from `@strav/kernel` to
|
|
64
|
+
* resolve services. A separate Application instance here would leave that
|
|
65
|
+
* singleton's container empty and cause `app.resolve(X)` to throw at runtime —
|
|
66
|
+
* a silent failure mode for queue workers in particular.
|
|
61
67
|
*
|
|
62
68
|
* @example
|
|
63
69
|
* const app = await withProviders([
|
|
@@ -70,7 +76,6 @@ export async function withProviders(
|
|
|
70
76
|
providers: ServiceProvider[],
|
|
71
77
|
options?: WithProvidersOptions,
|
|
72
78
|
): Promise<Application> {
|
|
73
|
-
const app = new Application()
|
|
74
79
|
for (const provider of providers) app.use(provider)
|
|
75
80
|
await app.start(options)
|
|
76
81
|
return app
|