import re


def normalize_package_name(original_name: str) -> str:
    """
    Convert the raw name from ``package.json`` into the ``npm pack`` style name.

    Args:
        original_name: Name acquired from ``package.json``.

    Returns:
        Normalized name.
    """
    regex = re.compile(r"^(@(?P<group>[0-9a-z\-]+)/)?(?P<package>[0-9a-z\-]+)$")
    result = regex.match(original_name)
    if result and result.group("group"):
        normalized = "{0}-{1}".format(
            result.group("group"), result.group("package")
        )
    elif result:
        normalized = result.group("package")
    else:
        raise RuntimeError(
            "Unable to normalize package name, {0}".format(original_name)
        )

    return normalized