feature: Add MikroORM CLI wrapper to bypass hardcoded module system (#9426)
FIXES: FRMW-2727 MikroORM (with version 5.9) has [hardcoded the TypeScript module](https://github.com/mikro-orm/mikro-orm/blob/5.x/packages/core/src/utils/ConfigurationLoader.ts#L138-L139) system to `commonjs`, which makes it incompatible with the module system we are using, ie `Node16`. So, in order to continue using the Mikro ORM CLI within our modules, we will have to monkey-patch the block of code responsible for configuring `ts-node`. However, the monkey-patching must be done before their CLI gets booted. As a result of this, we have to create a wrapper CLI on top of Mikro ORM CLI that performs the following steps. - Monkey-patch the relevant code - Register Mikro ORM CLI as the second step. Due do this, we will have to use this new wrapper CLI within the modules, which is exposed as `medusa-db`. Maybe, `medusa-db` is not a great name, so please send your suggestions.
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
"!dist/**/__mocks__",
|
||||
"!dist/**/__fixtures__"
|
||||
],
|
||||
"bin": {
|
||||
"medusa-mikro-orm": "./dist/mikro-orm-cli/bin.js"
|
||||
},
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./config": "./dist/config/index.js",
|
||||
@@ -68,6 +71,7 @@
|
||||
"vite": "^5.2.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jercle/yargonaut": "^1.1.5",
|
||||
"@medusajs/modules-sdk": "^1.12.11",
|
||||
"@medusajs/orchestration": "^0.5.7",
|
||||
"@medusajs/types": "^1.11.16",
|
||||
@@ -82,10 +86,12 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"medusa-telemetry": "^0.0.17",
|
||||
"morgan": "^1.9.1",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"zod": "3.22.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@medusajs/medusa-cli": "^1.3.22",
|
||||
"@mikro-orm/cli": "5.9.7",
|
||||
"@mikro-orm/core": "5.9.7",
|
||||
"@mikro-orm/knex": "5.9.7",
|
||||
"@mikro-orm/migrations": "5.9.7",
|
||||
@@ -96,6 +102,9 @@
|
||||
"vite": "^5.2.11"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@mikro-orm/cli": {
|
||||
"optional": true
|
||||
},
|
||||
"ioredis": {
|
||||
"optional": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user