forked from medusajs/medusa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add plugin build command (medusajs#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
- Loading branch information
1 parent
b0cfb05
commit b0f581c
Showing
4 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@medusajs/medusa": patch | ||
"@medusajs/framework": patch | ||
"@medusajs/cli": patch | ||
--- | ||
|
||
feat: add plugin build command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |