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:
Harminder Virk
2025-01-13 13:08:02 +00:00
committed by GitHub
parent ecf73780e0
commit 69e2a6d695
6 changed files with 217 additions and 27 deletions
@@ -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,
})
})
}