feat(medusa-cli): add monorepo support command develop (#5723)

* add monorepo support command develop

* fix formating bug in @medusa/admin package.json

* Create grumpy-bees-laugh.md

---------

Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
driver005
2023-12-03 14:29:55 +01:00
committed by GitHub
parent 428331a653
commit fd317f1a6b
4 changed files with 21 additions and 15 deletions

View File

@@ -0,0 +1,6 @@
---
"@medusajs/medusa": patch
"@medusajs/admin": patch
---
feat(medusa): add monorepo support command develop

View File

@@ -4,7 +4,7 @@
"bin": {
"medusa-admin": "./bin/medusa-admin.js"
},
"main": "index.js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"bin",

View File

@@ -43,7 +43,12 @@ export default async function ({ port, directory }) {
process.exit(0)
})
const babelPath = path.join(directory, "node_modules", ".bin", "babel")
const babelPath = path.resolve(
require.resolve("@babel/cli"),
"../",
"bin",
"babel.js"
)
execSync(`"${babelPath}" src -d dist --ignore "src/admin/**"`, {
cwd: directory,
@@ -58,12 +63,9 @@ export default async function ({ port, directory }) {
COMMAND_INITIATED_BY: "develop",
}
const cliPath = path.join(
directory,
"node_modules",
"@medusajs",
"medusa",
"dist",
const cliPath = path.resolve(
require.resolve("@medusajs/medusa"),
"../",
"bin",
"medusa.js"
)
@@ -78,7 +80,7 @@ export default async function ({ port, directory }) {
process.exit(1)
})
const { cli, binExists } = resolveAdminCLI(directory)
const { cli, binExists } = resolveAdminCLI()
if (binExists) {
const backendUrl = `http://localhost:${port}`

View File

@@ -1,12 +1,10 @@
import fs from "fs-extra"
import path from "path"
export function resolveAdminCLI(directory: string) {
const cli = path.join(
directory,
"node_modules",
"@medusajs",
"admin",
export function resolveAdminCLI() {
const cli = path.resolve(
require.resolve("@medusajs/admin"),
"../../",
"bin",
"medusa-admin.js"
)