Skip to content

Latest commit

 

History

History
75 lines (57 loc) · 1.76 KB

DEVELOPER_GUIDE.md

File metadata and controls

75 lines (57 loc) · 1.76 KB

How to work on this plugin

Note: This guide assumes you use yarn v1.

  1. Clone this plugin repository

  2. Create a backstage app (outside the plugin repository). If you already have one, skip this step.

npx @backstage/create-app
  1. Link the react libraries from backstage to the plugin with the following commands
# Go to the root of the Backstage app/repository
yarn link --cwd node_modules/react
yarn link --cwd node_modules/react-dom
yarn link --cwd node_modules/react-router-dom
yarn link --cwd node_modules/react-router
yarn link --cwd node_modules/@material-ui/core

# Go to the root of the plugin repository
sh yarn-links.sh
  1. Add the plugin to the Backstage app
# Go to the root of the Backstage repository
yarn add --cwd packages/app backstage-plugin-snyk
  1. Build your plugin (and watch for changes)
# Go to the root of the plugin repository
yarn build --watch
  1. Add the needed components in the Backstage app as the README.md explains

  2. Add Snyk configuration to the Backstage app

proxy:
  endpoints:
    /snyk:
      target: https://api.snyk.io/
      headers:
        User-Agent: tech-services/backstage-plugin/1.0
        Authorization: token ${SNYK_TOKEN}
snyk:
  # Set to "false" to use the real API
  mocked: true
  1. Make sure to add annotations to an entity so the plugin shows in the entity page
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: example-website
  annotations:
    snyk.io/org-id: 57059599-0459-4443-9cac-3116b5fb5549
    snyk.io/project-ids: 33afab43-260a-498e-4432-f556843d2ebe
  1. You can now start the Backstage app and work in both repositories to see the changes in real time!
# Root of the Backstage repository
yarn dev