feat: Add Markdown View Plugin with React and Chakra UI
- Implemented main application structure with App and View components. - Integrated React Markdown for rendering Markdown content. - Added API function to fetch Markdown content from the backend. - Created a custom Chakra UI theme to align with Airflow's design. - Configured Vite for building the application with appropriate asset paths. - Included a sample Markdown file for initial content display. - Set up TypeScript configuration for better development experience.
This commit is contained in:
24
markdown_view_plugin/hatch_build.py
Normal file
24
markdown_view_plugin/hatch_build.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# hatch_build.py
|
||||
import subprocess
|
||||
import pathlib
|
||||
import shutil
|
||||
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
||||
|
||||
class MarkdownBuildHook(BuildHookInterface):
|
||||
def initialize(self, version, build_data):
|
||||
# 1. Compile the UI exactly once per build
|
||||
ui_dir = pathlib.Path(__file__).parent / "ui"
|
||||
dist_dir = ui_dir / "dist"
|
||||
|
||||
# Clean any existing dist directory to ensure fresh build
|
||||
if dist_dir.exists():
|
||||
shutil.rmtree(dist_dir)
|
||||
|
||||
# Install dependencies and build the UI
|
||||
subprocess.run([
|
||||
"pnpm", "install", "--frozen-lockfile"
|
||||
], cwd=ui_dir, check=True)
|
||||
subprocess.run(["pnpm", "run", "build"], cwd=ui_dir, check=True)
|
||||
|
||||
# 2. Force-include the compiled assets in the wheel
|
||||
build_data["force_include"][str(dist_dir)] = "ui/dist"
|
||||
Reference in New Issue
Block a user