Skip to content

Commit

Permalink
feature: bundle all modules (#9324)
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage authored and riqwan committed Oct 2, 2024
1 parent 13285e0 commit 967364a
Show file tree
Hide file tree
Showing 81 changed files with 640 additions and 226 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SubscriberConfig } from "@medusajs/medusa/src"
import { SubscriberConfig } from "@medusajs/medusa"

const testEventPayloadHandlerMock = jest.fn()

Expand Down
1 change: 0 additions & 1 deletion integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"awilix": "^8.0.1",
"bignumber.js": "^9.1.2",
"ioredis": "^5.4.1",
"pg": "^8.13.0",
"pg-god": "^1.0.12",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"workspaces": {
"packages": [
"packages/medusa",
"packages/medusa-test-utils",
"packages/modules/*",
"packages/modules/providers/*",
"packages/core/*",
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/admin-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@medusajs/types": "^1.11.16",
"@types/compression": "^1.7.5",
"copyfiles": "^2.4.1",
"express": "^4.18.2",
"express": "^4.21.0",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
},
Expand All @@ -37,7 +37,7 @@
"vite": "^5.2.11"
},
"peerDependencies": {
"express": "^4.18.2",
"express": "^4.21.0",
"react-dom": "^18.0.0"
},
"packageManager": "[email protected]"
Expand Down
15 changes: 15 additions & 0 deletions packages/cli/medusa-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@
"author": "Sebastian Rindom",
"license": "MIT",
"devDependencies": {
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"@types/yargs": "^15.0.15",
"awilix": "^8.0.1",
"jest": "^29.7.0",
"pg": "^8.13.0",
"rimraf": "^5.0.1",
"typescript": "^5.6.2"
},
Expand All @@ -45,6 +51,7 @@
"configstore": "5.0.1",
"dotenv": "^16.4.5",
"execa": "^5.1.1",
"express": "^4.21.0",
"fs-exists-cached": "^1.0.0",
"fs-extra": "^10.0.0",
"glob": "^7.1.6",
Expand All @@ -63,5 +70,13 @@
"winston": "^3.8.2",
"yargs": "^15.3.1"
},
"peerDependencies": {
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"awilix": "^8.0.1",
"pg": "^8.13.0"
},
"gitHead": "81a7ff73d012fda722f6e9ef0bd9ba0232d37808"
}
4 changes: 1 addition & 3 deletions packages/cli/medusa-cli/src/create-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ function buildLocalCommands(cli, isLocalProject) {
}

try {
const cmdPath = resolveCwd.silent(
`@medusajs/medusa/dist/commands/${command}`
)!
const cmdPath = resolveCwd.silent(`@medusajs/medusa/commands/${command}`)!
return require(cmdPath).default
} catch (err) {
console.error(err)
Expand Down
3 changes: 0 additions & 3 deletions packages/core/core-flows/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"awilix": "^8.0.1",
"bignumber.js": "^9.1.2",
"cross-env": "^5.2.1",
"ioredis": "^5.4.1",
"jest": "^29.7.0",
"pg": "^8.13.0",
"rimraf": "^5.0.1",
Expand Down
16 changes: 11 additions & 5 deletions packages/core/framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"test": "jest --runInBand --bail --passWithNoTests --forceExit"
},
"devDependencies": {
"@medusajs/medusa-cli": "^1.3.22",
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
Expand All @@ -58,7 +59,6 @@
"@types/express": "^4.17.17",
"@types/jsonwebtoken": "^8.5.9",
"awilix": "^8.0.1",
"bignumber.js": "^9.1.2",
"ioredis": "^5.4.1",
"jest": "^29.7.0",
"pg": "^8.13.0",
Expand All @@ -68,7 +68,6 @@
"vite": "^5.2.11"
},
"dependencies": {
"@medusajs/medusa-cli": "^1.3.22",
"@medusajs/modules-sdk": "^1.12.11",
"@medusajs/orchestration": "^0.5.7",
"@medusajs/types": "^1.11.16",
Expand All @@ -78,23 +77,30 @@
"connect-redis": "5.2.0",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"express": "^4.18.2",
"express": "^4.21.0",
"express-session": "^1.17.3",
"ioredis": "^5.4.1",
"jsonwebtoken": "^9.0.2",
"medusa-telemetry": "^0.0.17",
"morgan": "^1.9.1",
"zod": "3.22.4"
},
"peerDependencies": {
"@medusajs/medusa-cli": "^1.3.22",
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"awilix": "^8.0.1",
"bignumber.js": "^9.1.2",
"ioredis": "^5.4.1",
"pg": "^8.13.0",
"vite": "^5.2.11"
},
"peerDependenciesMeta": {
"ioredis": {
"optional": true
},
"vite": {
"optional": true
}
}
}
3 changes: 0 additions & 3 deletions packages/core/medusa-test-utils/tsconfig.json

This file was deleted.

