code: def update_index_file(
      ui_root: str, info: Optional[AppInfo] = None, root_path: str = ""
  ) -> None:
      import shutil
      from pathlib import Path
  
      entry_file = Path(ui_root) / "index.html"
      original_file = Path(ui_root) / "index.original.html"
  
      if not original_file.exists():
          shutil.copyfile(entry_file, original_file)  # keep backup
      else:
          # revert index.html in case it was modified after creating original.html
          shutil.copyfile(original_file, entry_file)
  
      if info:
          with original_file.open() as f:
              original = f.read()
  
          with entry_file.open("w") as f:
              f.write(
                  _get_updated_content(
                      original=original, root_path=root_path, info=info
                  )
              )
  
      if root_path:
          root_path_without_slash = (
              root_path.replace("/", "", 1)
              if root_path.startswith("/")
              else root_path
          )
          src_dir = Path(ui_root)
          dst_dir = src_dir / root_path_without_slash
  
          if dst_dir.exists():
              shutil.rmtree(dst_dir, ignore_errors=True)
          # copy everything except the current root_path, this is to fix a bug if user specifies
          # /abc at first and then /abc/def, server don't start
          # ideally we should copy everything except custom root_path that user passed.
          shutil.copytree(
              src_dir,
              dst_dir,
              ignore=shutil.ignore_patterns(
                  f"{root_path_without_slash}*"
              ),
          )
  
imports: from dataclasses import dataclass
  from typing import List, Optional
  from bs4 import BeautifulSoup
label_desc: Use image node_id 1 for calling a global function with example usage: update_index_file(ui_root, info, root_path) without return types