- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.8k
 
feat(medusa): add generated .medusa/types to local plugins #13777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
          🦋 Changeset detectedLatest commit: 68ac53e The changes in this PR will be included in the next version bump. This PR includes changesets to release 74 packages
 Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR  | 
    
| 
           @leobenzol is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrien2p wdyt?
| 
           hey @leobenzol, just want to be sure I understand the needs correctly, did you face this needs in the following context? 
 is the comprehension correct?  | 
    
| 
           @adrien2p the module would be from the plugin itself. So you create a new plugin -> add module to the plugin -> use query.graph in a http route/workflow in the plugin. Unless I'm missing something there isnt currently a way to generate types inside plugins, which makes sense since they dont have access to a medusa container without a project to run in. That's why for the PR I had to copy the type definitions from the main project(which also generates types for plugins added with plugin:develop)  | 
    
          
 yeah Understood, just thinking about something, have you tried to configure medusa-config in your plugin (setting up the plugin itself as well) and run yarn build?  | 
    
| 
           @adrien2p yeah that would work, it'd be pretty much the same as what i do already for integration tests. But I thought it'd be nice to have them update automatically when a file changes and the server restarts, like it happens in the main project.  | 
    
Summary
What
Copies the generated types inside
.medusa/typesto all "local" plugins(i.e plugins added with plugin:develop)Why
Currently the only way to get type support for
query.graphetc inside plugins is to manually copy the .medusa/types folder from the main project, this is clunky and prone to confusion if you forget to paste the changed types after editing a model.How
Changed the type generation to a loop over all "local" plugins, detected as plugins with a local admin type(which includes the main project's "local plugin")
Testing
Local testing
Checklist
Please ensure the following before requesting a review:
yarn changesetand follow the prompts