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

bluprint

v0.4.0

Published

CLI app for easily creating and placing boilerplate code from predefined blueprints.

Downloads

17

Readme

bluprint

CLI app for easily creating and placing boilerplate code from predefined blueprints.

Installing

npm install bluprint -g
bluprint

Development

Clone the repo.

npm install
npm link
npm run watch

To clear the dummy files

npm run clear

Examples

For these examples our starting folder structure is:

project
│   README.md
│   .bluprintconfig
│   package.json
│
├───app
│   │   app.js
│
└───blueprints
    │   ...

Here's an application structure we want to blueprint and generate.

project
│   README.md
│   .bluprintconfig
│   package.json
│
└───app
    │   app.js
    │
    ├───components
    │   │   Todo.js
    │   │   List.js
    │
    └───actions
    │   todos.js
    │   filters.js

We will need to create two blueprints, one for components and one for actions. These will be placed in project/blueprints/__blueprint__.

Here's what a component blueprint for react might look like.

// component blueprint
// project/blueprints/component.js

'use strict'

import {
  Component,
  PropTypes
} from 'react'

export default class <% TEMPLATE_TOKEN pascalCase %> extends Component {
  render() {
    return (
      <div></div>
    );
  }
}

<% TEMPLATE_TOKEN pascalCase %>.propTypes = {

};

To generate a Todo component run

bluprint generate component Todo.

Which will output

// Todo component
// app/components/Todo.js

'use strict'

import {
  Component,
  PropTypes
} from 'react'

export default class Todo extends Component {
  render() {
    return (
      <div></div>
    );
  }
}

Todo.propTypes = {

};

bluprint also allows generation of application structures utilizing pods. Here's an example strucuture we want to blueprint and generate.

project
│   README.md
│   .bluprintconfig
│   package.json
│
└───app
    │   app.js
    │
    ├───components
    │   │   List.js
    │
    └───pods
        │
        └───todos
            │
            ├───components
            │   │   Item.js
            │   │   Form.js
            │
            ├───index
            │   │   component.js
            │   │   container.js
            │
            │   constants.js
            │   actions.js
            │   reducers.js
            │   routes.js

To generate into a pods subdirectory you will need to set the directory in the config and then use the --pod flag.

The file structure for a pod blueprint looks like this:

app
│   README.md
│   .bluprintconfig
│   package.json
│
└───blueprints
    │
    └───pod
        │
        ├───components
        │   │
        │
        │   constants.js
        │   actions.js
        │   reducers.js
        │   routes.js
        │   config.json

Since pod will always be generated using the pods structure we define "forcePods": true in the blueprint config.

Before we can generate any of the compoents for the pod we will need to generate the pod.

bluprint generate pod todos

Using the component blueprint from before we generate the three types of components in this example.

  • bluprint generate component List
  • bluprint generate component todos/index --pod
  • bluprint generate component todos Item --pod

Template Variables

TEMPLATE_TOKEN is the only currently available template variable. I will add more as the need arises.

Mutations

Several string mutations are available to help format the template variables. These can be applied as additional arguments in the template variables. See change-case repo for examples.

  • upperCase
  • lowerCase
  • capialize
  • sentenceCase
  • titleCase
  • camelCase
  • pascalCase
  • snakeCase
  • paramCase
  • dotCase
  • pathCase
  • constantCase
  • plural
  • singular

Config

Global and per blueprint config options are available. Here they are shown with their defaults.

Global

{
  "rootDirectory": "app",
  "podsDirectory": "pods", // Assumed as a sub directory of root
  "blueprintsDirectory": "blueprints"
}

Blueprint

{
  "forcePods": false
}