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

centralized-boilerplate

v3.2.1

Published

A library for managing re-useable boilerplate files.

Downloads

16

Readme

Introduction

Welcome to the future. I'm glad you've made it. Take your shoes off and grab a warm cup of hot chocolate and a blanket, and sit down, only if you perfer, of course.

This project allows users to centrally control their boilerplate stuff. There are two sides to this, the side that provides the boilerplate, and the side that consumes the boilerplate. You can view examples of both in the examples folder.

Here is a list of cool, pre-made boilerplate:

How to use

If you're just getting familiar with this concept, then this is probably the right section for you.

  1. Add the package as a dev dependency. In the following example, it will be called centralized-boilerplate.something but you should replace this with a specific package.
    npm install centralized-boilerplate.something --save-dev
  2. Add the boil command in your package.
    "scripts": {
      "boil": "node ./node_modules/centralized-boilerplate.something/bin/run.js"
    }
  3. Run the command.
    npm run boil
  4. Scream in horror as computers are beginning to take your job. See here for an example: https://github.com/pizza-programming-party/centralized-boilerplate/tree/main/examples/base-consumer

Don't like a decision a maintainer made?

Then sue them! Wait... no, that's not what the script says. Ahem. Then blacklist it. In the root folder of your project, you can create a file called centralized-boilerplate.json and add the following.

{
  "blacklist": [
    [ "whatever.txt" ]
  ]
}

Where blacklist is an array of filenames you do not want touched.

To create your own

If you company has specific boilerplate code you need in each repoistory, or if there isn't a boilerplate for your usecase yet, then these are the steps for you.

  1. Create an npm package. The recommended naming style is centralized-boilerplate.x. Where x is something useful to you, like package, service, or something else. It depends how you conceptually group your stuff. You might want to maintain multiple packages, depending on your groupings. If you have a private NPM organization, then you can of course do @scope/centralized-boilerplate.x
  2. Add this package as a dependency.
  3. Add an assets folder and put cool things in it. Note: files that begin with a period are not published by NPM, so you should not name them like as so, but this library allows you to rename files when they are copied.
  4. Create a file ./bin/boil, put this code in there:
    #! /usr/bin/env node
    
    const r = require('centralized-boilerplate')
    const path = require('path')
    
    r.run(path.resolve(__dirname, '..'), [
      {
        source: [ 'gitignore' ],
        destination: [ '.gitignore' ]
      }
    ])
  5. Make the file executable. chmod +x boil
  6. Add the following to the package.json file. (TODO: is this really needed?)
    {
      "name": "..."
      ...
      ...
      "bin": {
        "boil": "./bin/boil"
      }
    }
  7. Boom! You're done! See here for an example: https://github.com/pizza-programming-party/centralized-boilerplate/tree/main/examples/base-provider