mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
✨ Support development and production plugin runtime
This commit is contained in:
committed by
Andrey Antukh
parent
97c3abfd60
commit
d7324b2e98
@@ -23,25 +23,19 @@
|
|||||||
{{/isDebug}}
|
{{/isDebug}}
|
||||||
|
|
||||||
<link rel="icon" href="images/favicon.png" />
|
<link rel="icon" href="images/favicon.png" />
|
||||||
|
|
||||||
<script type="importmap">
|
|
||||||
{"imports": {"plugins-runtime": "http://localhost:4200/index.mjs"}}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="module" src="http://localhost:4200/index.mjs"></script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
window.penpotTranslations = JSON.parse({{& translations}});
|
|
||||||
window.penpotVersion = "%version%";
|
|
||||||
window.penpotBuildDate = "%buildDate%";
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{{# manifest}}
|
{{# manifest}}
|
||||||
<script>window.penpotWorkerURI="{{& worker}}"</script>
|
<script>window.penpotWorkerURI="{{& worker}}"</script>
|
||||||
<script defer src="{{& config}}"></script>
|
<script defer src="{{& config}}"></script>
|
||||||
<script defer src="{{& polyfills}}"></script>
|
<script defer src="{{& polyfills}}"></script>
|
||||||
{{/manifest}}
|
{{/manifest}}
|
||||||
|
|
||||||
|
<script type="module" src="{{pluginRuntimeUri}}/index.mjs"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.penpotTranslations = JSON.parse({{& translations}});
|
||||||
|
window.penpotVersion = "%version%";
|
||||||
|
window.penpotBuildDate = "%buildDate%";
|
||||||
|
</script>
|
||||||
<!--cookie-consent-->
|
<!--cookie-consent-->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -49,17 +43,10 @@
|
|||||||
{{> ../public/images/sprites/symbol/cursors.svg }}
|
{{> ../public/images/sprites/symbol/cursors.svg }}
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<section id="modal"></section>
|
<section id="modal"></section>
|
||||||
{{# manifest}}
|
|
||||||
|
|
||||||
|
{{# manifest}}
|
||||||
<script defer src="{{& shared}}"></script>
|
<script defer src="{{& shared}}"></script>
|
||||||
<script defer src="{{& main}}"></script>
|
<script defer src="{{& main}}"></script>
|
||||||
|
|
||||||
<penpot-plugins />
|
|
||||||
{{/manifest}}
|
{{/manifest}}
|
||||||
|
|
||||||
<script type="module">
|
|
||||||
import * as runtime from "plugins-runtime";
|
|
||||||
runtime.initialize(globalThis.app.plugins.api);
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -315,9 +315,12 @@ async function generateTemplates() {
|
|||||||
"../public/images/sprites/symbol/cursors.svg": cursorsSprite,
|
"../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", {
|
content = await renderTemplate("resources/templates/index.mustache", {
|
||||||
manifest: manifest,
|
manifest: manifest,
|
||||||
translations: JSON.stringify(translations),
|
translations: JSON.stringify(translations),
|
||||||
|
pluginRuntimeUri,
|
||||||
}, partials);
|
}, partials);
|
||||||
|
|
||||||
await fs.writeFile("./resources/public/index.html", content);
|
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/images/", "resources/public/images/");
|
||||||
await syncDirs("resources/fonts/", "resources/public/fonts/");
|
await syncDirs("resources/fonts/", "resources/public/fonts/");
|
||||||
|
await syncDirs("resources/plugins-runtime/", "resources/public/plugins-runtime/");
|
||||||
|
|
||||||
const end = process.hrtime(start);
|
const end = process.hrtime(start);
|
||||||
log.info("done: copy assets", `(${ppt(end)})`);
|
log.info("done: copy assets", `(${ppt(end)})`);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ h.watch("resources/templates", null, async function (path) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
log.info("watch: assets (~)")
|
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);
|
log.info("changed:", path);
|
||||||
await h.compileSvgSprites();
|
await h.compileSvgSprites();
|
||||||
await h.copyAssets();
|
await h.copyAssets();
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ function run-devenv-tmux {
|
|||||||
start-devenv
|
start-devenv
|
||||||
fi
|
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 {
|
function run-devenv-shell {
|
||||||
|
|||||||
Reference in New Issue
Block a user