@@ -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