add generated .medusa/types to local plugins (#13777)
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
This commit is contained in:
co-authored by
Adrien de Peretti
parent
fb11f0f272
commit
125694626e
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/medusa": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
feat(medusa): add generated .medusa/types to local plugins
|
||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
dynamicImport,
|
dynamicImport,
|
||||||
FileSystem,
|
FileSystem,
|
||||||
generateContainerTypes,
|
generateContainerTypes,
|
||||||
|
getResolvedPlugins,
|
||||||
gqlSchemaToTypes,
|
gqlSchemaToTypes,
|
||||||
GracefulShutdownServer,
|
GracefulShutdownServer,
|
||||||
isFileSkipped,
|
isFileSkipped,
|
||||||
@@ -272,7 +273,14 @@ async function start(args: {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (generateTypes) {
|
if (generateTypes) {
|
||||||
const typesDirectory = path.join(directory, ".medusa/types")
|
const configModule = container.resolve(
|
||||||
|
ContainerRegistrationKeys.CONFIG_MODULE
|
||||||
|
)
|
||||||
|
const localPlugins = (await getResolvedPlugins(directory, configModule, true))
|
||||||
|
.filter((p) => p.admin?.type === "local")
|
||||||
|
|
||||||
|
for (const plugin of localPlugins) {
|
||||||
|
const typesDirectory = path.join(plugin.admin!.resolve, "../../.medusa/types")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup existing types directory before creating new artifacts
|
* Cleanup existing types directory before creating new artifacts
|
||||||
@@ -296,6 +304,7 @@ async function start(args: {
|
|||||||
logger.debug("Generated modules types")
|
logger.debug("Generated modules types")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Register a health check endpoint. Ideally this also checks the readiness of the service, rather than just returning a static response.
|
// Register a health check endpoint. Ideally this also checks the readiness of the service, rather than just returning a static response.
|
||||||
app.get("/health", (_, res) => {
|
app.get("/health", (_, res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user