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

scaffoldify

v0.0.3

Published

a scaffold framework to simplify scaffolding process

Downloads

11

Readme

scaffoldify

Declarative and reusable scaffolding framework. with scaffoldify configuration API, you can use JSON to describe the scaffolding process.

Table of Contents

Installation

npm install -g scaffoldify@latest

Usage

scaffoldify --help

Configuration

Configuration can either be a JSON file or CJS module that returns a JSON. when you run the scaffoldify command line and config option --config is not provided, it will lookup scaffoldify.config.js or .scaffoldifyrc file in current and user home directory.

const path = require('path');
const fs = require('fs');
module.exports = {
    cwd: '/path/to/your/working/directory',
    options: {},
    transform: value => value,
    templates: '/path/to/your/templates/folder',
    inquiries: [
        {
            type: 'input',
            name: 'projectName',
            message: 'Enter name for your react project:',
            default: 'my-react-project',
            validate: input => {
                if(!/^([a-z_-]+)+$/.test(input)) {
                    return 'only lower case characters allowed';
                }
                return true;
            },
        },
    ],
    mappers: [
        { from: 'index.js.tmpl', to: '[projectName]/src/index.js', overwrite: false},
        { from: 'index.test.js.tmpl',to: answers => `${answers.projectName}/src/__test__/index.js`},
        'package.json.tmpl => [projectName]/package.json?overwrite=false',
    ]
}

cwd

Currently working directory on based of which the template will be copied to. process.cwd() will be used if not specified.

options

initial config hashes passed along with inquiry answers to scaffoldify tool. A default empty object {} will be used if omitted.

transform

A custom function used to transform hashes before passing to scaffoldify tool. A default identify function value => value will be used if omitted.

templates

Location where the templates are defined.

inquiries

List of object to get user's inputs. It's based on Inquirer.

mappers

List of mapper which tells scaffoldify where to place template. the mapper definition takes two forms (object or string). If a mapper is not defined for the template, a default mapper path/to/your/template.ext.tmpl => path/to/your/template.ext will used.

from

path to your template file

to

the new location where your template will be placed. you can also use variables enclosed with brackets that will be resolved with hashes passed in. e.g [ui]/index.js will be resolved to ui/src/index.js given the hashes {ui: 'ui/src'}

overwrite

tell if you want to overwrite a file if it existed, a default value true will be used if omitted. if the mapper definition is string, a query parameter can be used to specify overwrite flag. below two mapper definitions are equivalent.

index.js.tmpl => [ui]/index.js?overwrite=false

{from: 'index.js.tmpl', to: '[ui]/index.js', overwrite: false}

Template

The template definition follows the syntax of Lodash template

Node API

const scaffoldify = require('scaffoldify');
const config = {
    ...
}
scaffoldify(config)