This reverts commit 125694626e.
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"@medusajs/medusa": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
feat(medusa): add generated .medusa/types to local plugins
|
|
||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
dynamicImport,
|
dynamicImport,
|
||||||
FileSystem,
|
FileSystem,
|
||||||
generateContainerTypes,
|
generateContainerTypes,
|
||||||
getResolvedPlugins,
|
|
||||||
gqlSchemaToTypes,
|
gqlSchemaToTypes,
|
||||||
GracefulShutdownServer,
|
GracefulShutdownServer,
|
||||||
isFileSkipped,
|
isFileSkipped,
|
||||||
@@ -273,36 +272,28 @@ async function start(args: {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (generateTypes) {
|
if (generateTypes) {
|
||||||
const configModule = container.resolve(
|
const typesDirectory = path.join(directory, ".medusa/types")
|
||||||
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
|
||||||
|
*/
|
||||||
|
await new FileSystem(typesDirectory).cleanup({ recursive: true })
|
||||||
|
|
||||||
/**
|
await generateContainerTypes(modules, {
|
||||||
* Cleanup existing types directory before creating new artifacts
|
outputDir: typesDirectory,
|
||||||
*/
|
interfaceName: "ModuleImplementations",
|
||||||
await new FileSystem(typesDirectory).cleanup({ recursive: true })
|
})
|
||||||
|
logger.debug("Generated container types")
|
||||||
|
|
||||||
await generateContainerTypes(modules, {
|
if (gqlSchema) {
|
||||||
|
await gqlSchemaToTypes({
|
||||||
outputDir: typesDirectory,
|
outputDir: typesDirectory,
|
||||||
interfaceName: "ModuleImplementations",
|
filename: "query-entry-points",
|
||||||
|
interfaceName: "RemoteQueryEntryPoints",
|
||||||
|
schema: gqlSchema,
|
||||||
|
joinerConfigs: MedusaModule.getAllJoinerConfigs(),
|
||||||
})
|
})
|
||||||
logger.debug("Generated container types")
|
logger.debug("Generated modules types")
|
||||||
|
|
||||||
if (gqlSchema) {
|
|
||||||
await gqlSchemaToTypes({
|
|
||||||
outputDir: typesDirectory,
|
|
||||||
filename: "query-entry-points",
|
|
||||||
interfaceName: "RemoteQueryEntryPoints",
|
|
||||||
schema: gqlSchema,
|
|
||||||
joinerConfigs: MedusaModule.getAllJoinerConfigs(),
|
|
||||||
})
|
|
||||||
logger.debug("Generated modules types")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user