How mendix/web-extension-template works
Main Components
• Extension Manifest & Public Assets:
– Represented by the “public” folder, containing the manifest.json. This defines the extension’s metadata and configuration required by Mendix Studio Pro.
• Extension Core:
– Found in “src/main/index.ts”. This file likely contains the core logic that integrates with Mendix Studio Pro, handling messaging and lifecycle events.
• UI Layer:
– Located in “src/ui/index.tsx”. This component is intended to handle the user interface for the extension (potentially using React, given the .tsx extension).
• Build & Configuration:
– The presence of package.json, tsconfig.json, and vite.config.ts indicates that Vite is used for bundling the code, with TypeScript as the language. Configuration files and build scripts form another conceptual component.
• Project Metadata & Miscellaneous:
– Files like .gitignore, LICENSE, and .editorconfig serve as peripheral components for project maintenance and code quality.
Relationships and Interactions
• The manifest, when processed, triggers the loading of the extension’s core code (src/main/index.ts) into the Mendix environment.
• The core code in src/main is responsible for initializing and managing the extension’s lifecycle. It may also call or inject the UI components from src/ui/index.tsx.
• The UI component, likely rendered in a browser-like environment or an embedded panel within Studio Pro, provides the user-facing aspect of the extension.
• The build configuration (vite.config.ts, package.json, tsconfig.json) ties all source code together for the build process (via npm run build) that outputs the final assets into the “dist/myextension” structure used by Mendix.
Architectural Patterns
• Modular Structure: Each top-level part (public assets, main logic, UI layer, and build configuration) forms an independent module that interacts through well-defined interfaces.
• Integration with External Systems: Emphasize the boundary where Mendix Studio Pro interacts with the extension, particularly via the manifest and runtime injection of the extension code.