From d7324b2e9877e53395112f64fe61c054ec0df49e Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 18 Apr 2024 16:39:04 +0200 Subject: [PATCH] :sparkles: Support development and production plugin runtime --- frontend/resources/templates/index.mustache | 29 ++++++--------------- frontend/scripts/_helpers.js | 4 +++ frontend/scripts/watch.js | 2 +- manage.sh | 2 +- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/frontend/resources/templates/index.mustache b/frontend/resources/templates/index.mustache index 9a9fe6e08..b1e635155 100644 --- a/frontend/resources/templates/index.mustache +++ b/frontend/resources/templates/index.mustache @@ -23,25 +23,19 @@ {{/isDebug}} - - - - - - - {{# manifest}} {{/manifest}} + + + @@ -49,17 +43,10 @@ {{> ../public/images/sprites/symbol/cursors.svg }}
- {{# manifest}} + {{# manifest}} - - {{/manifest}} - - diff --git a/frontend/scripts/_helpers.js b/frontend/scripts/_helpers.js index cb2d36ac9..9633aa488 100644 --- a/frontend/scripts/_helpers.js +++ b/frontend/scripts/_helpers.js @@ -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)})`); diff --git a/frontend/scripts/watch.js b/frontend/scripts/watch.js index 80dda26b5..56fb84a8e 100644 --- a/frontend/scripts/watch.js +++ b/frontend/scripts/watch.js @@ -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(); diff --git a/manage.sh b/manage.sh index d724fef53..6e13bb7d6 100755 --- a/manage.sh +++ b/manage.sh @@ -85,7 +85,7 @@ function run-devenv-tmux { start-devenv fi - docker exec -ti penpot-devenv-main sudo -EH -u penpot /home/start-tmux.sh + docker exec -ti penpot-devenv-main sudo -EH -u penpot PENPOT_PLUGIN_DEV=$PENPOT_PLUGIN_DEV /home/start-tmux.sh } function run-devenv-shell {