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:
6
.changeset/grumpy-bees-laugh.md
Normal file
6
.changeset/grumpy-bees-laugh.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
"@medusajs/admin": patch
|
||||
---
|
||||
|
||||
feat(medusa): add monorepo support command develop
|
||||
@@ -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",
|
||||
|
||||
@@ -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}`
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user