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
|
const products = response.data.created
|
||||||
|
|
||||||
await setTimeout(4000)
|
await setTimeout(10000)
|
||||||
|
|
||||||
return products
|
return products
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
import { ExecArgs } from "@medusajs/framework/types"
|
import { ExecArgs } from "@medusajs/framework/types"
|
||||||
import {
|
import { ContainerRegistrationKeys, dynamicImport, isFileSkipped, } from "@medusajs/framework/utils"
|
||||||
ContainerRegistrationKeys,
|
|
||||||
dynamicImport,
|
|
||||||
isFileSkipped,
|
|
||||||
} from "@medusajs/framework/utils"
|
|
||||||
import express from "express"
|
import express from "express"
|
||||||
import { existsSync } from "fs"
|
import { existsSync } from "fs"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
@@ -47,6 +43,7 @@ export default async function exec({ file, args }: Options) {
|
|||||||
const { container } = await loaders({
|
const { container } = await loaders({
|
||||||
directory,
|
directory,
|
||||||
expressApp: app,
|
expressApp: app,
|
||||||
|
skipLoadingEntryPoints: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
const scriptParams: ExecArgs = {
|
const scriptParams: ExecArgs = {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export default async function ({
|
|||||||
const { container } = await loaders({
|
const { container } = await loaders({
|
||||||
directory,
|
directory,
|
||||||
expressApp: app,
|
expressApp: app,
|
||||||
|
skipLoadingEntryPoints: true,
|
||||||
})
|
})
|
||||||
const logger = container.resolve(ContainerRegistrationKeys.LOGGER)
|
const logger = container.resolve(ContainerRegistrationKeys.LOGGER)
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import apiLoader from "./api"
|
|||||||
type Options = {
|
type Options = {
|
||||||
directory: string
|
directory: string
|
||||||
expressApp: Express
|
expressApp: Express
|
||||||
|
skipLoadingEntryPoints?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const isWorkerMode = (configModule) => {
|
const isWorkerMode = (configModule) => {
|
||||||
@@ -71,7 +72,7 @@ async function jobsLoader(
|
|||||||
) {
|
) {
|
||||||
const pluginJobSourcePaths = [
|
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"),
|
join(__dirname, "../jobs"),
|
||||||
].concat(plugins.map((plugin) => join(plugin.resolve, "jobs")))
|
].concat(plugins.map((plugin) => join(plugin.resolve, "jobs")))
|
||||||
@@ -161,6 +162,7 @@ export async function initializeContainer(
|
|||||||
export default async ({
|
export default async ({
|
||||||
directory: rootDirectory,
|
directory: rootDirectory,
|
||||||
expressApp,
|
expressApp,
|
||||||
|
skipLoadingEntryPoints = false,
|
||||||
}: Options): Promise<{
|
}: Options): Promise<{
|
||||||
container: MedusaContainer
|
container: MedusaContainer
|
||||||
app: Express
|
app: Express
|
||||||
@@ -198,12 +200,9 @@ export default async ({
|
|||||||
const workflowLoader = new WorkflowLoader(workflowsSourcePaths, container)
|
const workflowLoader = new WorkflowLoader(workflowsSourcePaths, container)
|
||||||
await workflowLoader.load()
|
await workflowLoader.load()
|
||||||
|
|
||||||
const entrypointsShutdown = await loadEntrypoints(
|
const entrypointsShutdown = skipLoadingEntryPoints
|
||||||
plugins,
|
? () => {}
|
||||||
container,
|
: await loadEntrypoints(plugins, container, expressApp, rootDirectory)
|
||||||
expressApp,
|
|
||||||
rootDirectory
|
|
||||||
)
|
|
||||||
|
|
||||||
const { createDefaultsWorkflow } = await import("@medusajs/core-flows")
|
const { createDefaultsWorkflow } = await import("@medusajs/core-flows")
|
||||||
await createDefaultsWorkflow(container).run()
|
await createDefaultsWorkflow(container).run()
|
||||||
|
|||||||
Reference in New Issue
Block a user