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

@frontside/scaffolder-yaml-actions

v0.3.2

Published

Collection of actions for manipulation content of YAML documents

Downloads

337

Readme

@frontside/scaffolder-yaml-actions

This package provides a collection of actions

Installation

  1. Add @frontside/scaffolder-yaml-actions to packages/backend/package.json
  2. Add the following code to packages/backend/src/plugins/scaffolder.ts
import { createYamlSetAction, createYamlAppendAction } from '@frontside/scaffolder-yaml-actions';

export default async function createPlugin({
  logger,
  config,
  database,
  reader,
  discovery,
  identity
}: PluginEnvironment): Promise<Router> {
  const catalogClient = new CatalogClient({ discoveryApi: discovery });
  const integrations = ScmIntegrations.fromConfig(config);
  const builtInActions = createBuiltinActions({
    integrations,
    catalogClient,
    config: config,
    reader: reader,
  });
  const actions = [
    ...builtInActions,
    createYamlSetAction({
      logger, 
      integrations,
      reader,
    }),
    createYamlAppendAction({
      logger, 
      integrations,
      reader,
    }),
   ];
  return await createRouter({
    logger,
    config,
    database,
    catalogClient,
    identity,
    reader,
    actions,
  });
}

API

These actions takes an URL of YAML document, downloads it using fetch:plain, apply the change to the YAML document and saves the change in the workspace.

Note: Ideally, we'd could use fetch:plain:file in the workflow without executing it in the action. Unfortunately, this is not possible because fetch:plain:file doesn't work correctly with GitHub right now due to https://github.com/backstage/backstage/issues/17072. The current action relies on fetch:plain to download the entire directory which is quite heavy for editing a single file.

yaml:set

Set the contents of a YAML document.

Input:

  • url [string] - URL of the YAML file or file system path [example: https://github.com/backstage/backstage/tree/master/catalog-info.yaml]
  • path [string] - the path of the property to set [example: metadata.name]
  • value [string | number | *null] - value to set
  • entityRef [string, optional] - entity ref of entity to update in case YAML file contains multiple documents

Output:

  • repoUrl [string] - URL string used to identify repository
  • filePath [string] - path of updated file relative to the root
  • path [string] - directory name where the file is located

yaml:append

Append a value to a collection in a YAML document.

Input:

  • url [string] - URL of the YAML file or file system path (relative or absolute) [example: https://github.com/backstage/backstage/tree/master/catalog-info.yaml]
  • path [string] - the path of the property to update [example: metadata.tags]
  • value [string | number | null | Record<string, any>] - value to append
  • entityRef [string, optional] - entity ref of entity to update in case YAML file contains multiple documents

Output:

  • repoUrl [string] - URL string used to identify repository
  • filePath [string] - path of updated file relative to the root
  • path [string] - directory name where the file is located