fix(medusa): stop loading entry points in exec command (#13438)
This commit is contained in:
5
.changeset/tough-poets-shop.md
Normal file
5
.changeset/tough-poets-shop.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
"fix(medusa): stop loading entry points in exec command
|
||||
@@ -91,7 +91,7 @@ async function populateData(api: any) {
|
||||
)
|
||||
const products = response.data.created
|
||||
|
||||
await setTimeout(4000)
|
||||
await setTimeout(10000)
|
||||
|
||||
return products
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { ExecArgs } from "@medusajs/framework/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
dynamicImport,
|
||||
isFileSkipped,
|
||||
} from "@medusajs/framework/utils"
|
||||
import { ContainerRegistrationKeys, dynamicImport, isFileSkipped, } from "@medusajs/framework/utils"
|
||||
import express from "express"
|
||||
import { existsSync } from "fs"
|
||||
import path from "path"
|
||||
@@ -47,6 +43,7 @@ export default async function exec({ file, args }: Options) {
|
||||
const { container } = await loaders({
|
||||
directory,
|
||||
expressApp: app,
|
||||
skipLoadingEntryPoints: true,
|
||||
})
|
||||
|
||||
const scriptParams: ExecArgs = {
|
||||
|
||||
@@ -23,6 +23,7 @@ export default async function ({
|
||||
const { container } = await loaders({
|
||||
directory,
|
||||
expressApp: app,
|
||||
skipLoadingEntryPoints: true,
|
||||
})
|
||||
const logger = container.resolve(ContainerRegistrationKeys.LOGGER)
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import apiLoader from "./api"
|
||||
type Options = {
|
||||
directory: string
|
||||
expressApp: Express
|
||||
skipLoadingEntryPoints?: boolean
|
||||
}
|
||||
|
||||
const isWorkerMode = (configModule) => {
|
||||
@@ -71,7 +72,7 @@ async function jobsLoader(
|
||||
) {
|
||||
const pluginJobSourcePaths = [
|
||||
/**
|
||||
* Load jobs from the medusa/medusa package. Remove once the medusa core is converted to a plugin
|
||||
* Load jobs from the medusa/medusa package. Remove once the medusa core is converted to a plugin
|
||||
*/
|
||||
join(__dirname, "../jobs"),
|
||||
].concat(plugins.map((plugin) => join(plugin.resolve, "jobs")))
|
||||
@@ -161,6 +162,7 @@ export async function initializeContainer(
|
||||
export default async ({
|
||||
directory: rootDirectory,
|
||||
expressApp,
|
||||
skipLoadingEntryPoints = false,
|
||||
}: Options): Promise<{
|
||||
container: MedusaContainer
|
||||
app: Express
|
||||
@@ -198,12 +200,9 @@ export default async ({
|
||||
const workflowLoader = new WorkflowLoader(workflowsSourcePaths, container)
|
||||
await workflowLoader.load()
|
||||
|
||||
const entrypointsShutdown = await loadEntrypoints(
|
||||
plugins,
|
||||
container,
|
||||
expressApp,
|
||||
rootDirectory
|
||||
)
|
||||
const entrypointsShutdown = skipLoadingEntryPoints
|
||||
? () => {}
|
||||
: await loadEntrypoints(plugins, container, expressApp, rootDirectory)
|
||||
|
||||
const { createDefaultsWorkflow } = await import("@medusajs/core-flows")
|
||||
await createDefaultsWorkflow(container).run()
|
||||
|
||||
Reference in New Issue
Block a user