Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
pantsbuild.pants.contrib.node / contrib / node / subsystems / yarnpkg_distribution.py
Size: Mime:
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

import logging

from pants.binaries.binary_tool import NativeTool
from pants.binaries.binary_util import BinaryToolUrlGenerator

logger = logging.getLogger(__name__)


class YarnReleaseUrlGenerator(BinaryToolUrlGenerator):

    _DIST_URL_FMT = (
        "https://github.com/yarnpkg/yarn/releases/download/{version}/yarn-{version}.tar.gz"
    )

    def generate_urls(self, version, host_platform):
        return [self._DIST_URL_FMT.format(version=version)]


class YarnpkgDistribution(NativeTool):
    """Represents a self-bootstrapping Yarnpkg distribution."""

    options_scope = "yarnpkg-distribution"
    name = "yarnpkg"
    default_version = "v1.6.0"
    archive_type = "tgz"

    def get_external_url_generator(self):
        return YarnReleaseUrlGenerator()