Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@anakz/backstage-plugin-library-check-backend

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anakz/backstage-plugin-library-check-backend

Backstage.io Library Check plugin backend

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22
increased by10%
Maintainers
1
Weekly downloads
 
Created
Source

Library Check Backend

Welcome to the library-check-backend backend plugin!

This plugin was created through the Backstage CLI

Setup instructions:

Add the plugin to your backend app:

cd packages/backend && yarn add @anakz/backstage-plugin-library-check-backend

Create new file at packages/backend/src/plugins/libraryCheck.ts:


// packages/backend/src/plugins/libraryCheck.ts

import { PluginEnvironment } from '../types';
import { Router } from 'express';
import {
  DatabaseLibraryCheckStore,
  createRouter,
} from '@anakz/backstage-plugin-library-check-backend';

export default async function createPlugin({
  logger,
  database,
  config,
}: PluginEnvironment): Promise<Router> {
  const db = await DatabaseLibraryCheckStore.create({
    database: database,
  });
  return await createRouter({
    logger,
    database: db,
    config,
  });
}

Define the schedules for the plugin processor and provider on packages/backend/src/plugins/catalog.ts


// packages/backend/src/plugins/catalog.ts

// ...
builder.addEntityProvider(

    // add a new provider entry, configure the schedule frequency as you wish
    // initialDelay must be up to 15s to avoid conflicts

    LibraryCheckProvider.fromConfig({
      config: env.config,
      envId: 'production',
      logger: env.logger,
      discovery: env.discovery,
      schedule: env.scheduler.createScheduledTaskRunner({
        initialDelay: {
          seconds: 15,
        },
        frequency: {
          minutes: 60,
        },
        timeout: {
          minutes: 1,
        },
      }),
    }),

    // ...
)

// Add the new processor entries, and try to declare the LibraryCheckUpdater as the last in order.

  builder.addProcessor(
    // ...

    LibraryCheckProcessor.fromConfig(env.config, {
      discoveryService: env.discovery,
      reader: env.reader,
      logger: env.logger,
    }),

    // Other processors...
    
    LibraryCheckUpdaterProcessor.fromConfig(env.config, {
      discoveryService: env.discovery,
      reader: env.reader,
      logger: env.logger,
    }),

    // ...
  );


Now add the plugin to your packages/backend/src/index.ts:

import libraryCheck from './plugins/libraryCheck';

// ...
const libraryCheckEnv = useHotMemoize(module, () => createEnv('libraryCheck'));

// ...
  apiRouter.use('/library-check', await libraryCheck(libraryCheckEnv));

Keywords

FAQs

Package last updated on 02 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc