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

ysed

v0.0.7

Published

YAML sed: Command line YAML editor.

Downloads

6

Readme

YAML sed

YAML sed helps you to modify yaml files from command line.

Installation

npm i -g ysed

To install npm see https://www.npmjs.com/get-npm.

Usage

ysed (<some_yaml_file.yaml>|<some_ysed_file.ysed>) [updates]

ysed reads the yaml file, applies specified updates and writes updated yaml into stdout.

This can be used with kubectl:

ysed <yaml> [updates] | kubectl apply -f -

Supported updates

Update specific path

some.path[index].to.element=new_value: If an element matches given path exactly in any YAML document in input file, value of that field will be updated to new_value.

Update an environment variable

env[ENV_VARIABLE_NAME]=new_value: Any environment variable in containers match ENV_VARIABLE_NAME, then it's value will be updated to new_value.

Update matching values

value[old_value]=new_value: Any value matching old_value will be updated to new_value.

Updates config

update_file.ysed: Each line in update_file will be processed like a command line update. If passed instead of yaml file as first parameter to ysed, then first line in ysed file is expected to be relative path to yaml template.

Example

file: my_yaml
for: demonstration
content:
  field1: value1
  field2: value2
  containers:
  - name: busybox1
    env:
    - name: VAR1
      value: value3
    - name: VAR2
      value: value4
---
file: doc2
for: demonstration
content:
  field3: value5
  field4: value6
  containers:
  - name: busybox2
    env:
    - name: VAR3
      value: value7
    - name: VAR4
      value: value8
    - name: VAR5
      value: value9

ysed demo.yaml content.containers[0].env[2].value=new_value1 env[VAR4]=new_value2 will print:

- file: my_yaml
  for: demonstration
  content:
    field1: value1
    field2: value2
    containers:
      - name: busybox1
        env:
          - name: VAR1
            value: value3
          - name: VAR2
            value: value4
- file: doc2
  for: demonstration
  content:
    field3: value5
    field4: value6
    containers:
      - name: busybox2
        env:
          - name: VAR3
            value: value7
          - name: VAR4
            value: new_value2
          - name: VAR5
            value: new_value1

Feature requests

If you've specific feature requests, send pull request in Github or message me.