Total Complexity | 1 |
Total Lines | 18 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import subprocess |
||
2 | from pathlib import Path |
||
3 | |||
4 | from hatchling.builders.hooks.plugin.interface import BuildHookInterface |
||
5 | |||
6 | |||
7 | class BuildHook(BuildHookInterface): |
||
8 | def initialize(self, version: str, build_data) -> None: |
||
9 | """Build frontend when building the wheel.""" |
||
10 | super().initialize(version, build_data) |
||
11 | |||
12 | root_dir = Path(__file__).parent |
||
13 | static = root_dir / "atramhasis" / "static" |
||
14 | static_admin = static / "admin" |
||
15 | subprocess.run(["npm", "install"], cwd=static, check=True) |
||
16 | subprocess.run(["npm", "install"], cwd=static_admin, check=True) |
||
17 | subprocess.run(["grunt", "-v", "build"], cwd=static_admin, check=True) |
||
18 |