medusa icon indicating copy to clipboard operation
medusa copied to clipboard

chore(): Autoload module resources

Open adrien2p opened this issue 1 year ago • 2 comments

What

  • automatically build and consume connection and container loader if not exported by the module
  • therefore load the services and repositories automatically, including baseRepository
  • automatically build run and revert migrations if not provided
  • cleaup modules to remove extra unnecessary bits and pieces

Should drastically improve the module building DX by removing a lot of boilerplate to handle by the user, that plus the base entity should simplify quite a lot the flow cc @shahednasser

Note I had to choose a way to identify connection and container loader from the exported loader from the module. I decided to go with named function connectionLoader and containerLoader, also, now the factories will return named function so if the user use the factories we are providing to build those loaders, the function will also be named and identified

adrien2p avatar May 10 '24 10:05 adrien2p

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference 🔄 Building (Inspect) Visit Preview 💬 Add feedback May 13, 2024 10:52am
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2024 10:52am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
docs-ui ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 10:52am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview May 13, 2024 10:52am

vercel[bot] avatar May 10 '24 10:05 vercel[bot]

⚠️ No Changeset found

Latest commit: aa9aa3ba744b20a2887bb153b752462bfff72603

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar May 10 '24 10:05 changeset-bot[bot]

Next up is the module service boilerplate 😉

olivermrbl avatar May 12 '24 08:05 olivermrbl

Next up is the module service boilerplate 😉

Yes, it will be the last one, then only the custom loaders will remain to export if you have any. This is because we need to keep the order in which they are exported as it might have an impact. Maybe we can think of something there too 👍

adrien2p avatar May 12 '24 08:05 adrien2p

@olivermrbl should be good to re review if you want 👍

adrien2p avatar May 13 '24 11:05 adrien2p

Will do!

olivermrbl avatar May 13 '24 11:05 olivermrbl

@shahednasser just for info it is merged now

adrien2p avatar May 13 '24 12:05 adrien2p