npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

backstage-plugin-jfrog-artifactory-libs

v1.0.11

Published

The Backstage `jfrog-artifactory-libs` frontend plugin provides a simple way to display generated artifact (library) details like - group, artifact, repository, what is the latest version, and it simply allows to copy library definition for the package ma

Downloads

4,156

Readme

Backstage JFrog artifactory libraries plugin

The Backstage jfrog-artifactory-libs frontend plugin provides a simple way to display generated artifact (library) details like - group, artifact, repository, what is the latest version, and it simply allows to copy library definition for the package managers.
Nowadays, the plugin supports these package managers types in JFrog: Maven, Gradle, Sbt, Pypi, Docker.

Demo

Installation

To install the plugin, you'll need to add it to your Backstage app's dependencies using either Yarn or NPM.

Yarn

yarn add --cwd packages/app backstage-plugin-jfrog-artifactory-libs

Integration

Once you've installed the plugin, you'll need to integrate it into your Backstage app. To do so, you'll need to following code into your BS instance:

JFrogLibArtifactCard

Add the JFrogLibArtifactCard component to the EntityPage.tsx in your app:

import {JFrogLibArtifactCard, isJfrogArtifactAvailable} from 'backstage-plugin-jfrog-artifactory-libs';
//....
const overviewContent = (
// ...
    <EntitySwitch>
        //...
        <EntitySwitch.Case if={isJfrogArtifactAvailable}>
            <Grid item md={4}>
                <JFrogLibArtifactCard/>
            </Grid>
        </EntitySwitch.Case>
        //...
    </EntitySwitch>
    // ...
);

JFrogLibVerPage

If you want to browse libraries you can enable this component in your App.tsx file. It shows all component entities containing jfrog.com/artifactory-artifact attribute.

Demo

const routes = (
  <FlatRoutes>
    //....
    <Route path="/libver" element={<JFrogLibVerPage topComponents={<DefineNewLibraryButton />} />}>
    </Route>
    //....
  </FlatRoutes>
);

Explore page - JFrogLibVerPageContent

This is a subcomponent of JFrogLibVerPage component. It's possible to integrate it for instance into your Explore page.

import { JFrogLibVerPageContent } from 'backstage-plugin-jfrog-artifactory-libs';
//....

        <ExploreLayout
                title={`Explore the ${organizationName} ecosystem`}
                subtitle="Discover solutions available in your ecosystem"
        >
              // ...
          <ExploreLayout.Route path="libver" title="Libraries">
            <JFrogLibVerPageContent />
            />
          </ExploreLayout.Route>
          //  ...
        </ExploreLayout>

    // ...
);

App-config.yaml

Set up a proxy for the JFrog API by adding the following configuration to your app-config.yaml file:

  '/artifactory-proxy/':
    target: 'https://your-jfrog-artifactory-instance.com'
    headers:
      # if you use Jfrog instance for anonymous user token is not required, but it is also required for Docker package type
      Authorization: Bearer ${ARTIFACTORY_TOKEN}
      X-Result-Detail: 'properties'
      Accept: '*'

You have to also reference your artifactory URL (used for UI browse links) and your proxy configuration.

jfrog:
  artifactory:
    url: 'https://your-jfrog-artifactory-instance.com'
    proxyPath: '/artifactory-proxy/' # optional, /artifactory-proxy/ is default value 

Catalog-info.yaml

Artifact details are correlated to Backstage entities using an annotation added in the entity's catalog-info.yaml file.

  metadata:
    annotations:
      # -- required values --
      jfrog.com/artifactory-artifact: 'artifact-name'
      jfrog.com/artifactory-repo: 'maven-local'

      jfrog.com/artifactory-group: 'com.mycompany' # optional string - can be blank for pypi, necessary for Maven repos

      # -- optional values --
      jfrog.com/artifactory-scope: 'compile' # optional string, one of these [compile, test,provided,runtime,classpath,optional]
      jfrog.com/artifactory-packaging: 'aar' #optional string, eg. `aar` 

And that's it! The plugin should now be integrated into your Backstage app, and you should see the Artifact card when you navigate to the entity page where it's included.

For a docker image you define repository and artifact name. Both formats are supported:

  metadata:
    annotations:
      # -- required values --
      jfrog.com/artifactory-artifact: 'docker.mydomain.com/mygroup/my/artifact-name' # or simply 'mygroup/my/artifact-name' 
      jfrog.com/artifactory-repo: 'docker-local'

Demo

Configuration

JFrogLibArtifactCard has following default properties:

LibArtifactCard.defaultProps = {
    title: 'Artifact', // title of the card
    browseRepositoryLinkTitle: 'Browse Repository', // Card deep link title
    showGradle: true, // whether to show Gradle package manager tab
    showMaven: true, // whether to  show Maven package manager tab
    showSbt: true, // whether to  show Sbt package manager tab
    showPip: true, // whether to  show Pip package manager tab
    showDockerfile: true, // whether to  show Dockerfile tab
    // it hides Maven and Gradle tabs if the current repository package type is `PyPi`
    autohideTabs: true,
    showBrowseRepositoryLink: true // whether to show Browse to URL deep link under bottom of the Card
    // which link to open
    browseLink: browseLinkDefault,
};

Support for scaffolding

In this document you can find detailed information how to integrate this plugin into scaffolding templates. It also adds a new extension UI component called ArtifactRepositoryPicker for interactive repository selection.

How it works

Plugin uses JFrog APIs to find latest version. It's necessary to specify ARTIFACTORY_TOKEN in the app-config.yaml file if you don't allow to access API for anonymous user.

Changes

Version 1.0.9

  • JFrogLibVerPageContent and JFrogLibVerPage components added
  • (!) renamed LibArtifactCard into JFrogLibArtifactCard

Contributing

Don't hesitate to contribute to the plugin. This is my first TypeScript/React/Backstage product so please be gentle to me...

Development

Copy plugin content into your plugins directory, and add a dependency into app/package.json as described above.

Future plans

  • More tests
  • More package managers support
  • Multiple artifacts defined in one entity
  • Multiple artifactories instances?

License

This plugin is licensed under the Apache 2.0 License.