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

jumpstart

v0.4.0

Published

Creates projects from templates with placeholders.

Downloads

20

Readme

Jumpstart: Juice to get going Build Status Dependency Status

Jumpstart creates new projects from templates with placeholders.

Installation

You probably want to install jumpstart globally, so you can run it from anywhere. To get a sense of what jumpstart can do, you should install a template module as well. Currently, Jumpstart Black Coffee is the only one publicly available, so that makes it easy to choose.

npm install jumpstart -g
npm install jumpstart-black-coffee -g

Configuration

Jumpstart searches for a .jumpstart.json file within

  1. the current work directory
  2. your home directory -- for global configuration

Currently Jumpstart solely looks for a globals property inside the JSON data. If you specificy values for placeholders here, Jumpstart will use them to fill out the template, without asking you for it.

Placeholder names conform to the following pattern: [a-z]+(-[a-z]+)*, i.e. lowercase words separated with a dash (-).

Jumpstart will work without a configuration file, but it will be much less convenient to use.

Example of a .jumpstart.json file

Below is the .jumpstart.json file that I currently use for my open source projects. It defines values for most of the placeholders inside my Jumpstart Black Coffee template.

{
  "globals": {
    "author-name": "Braveg1rl",
    "author-email": "[email protected]",
    "github-username": "braveg1rl",
    "github-ownername": "braveg1rl",
    "github-repos-path": "/user/repos",
    "module-is-private": "false",
    "node-version": "0.10.x",
    "npm-version": "1.2.x",
    "commit-message": "jumpstart commit."
  }
}

A note about module-is-private

This property is set to the string "false". This is because Jumpstart does not know about booleans. Because of how the Jumpstart Black Coffee template is structured, setting this property to anything else than "true" or "false" would reduce in invalid JSON in the generated project.

Usage

Typically, you run jumpstart from your 'Work' directory (i.e. the directory that holds your project directories).

jumpstart [dirname] [template-name]

Jumpstart will search for a jumpstart template module within

  1. the current working directory
  2. the directory in which the jumpstart module is installed. This allows for distributing template modules via npm.

Jumpstart will read all files inside the jumpstart template and look for placeholders. Jumpstart will then ask for values of any placeholders it doesn't know a value for (either built-in or provided through a .jumpstart.json config file).

After getting values for all variables, Jumpstart creates the target directory, copies the contents of the template directory into the target directory and replaces the placeholders with their provided values. As a precaution, Jumpstart won't write to a directory that already exists.

At the moment the program's output is quite verbose, which helps with debugging, as well as understanding what's going on.

Creating jumpstart template modules

A jumpstart template module is a directory which name starts with jumpstart- followed by the module name. A jumpstart template module should contain a template directory which holds the actual template (freeing up the module root for metadata).

The files inside the template directory serve as templates for the files in the target directory. The template files are copied verbatim to the target directory, with the following exceptions:

1. Placeholder replacement

A placeholder string is a variable name with three dashes added on both sides. Examples of placeholders:

  • ---name---
  • ---author-email---
  • ---some-important-setting---

Placeholders can be placed anywhere, both inside and outside of what are considered strings in a particular language. This means the template files themselves may not be valid.

2. Special file names

To allow easy distribution of templates through npm, and to prevent any conflicts in what you want the template to be compared with how you want to edit it, jumpstart templates use special names for the following files:

  • package.json -- package.jumpstart.json
  • .tm_properties -- tm_properties.jumpstart
  • .gitignore -- gitignore.jumpstart
  • .npmignore -- npmignore.jumpstart

After copying all files to the target directory and applying values to placeholders.

Example file template (taken from a Makefile)

jumpstart:
	curl -u '---github-username---' https://api.github.com---github-repos-path--- -d '{"name":"---module-name---", "description":"---module-description---","private":---module-is-private---}'
	touch src/---module-name---.coffee
	git init
	git remote add origin [email protected]:---github-ownername---/---module-name---
	git add *
	git commit -m "---commit-message---"
	git push -u origin master

Using a template module

The easiest way to use your own template is to place it in your Work directory with the name jumpstart-yourtemplate. In your Work directory, you can then do jumpstart yournewproject yourtemplate.

Publishing a template module

The structure of a template module allows it to be published verbatim with npm. The module name (i.e. in package.json) must start with jumpstart-.

License

Jumpstart is released under the MIT License.
Copyright (c) 2017 Braveg1rl