Skip to content

Commit

Permalink
Skip the copy_frontend.py hook in the Lite build
Browse files Browse the repository at this point in the history
  • Loading branch information
whitphx committed Mar 27, 2024
1 parent 3588ba4 commit ca296d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .config/copy_frontend.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
from __future__ import annotations

import shutil
import os
import pathlib
import shutil
from typing import Any

from hatchling.builders.hooks.plugin.interface import BuildHookInterface


SKIP_THIS_HATCH_HOOK = os.environ.get("BUILD_GRADIO_LITE", False)


def copy_js_code(root: str | pathlib.Path):
NOT_COMPONENT = [
"app",
Expand Down Expand Up @@ -52,6 +56,8 @@ def ignore(s, names):

class BuildHook(BuildHookInterface):
def initialize(self, version: str, build_data: dict[str, Any]) -> None:
if SKIP_THIS_HATCH_HOOK:
return
copy_js_code(self.root)


Expand Down
2 changes: 1 addition & 1 deletion js/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dev:lite:worker": "pnpm --filter @gradio/wasm dev",
"build": "vite build --mode production --emptyOutDir",
"cssbuild": "python ../../scripts/generate_theme.py --outfile ./src/lite/theme.css",
"pybuild:gradio": "cd ../../ && python -m build",
"pybuild:gradio": "cd ../../ && BUILD_GRADIO_LITE=true python -m build",
"pybuild:gradio-client": "cd ../../client/python && python -m build",
"pybuild": "run-p pybuild:*",
"build:lite": "pnpm pybuild && pnpm cssbuild && pnpm --filter @gradio/client build && pnpm --filter @gradio/wasm build && vite build --mode production:lite",
Expand Down

0 comments on commit ca296d0

Please sign in to comment.