feat(medusa,medusa-cli): add an exec command (#7376)

This commit is contained in:
Shahed Nasser
2024-05-21 11:56:44 +03:00
committed by GitHub
parent 442b0b2038
commit 73c917fdce
5 changed files with 62 additions and 1 deletions

View File

@@ -321,6 +321,19 @@ function buildLocalCommands(cli, isLocalProject) {
})
),
})
.command({
command: `exec [file] [args..]`,
desc: `Run a function defined in a file.`,
handler: handlerP(
getCommandHandler(`exec`, (args, cmd) => {
cmd(args)
// 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) => {})
})
),
})
}
function isLocalMedusaProject() {