fix: generate posix paths for migrations (#11468)
Fixes: FRMW-2913 Related Github issue - https://github.com/medusajs/medusa/issues/11330
This commit is contained in:
1 parent
b53ea77658
commit
32c5015f56
4 files changed
+20
-4
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/medusa": patch
|
||||||
|
"@medusajs/utils": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: generate posix paths for migrations
|
||||||
@@ -81,4 +81,5 @@ export * from "./upper-case-first"
|
|||||||
export * from "./validate-handle"
|
export * from "./validate-handle"
|
||||||
export * from "./wrap-handler"
|
export * from "./wrap-handler"
|
||||||
export * from "./merge-plugin-modules"
|
export * from "./merge-plugin-modules"
|
||||||
|
export * from "./to-unix-slash"
|
||||||
export * from "./merge-metadata"
|
export * from "./merge-metadata"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
export function toUnixSlash(path: string) {
|
||||||
|
const isExtendedLengthPath = path.startsWith("\\\\?\\")
|
||||||
|
if (isExtendedLengthPath) {
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
return path.replace(/\\/g, "/")
|
||||||
|
}
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
|
import { glob } from "glob"
|
||||||
import { logger } from "@medusajs/framework/logger"
|
import { logger } from "@medusajs/framework/logger"
|
||||||
import {
|
import {
|
||||||
defineMikroOrmCliConfig,
|
toUnixSlash,
|
||||||
DmlEntity,
|
DmlEntity,
|
||||||
dynamicImport,
|
dynamicImport,
|
||||||
|
defineMikroOrmCliConfig,
|
||||||
} from "@medusajs/framework/utils"
|
} from "@medusajs/framework/utils"
|
||||||
import { dirname, join } from "path"
|
import { dirname, join } from "path"
|
||||||
|
|
||||||
import { MetadataStorage } from "@mikro-orm/core"
|
import { MetadataStorage } from "@mikro-orm/core"
|
||||||
import { MikroORM } from "@mikro-orm/postgresql"
|
import { MikroORM } from "@mikro-orm/postgresql"
|
||||||
import { glob } from "glob"
|
|
||||||
|
|
||||||
const TERMINAL_SIZE = process.stdout.columns
|
const TERMINAL_SIZE = process.stdout.columns
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ const main = async function ({ directory }) {
|
|||||||
}[]
|
}[]
|
||||||
|
|
||||||
const modulePaths = glob.sync(
|
const modulePaths = glob.sync(
|
||||||
join(directory, "src", "modules", "*", "index.ts")
|
toUnixSlash(join(directory, "src", "modules", "*", "index.ts"))
|
||||||
)
|
)
|
||||||
|
|
||||||
for (const path of modulePaths) {
|
for (const path of modulePaths) {
|
||||||
@@ -61,7 +62,7 @@ const main = async function ({ directory }) {
|
|||||||
async function getEntitiesForModule(path: string) {
|
async function getEntitiesForModule(path: string) {
|
||||||
const entities = [] as any[]
|
const entities = [] as any[]
|
||||||
|
|
||||||
const entityPaths = glob.sync(join(path, "models", "*.ts"), {
|
const entityPaths = glob.sync(toUnixSlash(join(path, "models", "*.ts")), {
|
||||||
ignore: ["**/index.{js,ts}", "**/*.d.ts"],
|
ignore: ["**/index.{js,ts}", "**/*.d.ts"],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user