feat(medusa,framework,cli,admin-bundler): Integrate admin extensions into medusa build:plugin (#10941)
**What** Calls the `plugin` script from `@medusajs/admin-bundler` as part of `medusa plugin:build`.
This commit is contained in:
committed by
GitHub
parent
2a2b387bc3
commit
4bc3f5b845
@@ -1,8 +1,8 @@
|
||||
import path from "path"
|
||||
import type tsStatic from "typescript"
|
||||
import type { AdminOptions, ConfigModule, Logger } from "@medusajs/types"
|
||||
import { getConfigFile } from "@medusajs/utils"
|
||||
import { access, constants, copyFile, rm } from "fs/promises"
|
||||
import type { AdminOptions, ConfigModule, Logger } from "@medusajs/types"
|
||||
import path from "path"
|
||||
import type tsStatic from "typescript"
|
||||
|
||||
/**
|
||||
* The compiler exposes the opinionated APIs for compiling Medusa
|
||||
@@ -486,4 +486,25 @@ export class Compiler {
|
||||
|
||||
ts.createWatchProgram(host)
|
||||
}
|
||||
|
||||
async buildPluginAdminExtensions(bundler: {
|
||||
plugin: (options: { root: string; outDir: string }) => Promise<void>
|
||||
}) {
|
||||
const tracker = this.#trackDuration()
|
||||
this.#logger.info("Compiling plugin admin extensions...")
|
||||
|
||||
try {
|
||||
await bundler.plugin({
|
||||
root: this.#projectRoot,
|
||||
outDir: this.#pluginsDistFolder,
|
||||
})
|
||||
this.#logger.info(
|
||||
`Plugin admin extensions build completed successfully (${tracker.getSeconds()}s)`
|
||||
)
|
||||
return true
|
||||
} catch (error) {
|
||||
this.#logger.error(`Plugin admin extensions build failed`, error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user