chore: dependencies reorg (#8744)

This commit is contained in:
Carlos R. L. Rodrigues
2024-08-26 06:37:05 -03:00
committed by GitHub
parent 7c2cfc132a
commit afd25846f0
16 changed files with 72 additions and 40 deletions

View File

@@ -1,10 +1,10 @@
import { sync as existsSync } from "fs-exists-cached"
import { setTelemetryEnabled } from "medusa-telemetry"
import path from "path"
import resolveCwd from "resolve-cwd"
import { didYouMean } from "./did-you-mean"
import { toCamelCase } from "@medusajs/utils"
import { newStarter } from "./commands/new"
import reporter from "./reporter"
@@ -40,10 +40,9 @@ function buildLocalCommands(cli, isLocalProject) {
}
try {
const cmdPath = resolveCwd.silent(
`@medusajs/medusa/dist/commands/${command}`
)!
return require(cmdPath).default
const { Commands } = require("@medusajs/medusa")
const cmdName = toCamelCase(command)
return Commands[cmdName]
} catch (err) {
if (!process.env.NODE_ENV?.startsWith("prod")) {
console.log("--------------- ERROR ---------------------")
@@ -249,6 +248,7 @@ function buildLocalCommands(cli, isLocalProject) {
handler: handlerP(
getCommandHandler(`develop`, (args, cmd) => {
process.env.NODE_ENV = process.env.NODE_ENV || `development`
cmd(args)
// Return an empty promise to prevent handlerP from exiting early.
// The development server shouldn't ever exit until the user directly