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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@option26/scaffold

v1.1.0

Published

A command line utility that scaffolds projects

Downloads

47

Readme

Option 26 – Scaffold

A command line utility that allows to scaffold new projects.

Installation

Install the CLI with npm: npm i -g @option26/scaffold

Usage

If you want to create a new project from a template, run the scaffold command: scaffold [source] [target].

  • source can either be a relative or absolute path the template in your file system or alternatively a URL to a git repository.
  • target has to be a path (relative or absolute) to an empty folder in your filesystem.

Usage Examples

scaffold https://github.com/option26/template.git .         // Clones the repository from 'https://github.com/option26/template.git' and scaffolds the project to the current directory.
scaffold template/directory /full/target/directory          // Scaffolds the project from a template located at $CWD/template/directory to '/full/target/directory'.

Templating

In order to create a template, simply add a template.json file to the root of your template project directory. This files specifies all the information for the templating process.

Template Config

The template.json file has the following structure:

{
    // Template name (shown when scaffolding project).
    name: string;
    // Template description (shown when scaffolding project).
    description: string;
    // List of paths (globs allowed) to be excluded (i.e not copied) from the template. By default, **/.git and **/node_modules are excluded.
    exclude: string[];   
    // List of paths (globs allowed) to be ignored (i.e. copied but not parsed). Useful if a file contains nunjucks syntax.
    ignore: string[];
    // For each entry, if variable 'name' has specified 'value', all 'paths' are deleted in the final project (no globs allowed).
    cleanup: Array<{            
        name: string,
        value: any,
        paths: string[]
    }>;
    // List of variables that will be requested from the user. Follows structure of https://github.com/SBoudrias/Inquirer.js#readme
    variables: Array<{
        type: string;
        name: string;
        prompt: string;
        default: any;
        promptIf?: { name: string, value: any }; // Only as this, if variable 'name' equals 'value'
        validation?: { regex: string };
        choices?: any[];
    }>;
}

Process

The scaffolding process works as follows

  1. If the source is a git repository, clone it's content. Else, check if specified directory exists.
  2. Check if target directory exists and is empty
  3. Try to locate the template.json file in the source directory and read its contents
  4. Gather user input based on the variables property of the template configuration
  5. Iterate over each file/folder in the source directory and
    1. If the path is in the exclude array, skip this file/directory
    2. Else, parse the filename and fill template variables to determine output path (This is useful if you want to name files/folders based on user input)
    3. If the current path is in the ignore array, simply copy the file to the target
    4. Else, read the file content and fill template variables
    5. If the file was a folder, run the steps recursively
  6. For each entry in the cleanup array, check if the condition is true and if so, remove all specified paths from the target directory.
  7. If we cloned a template repository earlier, remove the temporary directory

Template Structure

Scaffold uses the nunjucks templating language to process files and paths in a project template.

You can use templating inside file paths by simply naming the file with a valid nunjucks template string and the filename will be replaced later. This can also be done for the paths in exclude, ignore and cleanup in template config.

Inside files, you can use the default nunjucks syntax including control statements and alike.

The values passed to the nunjucks environment are based on the user input given earlier. As described, this can be configured by specifying entries in the variables property.

Git

If you manage your template as a git repository, you might want to add .gitignore files. However, you might also want to template .gitignore files. As a result, there would be a naming conflict. You can resolve this as follows:

  1. Create a .gitignore file for your template repository just like you usually would.
  2. In your template config, add a new item to the exclude array: **/.gitignore
  3. Now, add the .gitignore files you want to template. In order to avoid a naming conflict, name them .gitignore{{template}}.

Examples

TODO