Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@backstage/plugin-lighthouse-backend

Package Overview
Dependencies
Maintainers
3
Versions
466
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/plugin-lighthouse-backend

Backend functionalities for lighthouse

Source
npmnpm
Version
0.3.4
Version published
Maintainers
3
Created
Source

Lighthouse Backend

Lighthouse Backend allows you to run scheduled lighthouse Tests for each Website with the annotation lighthouse.com/website-url.

Setup

  • Install the plugin using:
# From your Backstage root directory
yarn add --cwd packages/backend @backstage/plugin-lighthouse-backend
  • Create a lighthouse.ts file inside packages/backend/src/plugins/:
import { createScheduler } from '@backstage/plugin-lighthouse-backend';
import { PluginEnvironment } from '../types';
import { CatalogClient } from '@backstage/catalog-client';

export default async function createPlugin(env: PluginEnvironment) {
  const { logger, scheduler, config } = env;

  const catalogClient = new CatalogClient({
    discoveryApi: env.discovery,
  });

  await createScheduler({ logger, scheduler, config, catalogClient });
}
  • Modify your packages/backend/src/index.ts to include:
 ...

 import { Config } from '@backstage/config';
 import app from './plugins/app';
+import lighthouse from './plugins/lighthouse';
 import scaffolder from './plugins/scaffolder';

 ...

 async function main() {

   ...

   const authEnv = useHotMemoize(module, () => createEnv('auth'));
+  const lighthouseEnv = useHotMemoize(module, () => createEnv('lighthouse'));
   const proxyEnv = useHotMemoize(module, () => createEnv('proxy'));

   ...

   const apiRouter = Router();
   apiRouter.use('/catalog', await catalog(catalogEnv));
   apiRouter.use('/scaffolder', await scaffolder(scaffolderEnv));

+  await lighthouse(lighthouseEnv)

New Backend System

The Lighthouse backend plugin has support for the new backend system, here's how you can set that up:

In your packages/backend/src/index.ts make the following changes:

  import { createBackend } from '@backstage/backend-defaults';
+ import { lighthousePlugin } from '@backstage/plugin-lighthouse-backend';
  const backend = createBackend();
  // ... other feature additions
+ backend.add(lighthousePlugin());
  backend.start();

Configuration

You can define how often and when the scheduler should run the audits:

lighthouse:
  schedule:
    days: 1

Keywords

lighthouse

FAQs

Package last updated on 14 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts