chore(framework): Allow multiple source dir for subcribers loader (#8407)
* chore(framework): Allow multiple source dir for subcribers loader * re add log * add logs
This commit is contained in:
@@ -40,23 +40,15 @@ const shouldLoadBackgroundProcessors = (configModule) => {
|
||||
}
|
||||
|
||||
async function subscribersLoader(plugins: PluginDetails[]) {
|
||||
/**
|
||||
* Load subscribers from the medusa/medusa package
|
||||
*/
|
||||
await new SubscriberLoader(join(__dirname, "../subscribers")).load()
|
||||
const pluginSubscribersSourcePaths = [
|
||||
/**
|
||||
* Load subscribers from the medusa/medusa package. Remove once the medusa core is converted to a plugin
|
||||
*/
|
||||
join(__dirname, "../subscribers"),
|
||||
].concat(plugins.map((plugin) => join(plugin.resolve, "subscribers")))
|
||||
|
||||
// TODO: make it the same as the other loaders, taking an array of paths to load from
|
||||
/**
|
||||
* Load subscribers from all the plugins.
|
||||
*/
|
||||
await Promise.all(
|
||||
plugins.map(async (pluginDetails) => {
|
||||
await new SubscriberLoader(
|
||||
join(pluginDetails.resolve, "subscribers"),
|
||||
pluginDetails.options
|
||||
).load()
|
||||
})
|
||||
)
|
||||
const subscriberLoader = new SubscriberLoader(pluginSubscribersSourcePaths)
|
||||
await subscriberLoader.load()
|
||||
}
|
||||
|
||||
async function jobsLoader(plugins: PluginDetails[]) {
|
||||
|
||||
Reference in New Issue
Block a user