from pathlib import Path


def find_extension_file() -> Path:
    """Find the packaged extension file."""
    paths = list(Path("web-ext-artifacts/").glob("*.zip"))
    if len(paths) < 1:
        raise ValueError("Can't find extension file. Run `yarn build`.")
    elif len(paths) > 1:
        raise ValueError("Found multiple extension files. Run `yarn rebuild`.")
    else:
        return paths[0].resolve()