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:
Adrien de Peretti
2024-08-02 13:55:48 +02:00
committed by GitHub
parent afa740606f
commit e44332ba62
5 changed files with 29 additions and 30 deletions
+8 -16
View File
@@ -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[]) {