9 changes: 8 additions & 1 deletion packages/core/modules-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@
"devDependencies": {
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"awilix": "^8.0.1",
"cross-env": "^5.2.1",
"jest": "^29.7.0",
"pg": "^8.13.0",
"rimraf": "^5.0.1",
"typescript": "^5.6.2"
},
Expand All @@ -50,6 +53,10 @@
"peerDependencies": {
"@mikro-orm/core": "5.9.7",
"@mikro-orm/knex": "5.9.7",
"awilix": "^8.0.1"
"@mikro-orm/migrations": "5.9.7",
"@mikro-orm/postgresql": "5.9.7",
"awilix": "^8.0.1",
"express": "^4.21.0",
"pg": "^8.13.0"
}
}
50 changes: 25 additions & 25 deletions packages/core/modules-sdk/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ import {
import { MODULE_RESOURCE_TYPE, MODULE_SCOPE } from "./types"

export const MODULE_PACKAGE_NAMES = {
[Modules.AUTH]: "@medusajs/auth",
[Modules.CACHE]: "@medusajs/cache-inmemory",
[Modules.CART]: "@medusajs/cart",
[Modules.CUSTOMER]: "@medusajs/customer",
[Modules.EVENT_BUS]: "@medusajs/event-bus-local",
[Modules.INVENTORY]: "@medusajs/inventory-next", // TODO: To be replaced when current `@medusajs/inventory` is deprecated
[Modules.LINK]: "@medusajs/link-modules",
[Modules.PAYMENT]: "@medusajs/payment",
[Modules.PRICING]: "@medusajs/pricing",
[Modules.PRODUCT]: "@medusajs/product",
[Modules.PROMOTION]: "@medusajs/promotion",
[Modules.SALES_CHANNEL]: "@medusajs/sales-channel",
[Modules.FULFILLMENT]: "@medusajs/fulfillment",
[Modules.STOCK_LOCATION]: "@medusajs/stock-location-next", // TODO: To be replaced when current `@medusajs/stock-location` is deprecated
[Modules.TAX]: "@medusajs/tax",
[Modules.USER]: "@medusajs/user",
[Modules.WORKFLOW_ENGINE]: "@medusajs/workflow-engine-inmemory",
[Modules.REGION]: "@medusajs/region",
[Modules.ORDER]: "@medusajs/order",
[Modules.API_KEY]: "@medusajs/api-key",
[Modules.STORE]: "@medusajs/store",
[Modules.CURRENCY]: "@medusajs/currency",
[Modules.FILE]: "@medusajs/file",
[Modules.NOTIFICATION]: "@medusajs/notification",
[Modules.INDEX]: "@medusajs/index",
[Modules.AUTH]: "@medusajs/medusa/auth",
[Modules.CACHE]: "@medusajs/medusa/cache-inmemory",
[Modules.CART]: "@medusajs/medusa/cart",
[Modules.CUSTOMER]: "@medusajs/medusa/customer",
[Modules.EVENT_BUS]: "@medusajs/medusa/event-bus-local",
[Modules.INVENTORY]: "@medusajs/medusa/inventory-next", // TODO: To be replaced when current `@medusajs/inventory` is deprecated
[Modules.LINK]: "@medusajs/medusa/link-modules",
[Modules.PAYMENT]: "@medusajs/medusa/payment",
[Modules.PRICING]: "@medusajs/medusa/pricing",
[Modules.PRODUCT]: "@medusajs/medusa/product",
[Modules.PROMOTION]: "@medusajs/medusa/promotion",
[Modules.SALES_CHANNEL]: "@medusajs/medusa/sales-channel",
[Modules.FULFILLMENT]: "@medusajs/medusa/fulfillment",
[Modules.STOCK_LOCATION]: "@medusajs/medusa/stock-location-next", // TODO: To be replaced when current `@medusajs/stock-location` is deprecated
[Modules.TAX]: "@medusajs/medusa/tax",
[Modules.USER]: "@medusajs/medusa/user",
[Modules.WORKFLOW_ENGINE]: "@medusajs/medusa/workflow-engine-inmemory",
[Modules.REGION]: "@medusajs/medusa/region",
[Modules.ORDER]: "@medusajs/medusa/order",
[Modules.API_KEY]: "@medusajs/medusa/api-key",
[Modules.STORE]: "@medusajs/medusa/store",
[Modules.CURRENCY]: "@medusajs/medusa/currency",
[Modules.FILE]: "@medusajs/medusa/file",
[Modules.NOTIFICATION]: "@medusajs/medusa/notification",
[Modules.INDEX]: "@medusajs/medusa/index-module",
}

export const ModulesDefinition: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ describe("load internal - load resources", () => {
(ModuleService.prototype as IModuleService).__joinerConfig
).toBeUndefined()

const resources = await loadResources(moduleResolution)
const resources = await loadResources({
moduleResolution,
discoveryPath: moduleResolution.resolutionPath as string,
})

expect(resources).toBeDefined()
expect(resources.services).toHaveLength(1)
Expand Down Expand Up @@ -115,7 +118,10 @@ describe("load internal - load resources", () => {
(ModuleService.prototype as IModuleService).__joinerConfig
).toBeUndefined()

const resources = await loadResources(moduleResolution)
const resources = await loadResources({
moduleResolution,
discoveryPath: moduleResolution.resolutionPath as string,
})

expect(resources).toBeDefined()
expect(resources.services).toHaveLength(1)
Expand Down Expand Up @@ -195,7 +201,10 @@ describe("load internal - load resources", () => {
(ModuleService.prototype as IModuleService).__joinerConfig
).toBeUndefined()

const resources = await loadResources(moduleResolution)
const resources = await loadResources({
moduleResolution,
discoveryPath: moduleResolution.resolutionPath as string,
})

expect(resources).toBeDefined()
expect(resources.services).toHaveLength(1)
Expand Down Expand Up @@ -274,7 +283,10 @@ describe("load internal - load resources", () => {
(ModuleService.prototype as IModuleService).__joinerConfig
).toBeDefined()

const resources = await loadResources(moduleResolution)
const resources = await loadResources({
moduleResolution,
discoveryPath: moduleResolution.resolutionPath as string,
})

expect(resources).toBeDefined()
expect(resources.services).toHaveLength(1)
Expand Down
Loading

0 comments on commit 967364a

Please sign in to comment.