Support development and production plugin runtime

This commit is contained in:
alonso.torres 2024-04-18 16:39:04 +02:00 committed by Andrey Antukh
parent 97c3abfd60
commit d7324b2e98
4 changed files with 14 additions and 23 deletions

View file

@ -315,9 +315,12 @@ async function generateTemplates() {
"../public/images/sprites/symbol/cursors.svg": cursorsSprite,
};
const pluginRuntimeUri = (process.env.PENPOT_PLUGIN_DEV === "true") ? "http://localhost:4200" : "./plugins-runtime";
content = await renderTemplate("resources/templates/index.mustache", {
manifest: manifest,
translations: JSON.stringify(translations),
pluginRuntimeUri,
}, partials);
await fs.writeFile("./resources/public/index.html", content);
@ -401,6 +404,7 @@ export async function copyAssets() {
await syncDirs("resources/images/", "resources/public/images/");
await syncDirs("resources/fonts/", "resources/public/fonts/");
await syncDirs("resources/plugins-runtime/", "resources/public/plugins-runtime/");
const end = process.hrtime(start);
log.info("done: copy assets", `(${ppt(end)})`);

View file

@ -64,7 +64,7 @@ h.watch("resources/templates", null, async function (path) {
});
log.info("watch: assets (~)")
h.watch(["resources/images", "resources/fonts"], null, async function (path) {
h.watch(["resources/images", "resources/fonts", "resources/plugins-runtime"], null, async function (path) {
log.info("changed:", path);
await h.compileSvgSprites();
await h.copyAssets();