Feat/plugin develop (#10926)
Fixes: FRMW-2865 In this PR we add support for developing a plugin in watch mode. During the file change, we re-compile the source code (incrementally), publishes the package, and updates the installations of the plugin. We are using `yalc` under the hood and it must be installed as a dev dependency in the plugin project and the main Medusa app.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import * as yalc from "yalc"
|
||||
import { logger } from "@medusajs/framework/logger"
|
||||
import { Compiler } from "@medusajs/framework/build-tools"
|
||||
|
||||
export default async function developPlugin({
|
||||
directory,
|
||||
}: {
|
||||
directory: string
|
||||
}) {
|
||||
const compiler = new Compiler(directory, logger)
|
||||
await compiler.developPluginBackend(async () => {
|
||||
await yalc.publishPackage({
|
||||
push: true,
|
||||
workingDir: directory,
|
||||
changed: true,
|
||||
replace: true,
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user