fix: Clean up imports and formatting in hatch_build.py and markdown_view_plugin.py

This commit is contained in:
2025-05-10 10:12:51 +00:00
parent 831c6051ea
commit 92a2b09bf2
3 changed files with 12 additions and 8 deletions

View File

@@ -1,9 +1,11 @@
# hatch_build.py
import subprocess
import pathlib
import shutil
import subprocess
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
@@ -15,9 +17,7 @@ class MarkdownBuildHook(BuildHookInterface):
shutil.rmtree(dist_dir)
# Install dependencies and build the UI
subprocess.run([
"pnpm", "install", "--frozen-lockfile"
], cwd=ui_dir, check=True)
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