Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure client is copied along with components #5709

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-planes-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix: ensure all relevant packages are available to the custom component CLI
36 changes: 27 additions & 9 deletions .config/copy_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,33 @@

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

class BuildHook(BuildHookInterface):

class BuildHook(BuildHookInterface):
def initialize(self, version: str, build_data: dict[str, Any]) -> None:
NOT_COMPONENT = ["app", "node_modules", "storybook", "playwright-report", "wasm", "workbench", "tooltils"]
NOT_COMPONENT = [
"app",
"node_modules",
"storybook",
"playwright-report",
"wasm",
"workbench",
"tooltils",
]
for entry in (pathlib.Path(self.root) / "js").iterdir():
if (entry.is_dir() and
not str(entry.name).startswith("_") and
not str(entry.name) in NOT_COMPONENT):
shutil.copytree(str(entry),
str(pathlib.Path("gradio") / "_frontend_code" / entry.name),
ignore=lambda d, names: ["node_modules"],
dirs_exist_ok=True)
if (
entry.is_dir()
and not str(entry.name).startswith("_")
and not str(entry.name) in NOT_COMPONENT
):
shutil.copytree(
str(entry),
str(pathlib.Path("gradio") / "_frontend_code" / entry.name),
ignore=lambda d, names: ["node_modules"],
dirs_exist_ok=True,
)
shutil.copytree(
str(pathlib.Path(self.root) / "client" / "js"),
str(pathlib.Path("gradio") / "_frontend_code" / "client"),
ignore=lambda d, names: ["node_modules"],
dirs_exist_ok=True,
)
Loading