feat(): Auto generated types generation upon build (#14337)
* feat(): Auto generated types generation upon build * Create happy-steaks-cheer.md * test(): default types true * improvements * improvements * improvements * improvements * improvements
This commit is contained in:
committed by
GitHub
parent
125694626e
commit
181d5fa671
@@ -310,13 +310,18 @@ export class MedusaAppLoader {
|
||||
* Load all modules and bootstrap all the modules and links to be ready to be consumed
|
||||
* @param config
|
||||
*/
|
||||
async load(config = { registerInContainer: true }): Promise<MedusaAppOutput> {
|
||||
async load(
|
||||
config: { registerInContainer?: boolean; migrationOnly?: boolean } = {
|
||||
registerInContainer: true,
|
||||
migrationOnly: false,
|
||||
}
|
||||
): Promise<MedusaAppOutput> {
|
||||
const configModule: ConfigModule = this.#container.resolve(
|
||||
ContainerRegistrationKeys.CONFIG_MODULE
|
||||
)
|
||||
|
||||
const { sharedResourcesConfig, injectedDependencies } =
|
||||
this.prepareSharedResourcesAndDeps()
|
||||
!config.migrationOnly ? this.prepareSharedResourcesAndDeps() : {}
|
||||
|
||||
this.#container.register(
|
||||
ContainerRegistrationKeys.REMOTE_QUERY,
|
||||
@@ -343,6 +348,7 @@ export class MedusaAppLoader {
|
||||
injectedDependencies,
|
||||
medusaConfigPath: this.#medusaConfigPath,
|
||||
cwd: this.#cwd,
|
||||
migrationOnly: config.migrationOnly,
|
||||
})
|
||||
|
||||
if (!config.registerInContainer) {
|
||||
|
||||
@@ -308,6 +308,11 @@ export type MedusaAppOptions = {
|
||||
* Forces the modules bootstrapper to only run the modules loaders and return prematurely
|
||||
*/
|
||||
loaderOnly?: boolean
|
||||
/**
|
||||
* Only partially load modules to retrieve their joiner configs without running loaders.
|
||||
* Useful for type generation and migrations.
|
||||
*/
|
||||
migrationOnly?: boolean
|
||||
cwd?: string
|
||||
}
|
||||
|
||||
@@ -325,9 +330,7 @@ async function MedusaApp_({
|
||||
loaderOnly = false,
|
||||
workerMode = "shared",
|
||||
cwd = process.cwd(),
|
||||
}: MedusaAppOptions & {
|
||||
migrationOnly?: boolean
|
||||
} = {}): Promise<MedusaAppOutput> {
|
||||
}: MedusaAppOptions = {}): Promise<MedusaAppOutput> {
|
||||
const sharedContainer_ = createMedusaContainer({}, sharedContainer)
|
||||
|
||||
const config = sharedContainer_.resolve(
|
||||
|
||||
Reference in New Issue
Block a user