feat: add plugin build command (#10935)
Fixes: FRMW-2863 Adds the `plugin:build` command that is used to compile the source code of a plugin for publishing it to a package registry. The command is similar to the `build` command, except it does not copy the `package.json` and the `lock` files to the build output
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { logger } from "@medusajs/framework/logger"
|
||||
import { Compiler } from "@medusajs/framework/build-tools"
|
||||
|
||||
export default async function build({
|
||||
directory,
|
||||
adminOnly,
|
||||
}: {
|
||||
directory: string
|
||||
adminOnly: boolean
|
||||
}): Promise<boolean> {
|
||||
logger.info("Starting build...")
|
||||
const compiler = new Compiler(directory, logger)
|
||||
|
||||
const tsConfig = await compiler.loadTSConfigFile()
|
||||
if (!tsConfig) {
|
||||
logger.error("Unable to compile plugin")
|
||||
return false
|
||||
}
|
||||
|
||||
await compiler.buildPluginBackend(tsConfig)
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user