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 18:38:02 +05:30
committed by GitHub
parent ecf73780e0
commit 69e2a6d695
6 changed files with 217 additions and 27 deletions

View File

@@ -254,6 +254,18 @@ function buildLocalCommands(cli, isLocalProject) {
})
),
})
.command({
command: "plugin:develop",
desc: "Start plugin development process in watch mode. Changes will be re-published to the local packages registry",
builder: (builder) => {},
handler: handlerP(
getCommandHandler("plugin/develop", (args, cmd) => {
process.env.NODE_ENV = process.env.NODE_ENV || `development`
cmd(args)
return new Promise(() => {})
})
),
})
.command({
command: `telemetry`,
describe: `Enable or disable collection of anonymous usage data.`,
@@ -310,7 +322,7 @@ function buildLocalCommands(cli, isLocalProject) {
// Return an empty promise to prevent handlerP from exiting early.
// The development server shouldn't ever exit until the user directly
// kills it so this is fine.
return new Promise((resolve) => {})
return new Promise(() => {})
})
),
})