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

yaml-js-include

v1.0.0

Published

Extension for yaml-js library to be able to include files/directories in yaml files

Downloads

122

Readme

yaml-js-include

This package provides support custom tags in a YAML document that facilitate inclusion of external .yaml files, or directories of .yaml files. This package is a rethink of the yaml-include package.

The main difference between this package and package mentioned above is a support for relative include inside of the included files

Installation

$ npm install yaml-js-include

or

$ yarn add yaml-js-include

Usage

Here is a small example of the script which allows to load a YAML file with the include tags:

import { YamlInclude } from 'yaml-js-include';

const yamlInclude = new YamlInclude();
const myObj = yamlInclude.load<MyType>(pathToFile);

An example YAML file can look like this:

name: Example
variables: !!inc/file variables.yaml
pages: !!inc/dir ['pages', { extensions: ['.page.yaml'] }]
steps:
  - name: Open Browser
    type: open-browser
    values:
      browser: chrome
      headless: true

Full example could be found here

YAML API

This package adds the support for the following tags inside of YAML files:

!!inc/dir [path, options?]

Merges files in directory into the object

Arguments:

  • path - required - Relative (or absolute) path to the directory
  • options - optional - Optional options for the directory include tag. Extends IncludeDirOptions The merge flow for the options is like this: Default options -> Options passed to the YamlInclude constructor -> Options declared on the tag inside YAML file.

You can find options and defaults here

!!inc/seq [path, options?]

Merges files in directory into the array

Arguments:

  • path - required - Relative (or absolute) path to the directory
  • options - optional - Optional options for the directory include tag. Extends IncludeDirSeqOptions The merge flow for the options is like this: Default options -> Options passed to the YamlInclude constructor -> Options declared on the tag inside YAML file.

You can find options and defaults here

!!inc/file path

Parses path as a path to a single YAML document. The contents of that document will be a mapping under the key the tag is used on.

JS / TS Usage

This package is written using Typescript. Please see the documentation