Skip to content
Snippets Groups Projects
Select Git revision
  • 7a87d353cb84285fc9666777a4cf517dd5347aa7
  • main default protected
  • dependabot/go_modules/helm.sh/helm/v3-3.18.4
  • release/v2.6.x
  • dependabot/github_actions/ci-641206964f
  • conform-k8s-1.33
  • rfc-external-artifact
  • release/v2.5.x
  • release/v2.4.x
  • remove-notation-validation
  • release/v2.3.x
  • release/v2.2.x
  • RFC
  • fix-commit-log
  • flux-audit
  • release/v2.1.x
  • context-ns
  • ksm-dashboard
  • rfc-passwordless-git-auth
  • release/v2.0.x
  • rfc-gating
  • v2.6.4 protected
  • v2.6.3 protected
  • v2.6.2 protected
  • v2.6.1 protected
  • v2.6.0 protected
  • v2.5.1 protected
  • v2.5.0 protected
  • v2.4.0 protected
  • v2.3.0 protected
  • v2.2.3 protected
  • v2.2.2 protected
  • v2.2.1 protected
  • v2.2.0 protected
  • v2.1.2 protected
  • v2.1.1 protected
  • v2.1.0 protected
  • v2.0.1 protected
  • v2.0.0 protected
  • v2.0.0-rc.5 protected
  • v2.0.0-rc.4 protected
41 results

bootstrap_gitlab.go

Blame
  • pypi-status.service.js 1.59 KiB
    import PypiBase from './pypi-base.js'
    import { parseClassifiers } from './pypi-helpers.js'
    
    export default class PypiStatus extends PypiBase {
      static category = 'other'
    
      static route = this.buildRoute('pypi/status')
    
      static examples = [
        {
          title: 'PyPI - Status',
          pattern: ':packageName',
          namedParams: { packageName: 'Django' },
          staticPreview: this.render({ status: 'stable' }),
          keywords: ['python'],
        },
      ]
    
      static defaultBadgeData = { label: 'status' }
    
      static render({ status = '' }) {
        status = status.toLowerCase()
    
        const color = {
          planning: 'red',
          'pre-alpha': 'red',
          alpha: 'red',
          beta: 'yellow',
          stable: 'brightgreen',
          mature: 'brightgreen',
          inactive: 'red',
        }[status]
    
        return {
          message: status,
          color,
        }
      }
    
      async handle({ egg }) {
        const packageData = await this.fetch({ egg })
    
        // Possible statuses:
        // - Development Status :: 1 - Planning
        // - Development Status :: 2 - Pre-Alpha
        // - Development Status :: 3 - Alpha
        // - Development Status :: 4 - Beta
        // - Development Status :: 5 - Production/Stable
        // - Development Status :: 6 - Mature
        // - Development Status :: 7 - Inactive
        // https://pypi.org/pypi?%3Aaction=list_classifiers
        const status = parseClassifiers(
          packageData,
          /^Development Status :: (\d - \S+)$/,
        )
          .sort()
          .map(classifier => classifier.split(' - ').pop())
          .map(classifier => classifier.replace(/production\/stable/i, 'stable'))
          .pop()
    
        return this.constructor.render({ status })
      }
    }