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

@axis-backstage/plugin-readme

v0.12.0

Published

Welcome to the readme plugin!

Downloads

6,786

Readme

Readme plugin

Welcome to the readme plugin!

readme-card

Introduction

The Readme-plugin enables easy access and viewing of the README file. By having information such as the project's purpose, usage instructions, or installation details as a central part of the EntityPage, we hope to improve the onboarding and understanding of entities.

The plugin supports all ScmIntegrations, like Gerrit & GitLab. This makes it possible for organizations with many Source Code Integrations to use the same plugin.

It also supports various file extentions such as README.md, README.MD, README.txt, README, and README.rst.

Where can the plugin find my README file?

The README.md file is always retrieved from the same directory as the catalog-info.yaml file, also known as the entity source location. If you wish to view the path where the plugin looks for your README.md file, you can find it in the backstage.io/source-location annotation in the catalog-info.yaml file. This annotation is automatically added to your entity, so there is no need to add it manually.

The displays README files with one of the following file types: md, MD, rst, or txt. The plugin can also handle symlinks.

Currently, placing your README.md file elsewhere than in the same directory as the catalog-info.yaml file repository is not supported.

Readme Backend

You need to set up the Readme Backend plugin before you move forward with any of these steps if you haven't already.

Getting started

  1. First, install the plugin into your app:
# From your Backstage root directory
yarn --cwd packages/app add @axis-backstage/plugin-readme
  1. Then, modify your entity page in EntityPage.tsx to include the ReadmeCard component that is exported from the plugin to `overviewContent``.
// In packages/app/src/components/catalog/EntityPage.tsx
import { ReadmeCard } from '@axis-backstage/plugin-readme';

const overviewContent = (
...
  <Grid item md={6} xs={12}>
      <ReadmeCard />
  </Grid>
  ...
)

If you wish to only render the ReadmeCard if a README file can be found for the entity, you can use the exported function isReadmeAvailable. See example below:

import { ReadmeCard, isReadmeAvailable } from '@axis-backstage/plugin-readme';

const defaultEntityPage = (
...
     <EntitySwitch>
      <EntitySwitch.Case if={isReadmeAvailable}>
        <Grid md={6} xs={12}>
          <ReadmeCard maxHeight={350} />
        </Grid>
      </EntitySwitch.Case>
    </EntitySwitch>
...
)

To use ReadmeCard in a seperate page with full height:

import { ReadmeCard } from '@axis-backstage/plugin-readme';

const defaultEntityPage = (
...
    <EntityLayout.Route path="/readme" title="README">
      <ReadmeCard variant="fullHeight" />
    </EntityLayout.Route>
...
)

Layout

The readme card is located in the overview page on the entity page. From the card header it is also possible to open a dialog displaying the full README.md.

readme-card

readme-dialog

Troubleshooting

"No README.md file found at the source location..."

This message indicates that the backend cannot find your README.md file. Ensure that the README.md file is indeed located in the same directory as the catalog-info.yaml file. If you are still unable to locate it, try scheduling an entity refresh by clicking the "Schedule Entity Refresh" button in the AboutCard of the entity.

Addition to this; ensure that backstage:source-location value has the trailing slash.

...
metadata:
  annotations:
    # This will not work
    backstage:source-location: https://bitbucket.org/org-name/repo-id/src/master
    # This value will work.
    backstage:source-location: https://bitbucket.org/org-name/repo-id/src/master/
...