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

garland

v0.2.0

Published

A folder hierarchy builder based on tags and symbolic links

Downloads

4

Readme

garland

A folder hierarchy builder based on tags and symbolic links.

Install

npm install --global garland
# or
yarn add garland

Usage

Usage: garland [options] [command]

A folder hierarchy builder based on tags and symbolic links

Options:
  -V, --version                 output the version number
  --tag-definitions <filename>  tag definitions file
  -h, --help                    display help for command

Commands:
  tags                          list all tags
  build <blueprint>             build folder hierarchy
  test <expression>             test condition expression
  help [command]                display help for command

Tag definitions file

The tag definitions file is a YAML file with path and tag pairs.

When used in the garland build, the path in the tag definitions file is relative to the path of the file.

Structure:

interface ITagDefinitions {
  [path: string]: string[] | ITagDefinitions
}

Example 1:

example1.com:
  owner1:
    repo1: [tag1, tag2]

  owner2:
    repo2: [tag2, tag3]

example2.com:
  owner3:
    repo3: [tag3, tag4]

Example 2 (equivalent to Example 1):

example1.com/owner1/repo1: [tag1, tag2]
example1.com/owner2/repo2: [tag2, tag3]
example2.com/owner3/repo3: [tag3, tag4]

Blueprint file

The blueprint file is a YAML file with path and condition expression pairs.

When used in the garland build, the path in the blueprint file is relative to the path of current working directory.

The $condition field is used to write related condition expression (see below), When a path has multiple $condition fields, the logic and is implicitly included.

Structure:

interface IBlueprint {
  $condition?: string
  [path: string]: IBlueprint | null
}

Example:

# Create a folder `match-condition` and link all items that match condition `tag` there.
match-condition:
  $condition: tag

# Just create a folder `no-condition`.
no-condition:

# Create a folder `match-condition/subpath` and link all items that match condition `tag` there.
match-condition:
  $condition: tag
  subpath:
# Equivalent to 
match-condition:
  subpath:
    $condition: tag
# Equivalent to 
match-condition/subpath:
  $condition: tag

# Create folder `mulitple-conditions/subpath-a` and `multiple-conditions/subpath-b`.
# Link all items that match condition `common-tag and tag-a` to `mulitple-conditions/subpath-a`.
# Link all items that match condition `common-tag and tag-b` to `mulitple-conditions/subpath-b`.
multiple-conditions:
  $condition: common-tag
  subpath-a:
    $condition: tag-a
  subpath-b:
    $condition: tag-b
# Equivalent to 
multiple-conditions:
  subpath-a:
    $condition: common-tag and tag-a
  subpath-b:
    $condition: common-tag and tag-b
# Equivalent to 
multiple-conditions/subpath-a:
  $condition: common-tag and tag-a
multiple-conditions/subpath-b:
  $condition: common-tag and tag-b

Condition expression

Condition expression is a DSL represented by strings, which is used to perform logical operations on tags.

Tags are used as identifiers in this DSL, limited by the parser, identifiers can only use [a-zA-Z0-9_-] characters. Tags that exist are true values, and tags that do not exist are false values.

Keywords:

  • and
  • or
  • not
  • xor
  • (, )

Operator precedence:

  • (, )
  • not
  • and
  • xor
  • or

Suggestion

The tags used by garland should follow minimalism:

  • If you don't use the tag, there is no reason to remain it.
  • Do not use tags as a kind of notes or comments.
  • Only add the tags you will use in garland to avoid the number of tags growing to the point of being unmanageable.