diff --git a/docker/devenv/files/nginx.conf b/docker/devenv/files/nginx.conf index f7926c42ef..a25ab35a72 100644 --- a/docker/devenv/files/nginx.conf +++ b/docker/devenv/files/nginx.conf @@ -121,7 +121,7 @@ http { proxy_http_version 1.1; } - location /mcp { + location /plugins/mcp { alias /home/penpot/penpot/mcp/packages/plugin/dist; proxy_http_version 1.1; } diff --git a/docker/images/files/nginx.conf.template b/docker/images/files/nginx.conf.template index b5a8605959..89ab0d66a6 100644 --- a/docker/images/files/nginx.conf.template +++ b/docker/images/files/nginx.conf.template @@ -129,6 +129,11 @@ http { proxy_buffering off; } + location /plugins { + alias /var/www/app/plugins; + proxy_http_version 1.1; + } + location /readyz { access_log off; proxy_pass $PENPOT_BACKEND_URI$request_uri; diff --git a/frontend/scripts/build b/frontend/scripts/build index 4c5a5f76a0..262a90ff45 100755 --- a/frontend/scripts/build +++ b/frontend/scripts/build @@ -4,8 +4,6 @@ set -ex -export INCLUDE_STORYBOOK=${BUILD_STORYBOOK:-no}; -export INCLUDE_WASM=${BUILD_WASM:-yes}; export EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS; export BUILD_DATE=$(date -R); @@ -18,6 +16,8 @@ export VERSION_TAG="${VERSION}-${BUILD_TS}"; # performant code on macros (example: rumext) export NODE_ENV=production; +rm -rf node_modules; + corepack enable; corepack install; pnpm install; @@ -28,10 +28,17 @@ rm -rf resources/public; mkdir -p resources/public; mkdir -p target/dist; +# Build render wasm binary pushd ../render-wasm; ./build popd +pushd ../mcp; +rm -rf node_modules; +./scripts/setup +WS_URI="/mcp/ws" pnpm run --filter "mcp-plugin" build:multi-user +popd; + pnpm run build:app:main $EXTRA_PARAMS; pnpm run build:app:libs; pnpm run build:app:assets; @@ -40,8 +47,6 @@ sed -i "s/\.\/render.js/.\/render.js?version=$VERSION_TAG/g" resources/public/js rsync -avr resources/public/ target/dist/ -if [ "$INCLUDE_STORYBOOK" = "yes" ]; then - # build storybook - pnpm run build:storybook || exit 1; - rsync -avr storybook-static/ target/dist/storybook-static; -fi +# Include the MCP plugin on the bundle +mkdir -p target/dist/plugins/mcp/; +rsync -avr ../mcp/packages/plugin/dist/ target/dist/plugins/mcp/ diff --git a/frontend/scripts/build-storybook b/frontend/scripts/build-storybook index 0d94421821..f94b434df4 100755 --- a/frontend/scripts/build-storybook +++ b/frontend/scripts/build-storybook @@ -13,7 +13,7 @@ export VERSION_TAG="${VERSION}-${BUILD_TS}"; export NODE_ENV=production; corepack enable; -corepack install || exit 1; -pnpm install || exit 1; +corepack install; +pnpm install; -pnpm run build:storybook || exit 1; +pnpm run build:storybook; diff --git a/mcp/packages/plugin/vite.config.ts b/mcp/packages/plugin/vite.config.ts index 82613250ff..38e610f247 100644 --- a/mcp/packages/plugin/vite.config.ts +++ b/mcp/packages/plugin/vite.config.ts @@ -1,14 +1,14 @@ import { defineConfig } from "vite"; import livePreview from "vite-live-preview"; -// Debug: Log the environment variables -console.log("MULTI_USER_MODE env:", process.env.MULTI_USER_MODE); -console.log("Will define IS_MULTI_USER_MODE as:", JSON.stringify(process.env.MULTI_USER_MODE === "true")); +let WS_URI = process.env.WS_URI || "http://localhost:4402"; +let MULTI_USER_MODE = process.env.MULTI_USER_MODE === "true"; -let WS_URI = "http://localhost:4402"; +console.log("Will define IS_MULTI_USER_MODE as:", JSON.stringify(MULTI_USER_MODE)); console.log("Will define PENPOT_MCP_WEBSOCKET_URL as:", JSON.stringify(WS_URI)); export default defineConfig({ + base: "./", plugins: [ livePreview({ reload: true,