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

scaffold-it

v2.3.0

Published

A simple prompt based way to generate your projects from a file scaffolding.

Downloads

18

Readme

scaffold-it

Generate projects from scaffolds.

Usage:

npm install -g scaffold-it
scaffold-it install [email protected]:example/scaffold-example.git
scaffold-it template scaffold-example ./my-new-project

Subcommands

install

scaffold-it install <source>

source is a git repo. It will be cloned into ~/.scaffold-it and can be subsequently used in scaffold-it template.

list

scaffold-it list

Will show all installed templates.

template

scaffold-it [options] template <template-name> <destination>

This is also the default command, so template can be left out:

scaffold-it [options] <template-name> <destination>

The destination is where your scaffolding will be templated to. It can be a relative or absolute path.

Options

  • -o, --override - Override any existing files.
  • -p, --open - Open template characters, Defaults to {{{%
  • -c, --close - Close template characters. Defaults to %}}}

update

scaffold-it update <template-name>

Update the named template with a git pull from origin.

Template Directory Structure

project
|  README.md
|  package.json
|__template
   | template-variables.json
   | <other template files>
|__hooks
   | pre.hook
   | post.hook

README.md, package.json, and hooks directory are not required for the template to run successfully.

Templating

The prompts for generating the questions required for the scaffolding will be created from template-variables.json.

The delimiters are {{{% and %}}}.

A sample template-variables.json:

{
    "project_name" : "{{{%= project_name %}}}",
    "project_slug": {
        "description": "Used as the staging subdomain",
        "value" : "{{{%= project_slug %}}}"
    }
}

The questions are created from the keys of template-variables.json. If the value has a description field, then the description will be concatenated.

Template variables can be used within files or in file names.

After running the command and filling out the prompts, your new project will be at destination. template-variables.json will be at the root of your project, and you can use that file to double check the variables that were used to create your project.

Hooks

Your template can contain hook files that can run arbitraty commands both before and after the scaffold. There are two types of hooks:

Pre:

  • Runs: right before the scaffold process
  • File Name: pre.hook

Post:

  • Runs: Right after the scaffold process.
  • File Name: post.hook

Both hooks should be located in the hooks directory and receive the a JSON.stringified version of the template variables and their values as the first argument.

Glob ignore

If you wish to ignore certain glob patterns for templating, then include a globeignore.js file in the root of your template project. This file can export a string or array of strings. For example if you want to do an npm install in the pre hook, but not template the node_modules then you would do:

module.exports = 'node_modules/**';

Any ignored files will not be copied into the templated site.

Tests

npm test will prompt and then generate to ./test/output.