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:
authored and GitHub committed 2023-12-03 14:29:55 +01:00
1 parent 428331a653
commit fd317f1a6b
4 files changed
+21 -15

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
"@medusajs/medusa": patch
"@medusajs/admin": patch
---
feat(medusa): add monorepo support command develop
+1 -1
View File
@@ -4,7 +4,7 @@
"bin": { "bin": {
"medusa-admin": "./bin/medusa-admin.js" "medusa-admin": "./bin/medusa-admin.js"
}, },
"main": "index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
"files": [ "files": [
"bin", "bin",
+10 -8
View File
@@ -43,7 +43,12 @@ export default async function ({ port, directory }) {
process.exit(0) 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/**"`, { execSync(`"${babelPath}" src -d dist --ignore "src/admin/**"`, {
cwd: directory, cwd: directory,
@@ -58,12 +63,9 @@ export default async function ({ port, directory }) {
COMMAND_INITIATED_BY: "develop", COMMAND_INITIATED_BY: "develop",
} }
const cliPath = path.join( const cliPath = path.resolve(
directory, require.resolve("@medusajs/medusa"),
"node_modules", "../",
"@medusajs",
"medusa",
"dist",
"bin", "bin",
"medusa.js" "medusa.js"
) )
@@ -78,7 +80,7 @@ export default async function ({ port, directory }) {
process.exit(1) process.exit(1)
}) })
const { cli, binExists } = resolveAdminCLI(directory) const { cli, binExists } = resolveAdminCLI()
if (binExists) { if (binExists) {
const backendUrl = `http://localhost:${port}` const backendUrl = `http://localhost:${port}`
@@ -1,12 +1,10 @@
import fs from "fs-extra" import fs from "fs-extra"
import path from "path" import path from "path"
export function resolveAdminCLI(directory: string) { export function resolveAdminCLI() {
const cli = path.join( const cli = path.resolve(
directory, require.resolve("@medusajs/admin"),
"node_modules", "../../",
"@medusajs",
"admin",
"bin", "bin",
"medusa-admin.js" "medusa-admin.js"
) )