Skip to content

Commit ee8d722

Browse files
authored
Revert "add generated .medusa/types to local plugins (medusajs#13777)" (medusajs#14361)
This reverts commit 1256946.
1 parent 181d5fa commit ee8d722

File tree

2 files changed

+17
-31
lines changed

2 files changed

+17
-31
lines changed

.changeset/wise-feet-peel.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/medusa/src/commands/start.ts

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
dynamicImport,
1212
FileSystem,
1313
generateContainerTypes,
14-
getResolvedPlugins,
1514
gqlSchemaToTypes,
1615
GracefulShutdownServer,
1716
isFileSkipped,
@@ -273,36 +272,28 @@ async function start(args: {
273272
})
274273

275274
if (generateTypes) {
276-
const configModule = container.resolve(
277-
ContainerRegistrationKeys.CONFIG_MODULE
278-
)
279-
const localPlugins = (await getResolvedPlugins(directory, configModule, true))
280-
.filter((p) => p.admin?.type === "local")
275+
const typesDirectory = path.join(directory, ".medusa/types")
281276

282-
for (const plugin of localPlugins) {
283-
const typesDirectory = path.join(plugin.admin!.resolve, "../../.medusa/types")
277+
/**
278+
* Cleanup existing types directory before creating new artifacts
279+
*/
280+
await new FileSystem(typesDirectory).cleanup({ recursive: true })
284281

285-
/**
286-
* Cleanup existing types directory before creating new artifacts
287-
*/
288-
await new FileSystem(typesDirectory).cleanup({ recursive: true })
282+
await generateContainerTypes(modules, {
283+
outputDir: typesDirectory,
284+
interfaceName: "ModuleImplementations",
285+
})
286+
logger.debug("Generated container types")
289287

290-
await generateContainerTypes(modules, {
288+
if (gqlSchema) {
289+
await gqlSchemaToTypes({
291290
outputDir: typesDirectory,
292-
interfaceName: "ModuleImplementations",
291+
filename: "query-entry-points",
292+
interfaceName: "RemoteQueryEntryPoints",
293+
schema: gqlSchema,
294+
joinerConfigs: MedusaModule.getAllJoinerConfigs(),
293295
})
294-
logger.debug("Generated container types")
295-
296-
if (gqlSchema) {
297-
await gqlSchemaToTypes({
298-
outputDir: typesDirectory,
299-
filename: "query-entry-points",
300-
interfaceName: "RemoteQueryEntryPoints",
301-
schema: gqlSchema,
302-
joinerConfigs: MedusaModule.getAllJoinerConfigs(),
303-
})
304-
logger.debug("Generated modules types")
305-
}
296+
logger.debug("Generated modules types")
306297
}
307298
}
308299

0 commit comments

Comments
 (0)