From ce52575aca4327b8224a9d4f61e6acf58ab3e637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jim=20Br=C3=A4nnlund?= Date: Wed, 12 Apr 2023 15:12:17 +0200 Subject: [PATCH] Chore: Add npm build hooks --- pyproject.toml | 3 +++ scripts/npm.py | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 scripts/npm.py diff --git a/pyproject.toml b/pyproject.toml index ce5d6bcc..18b99087 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,3 +91,6 @@ exclude = [ [tool.hatch.build.hooks.vcs] version-file = "src/pytest_html/__version.py" + +[tool.hatch.build.hooks.custom] +path = "scripts/npm.py" diff --git a/scripts/npm.py b/scripts/npm.py new file mode 100644 index 00000000..4624e69c --- /dev/null +++ b/scripts/npm.py @@ -0,0 +1,9 @@ +import subprocess + +from hatchling.builders.hooks.plugin.interface import BuildHookInterface + + +class NpmBuildHook(BuildHookInterface): + def initialize(self, version, build_data): + subprocess.check_output("npm install", shell=True) + subprocess.check_output("npm run build", shell=True)