Integrate plugin runtime as npm library (#6852)

This commit is contained in:
Juanfran 2025-07-07 09:46:07 +02:00 committed by GitHub
parent bcb69b6227
commit 0a7d6d98e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 58 additions and 8619 deletions

View file

@ -440,17 +440,11 @@ async function generateTemplates() {
"../public/images/sprites/assets.svg": assetsSprite,
};
const pluginRuntimeUri =
process.env.PENPOT_PLUGIN_DEV === "true"
? "http://localhost:4200/index.js?ts=" + manifest.ts
: "plugins-runtime/index.js?ts=" + manifest.ts;
content = await renderTemplate(
"resources/templates/index.mustache",
{
manifest: manifest,
translations: JSON.stringify(translations),
pluginRuntimeUri,
isDebug,
},
partials,
@ -577,10 +571,6 @@ 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

@ -32,6 +32,9 @@ const config = {
entryPoints: ["target/index.js"],
bundle: true,
format: "iife",
banner: {
js: '"use strict";',
},
outfile: "resources/public/js/libs.js",
plugins: [fixReactVirtualized, rebuildNotify],
};

View file

@ -80,7 +80,7 @@ h.watch("translations", null, async function (path) {
log.info("watch: assets (~)");
h.watch(
["resources/images", "resources/fonts", "resources/plugins-runtime"],
["resources/images", "resources/fonts"],
null,
async function (path) {
log.info("changed:", path);

View file

@ -79,7 +79,7 @@ h.watch("translations", null, async function (path) {
log.info("watch: assets (~)");
h.watch(
["resources/images", "resources/fonts", "resources/plugins-runtime"],
["resources/images", "resources/fonts"],
null,
async function (path) {
log.info("changed:", path);