v2.0.0-rc.3
版本发布时间: 2024-10-14 17:00:50
medusajs/medusa最新发布版本:v2.0.1(2024-10-25 23:24:21)
Get started with a new project
To get started using the RC, run the following command:
npx create-medusa-app@rc
This command will create a new Medusa project with our redesigned admin and a 2.0-compatible Next.js storefront. The Medusa application and the Next.js storefront are separate projects in separate folders.
Update existing project
Ensure your Medusa dependencies in package.json
are using the rc
tag:
{
"dependencies": {
"@medusajs/admin-sdk": "rc",
"@medusajs/framework": "rc",
"@medusajs/medusa": "rc",
"@medusajs/medusa-cli": "rc",
...
}
}
To ensure an upgrade to a new version is completed correctly, run the following sequence of commands:
rm -rf node_modules
rm yarn.lock // or package-lock.json
yarn // If you are using yarn berry, you need to create the lock-file first
Highlights
Standalone builds
[!WARNING]
Breaking change
As part of our preparations for the official release, we have improved our build process by introducing standalone builds. Now, when you build your Medusa project, we compile it within the project and mimic the file structure in the build output, not just the src
directory. Additionally, we are placing the build artifacts in .medusa
in the server
and admin
folders for the backend and dashboard code, respectively.
Here's how the build output looks like
.medusa
├── server
│ ├── package.json
│ ├── yarn.lock
│ ├── medusa-config.js
│ ├── modules
│ │ ├── hello
│ │ ├── index.js
│ ├─── model
│ ├─── index.js
├── admin
│ ├── assets
│ ├── index.html
└── types
If you notice carefully, medusa-config.js
, yarn.lock
, and package.json
is included in the build artifacts. We do so to create a standalone built application, something you can copy/paste to your server and run without relying on the original source code.
This results in small containers since you are not copying unnecessary files. Additionally, it clearly distinguishes between the development and production code. If you want to run the production server, then cd
into the .medusa/server
directory and run it from there.
Breaking changes (summarised):
- Remove the dist and build folders. Instead, write them production artifacts within the .medusa directory as .medusa/admin and .medusa/server.
- Change the output of the .medusa/server folder to mimic the root project structure.
Read more in the PR.
Module registration
[!WARNING]
Breaking change
We have cleaned up module registration in medusa-config.js
to be consistent with the rest of the configuration. This means modules
can now be passed as an array instead of an object:
// before
-modules: {
- custom: {
- resolve: "./modules/custom",
- options: {
- apiKey: "test",
- },
- },
-},
+modules: [
+ {
+ resolve: "./modules/custom",
+ options: {
+ apiKey: "test",
+ },
+ },
+],
This is a backward-compatible change. The backward compatibility will be removed in the near future, so we recommend updating your medusa-config.js
now.
With this change, we now default to using the key specificed in the module export to register the module in the dependency container.
For example, let's say you've built a custom module with the following export:
export default Module("my_custom_module", { ... } )
The registration key in the dependency container will be my_custom_module
and is resolved as follows:
const service = req.scope.resolve("my_custom_module")
Breaking changes:
- The import location changed for the following utils:
- import { MODULE_PACKAGE_NAMES } from "@medusajs/framework/modules-sdk
+ import { MODULE_PACKAGE_NAMES } from "@medusajs/framework/utils
- The module registration key names have changed to be snake_cased instead of PascalCased:
- export const Modules = {
- AUTH: "Auth",
- CACHE: "Cache",
- CART: "Cart",
- CUSTOMER: "Customer",
- EVENT_BUS: "EventBus",
...
- } as const
+ export const Modules = {
+ AUTH: "auth",
+ CACHE: "cache",
+ CART: "cart",
+ CUSTOMER: "customer",
+ EVENT_BUS: "event_bus",
...
The latter is only a breaking change if you have used raw strings to resolve modules from the dependency container.
Features
- feat(dashboard, js-sdk): reset password UI by @fPolic in https://github.com/medusajs/medusa/pull/9451
- feat(dashboard, medusa) add metadata to pages by @fPolic in https://github.com/medusajs/medusa/pull/9433
- feat(dashboard,core-flows,types,order): change order accepts price updates by @riqwan in https://github.com/medusajs/medusa/pull/9476
- feat: Add
useQueryStep
by @adrien2p in https://github.com/medusajs/medusa/pull/9384 - fix(medusa): use transform order for store order endpoints by @riqwan in https://github.com/medusajs/medusa/pull/9489
- feat(dashboard,admin-vite-plugin,admin-bundler,admin-sdk): Rework admin extensions and introduce custom fields API by @kasperkristensen in https://github.com/medusajs/medusa/pull/9338
- breaking: Standalone builds by @thetutlage in https://github.com/medusajs/medusa/pull/9496
- feat(dashboard): Add global search by @kasperkristensen in https://github.com/medusajs/medusa/pull/9504
- feat(locking): Locking module by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9524
Bugs
- fix(core-flows): update cart promotion data usage by @adrien2p in https://github.com/medusajs/medusa/pull/9456
- fix(dashboard): allow to unset PL rule by @fPolic in https://github.com/medusajs/medusa/pull/9276
- fix: Handle region updates on cart (1/n) by @olivermrbl in https://github.com/medusajs/medusa/pull/9369
- fix: If country on cart has no tax region, clear tax lines by @olivermrbl in https://github.com/medusajs/medusa/pull/9447
- fix: Idempotent cart completion by @olivermrbl in https://github.com/medusajs/medusa/pull/9231
- fix: add order to pagination types by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9471
- chore(cli): Update start description by @adrien2p in https://github.com/medusajs/medusa/pull/9448
- fix(payment): Capture payment by @olivermrbl in https://github.com/medusajs/medusa/pull/9469
- fix: Remove extra saving on serialization which breaks the chain by @adrien2p in https://github.com/medusajs/medusa/pull/9465
- fix(orchestrator, workflows-sdk): skip async step by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9482
- fix(core-flows): remove reservations on order edit confirm by @fPolic in https://github.com/medusajs/medusa/pull/9477
- fix(order): searchable fields by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9493
- fix(dashboard): manage inventory flags by @fPolic in https://github.com/medusajs/medusa/pull/9487
- fix(product): Always add q if defined in product category search by @olivermrbl in https://github.com/medusajs/medusa/pull/9505
- fix(dashboard): Remove token copy from badge by @kasperkristensen in https://github.com/medusajs/medusa/pull/9508
- fix(order): undo order change by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9497
- fix: add metadata to product type resp by @srindom in https://github.com/medusajs/medusa/pull/9515
- fix: hover states on filters and chip groups by @srindom in https://github.com/medusajs/medusa/pull/9511
- fix: add metadata to collection resp by @srindom in https://github.com/medusajs/medusa/pull/9514
- fix(dashboard): undeclared var by @fPolic in https://github.com/medusajs/medusa/pull/9512
- fix: provide outDir to typescript compiler by @thetutlage in https://github.com/medusajs/medusa/pull/9518
- fix(core-flows, dashboard): inventory kit reservations by @fPolic in https://github.com/medusajs/medusa/pull/9502
- fix(types): fix parameter types for the order module's service by @shahednasser in https://github.com/medusajs/medusa/pull/9513
- fix(workflows-sdk):transaction id inheritence by @adrien2p in https://github.com/medusajs/medusa/pull/9507
- fix(utils): build query conversion breaking the underlying API operator map by @adrien2p in https://github.com/medusajs/medusa/pull/9533
- fix: do not pass additional_data to service by @thetutlage in https://github.com/medusajs/medusa/pull/9532
- fix(dashboard,ui): Fixes to Combobox and CategoryCombobox by @kasperkristensen in https://github.com/medusajs/medusa/pull/9537
Documentation
- docs: update imports of middlewares and http types by @shahednasser in https://github.com/medusajs/medusa/pull/9440
- docs: add section on testing providers by @shahednasser in https://github.com/medusajs/medusa/pull/9453
- docs: update modules chapter in basics by @shahednasser in https://github.com/medusajs/medusa/pull/9452
- docs: improvements to API reference intro sections by @shahednasser in https://github.com/medusajs/medusa/pull/9397
- docs: fix import path in the workflow basic documentation by @damien-thiesson in https://github.com/medusajs/medusa/pull/9481
- docs: added docs for reset password by @shahednasser in https://github.com/medusajs/medusa/pull/9306
- docs: document using conditional operators in workflows by @shahednasser in https://github.com/medusajs/medusa/pull/9464
- docs: updates in recipes by @shahednasser in https://github.com/medusajs/medusa/pull/9472
- docs: improved commerce module docs [2/n] by @shahednasser in https://github.com/medusajs/medusa/pull/9501
- docs: improvements and fixes to components in API reference by @shahednasser in https://github.com/medusajs/medusa/pull/9410
- docs: Fix link to the correct AuthIdentity model's page by @zaidrashid in https://github.com/medusajs/medusa/pull/9519
- docs: redesigned navigation by @shahednasser in https://github.com/medusajs/medusa/pull/9525
- docs-util: fix import in generated workflow hook snippet by @shahednasser in https://github.com/medusajs/medusa/pull/9499
- docs: improve commerce modules [1/n] by @shahednasser in https://github.com/medusajs/medusa/pull/9498
- docs: small structure fixed to db command reference by @shahednasser in https://github.com/medusajs/medusa/pull/9446
- docs: add guide on how to seed data by @shahednasser in https://github.com/medusajs/medusa/pull/9449
- docs: added documentation for admin components by @shahednasser in https://github.com/medusajs/medusa/pull/9491
- docs: improve commerce modules [3/n] by @shahednasser in https://github.com/medusajs/medusa/pull/9510
Chores
- chore: fix action name in update on rc release action by @shahednasser in https://github.com/medusajs/medusa/pull/9463
- chore(types): index module type by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/9473
- chore: workflow internals improvementss by @adrien2p in https://github.com/medusajs/medusa/pull/9455
- chore: swc/jest source maps config to inline instead of true by @adrien2p in https://github.com/medusajs/medusa/pull/9531
- chore(): Allow to register modules through array by @adrien2p in https://github.com/medusajs/medusa/pull/9522
Other Changes
- Feat: Move container bindings declaration merging within the framework by @thetutlage in https://github.com/medusajs/medusa/pull/9467
- feat: convert modules enum to a const by @thetutlage in https://github.com/medusajs/medusa/pull/9486
- fix(payment): correct import of MedusaError by @Veskel01 in https://github.com/medusajs/medusa/pull/9474
- fix: js-sdk compilation error by @joekendal in https://github.com/medusajs/medusa/pull/9523
New Contributors
- @damien-thiesson made their first contribution in https://github.com/medusajs/medusa/pull/9481
- @Veskel01 made their first contribution in https://github.com/medusajs/medusa/pull/9474
Full Changelog: https://github.com/medusajs/medusa/compare/v2.0.0-rc.2...v2.0.0-rc.3