feat(medusa-app): Link initialization should respect migrationOnly flag (#14493)

* feat(medusa-app): Link initialization should respect migrationOnly flag

* Create cyan-taxis-behave.md
This commit is contained in:
Adrien de Peretti
2026-01-08 15:13:32 +01:00
committed by GitHub
parent 568742826f
commit bb599a26de
4 changed files with 17 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@medusajs/link-modules": patch
"@medusajs/modules-sdk": patch
---
feat(medusa-app): Link initialization should respect migrationOnly flag

View File

@@ -204,6 +204,7 @@ async function initializeLinks({
linkModules,
injectedDependencies,
moduleExports,
migrationOnly = false,
}) {
try {
let resources = moduleExports
@@ -220,7 +221,9 @@ async function initializeLinks({
const linkResolution = await initialize(
config,
linkModules,
injectedDependencies
injectedDependencies,
undefined,
migrationOnly
)
return {
@@ -488,6 +491,7 @@ async function MedusaApp_({
linkModules,
injectedDependencies,
moduleExports: isMedusaModule(linkModule) ? linkModule : undefined,
migrationOnly,
})
const loadedSchema = getLoadedSchema()

View File

@@ -90,6 +90,7 @@ export type LinkModuleBootstrapOptions = {
moduleExports?: ModuleExports
injectedDependencies?: Record<string, any>
cwd?: string
migrationOnly?: boolean
}
export type RegisterModuleJoinerConfig =
@@ -652,6 +653,7 @@ class MedusaModule {
moduleExports,
injectedDependencies,
cwd,
migrationOnly,
}: LinkModuleBootstrapOptions): Promise<{
[key: string]: unknown
}> {
@@ -720,6 +722,7 @@ class MedusaModule {
await moduleLoader({
container,
moduleResolutions,
migrationOnly,
logger: logger_,
})
} catch (err) {

View File

@@ -34,7 +34,8 @@ export const initialize = async (
| InternalModuleDeclaration,
pluginLinksDefinitions?: ModuleJoinerConfig[],
injectedDependencies?: InitializeModuleInjectableDependencies,
cwd?: string
cwd?: string,
migrationOnly?: boolean
): Promise<{ [link: string]: ILinkModule }> => {
const allLinks = {}
const modulesLoadedKeys = MedusaModule.getLoadedModules().map(
@@ -170,6 +171,7 @@ export const initialize = async (
moduleExports: moduleDefinition,
injectedDependencies,
cwd,
migrationOnly,
})
allLinks[serviceKey as string] = Object.values(loaded)[0]