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

atropa-package-generator

v0.2.4

Published

A node.js module for generating templated files and directory structures without gettting heavy with configs and strange language.

Downloads

6

Readme

atropa-package-generator

A node.js module for generating templated files and directory structures without gettting heavy with configs and strange language.

Installation

npm install atropa-package-generator

Usage

The command line interface takes four arguments, the package name, the output directory, template options, and the template to use. Additional properties and the template directory are optional. If no template directory is specified the default template will be used.

atropa-package-generator <package name> <output directory> [[additional property(ies)]...] [template directory]

The following commands should be run from the root of the package where atropa-package-generator is installed.

node_modules/.bin/atropa-package-generator --help

To generate the default package skeleton from the command line do:

node_modules/.bin/atropa-package-generator my-package ./node_modules

To generate a package skeleton from your own template do:

node_modules/.bin/atropa-package-generator my-package ./node_modules ./my-template

Additional properties for the template may be specified on the command line by separating the property and value with a colon extra_property:awesome. You may specify as many additional properties as you want. The template properties are to be specified before the template directory. For the default template you could specify the author name and it would appear in both the package.json file and the Readme.md file generated. The command would look like this:

node_modules/.bin/atropa-package-generator my-package ./node_modules authorName:bill

To do the same in your own template the command would be:

node_modules/.bin/atropa-package-generator my-package ./node_modules authorName:bill ./my-template

Additional properties available in the default template are: packageVersion, packageDescription, githubUserName, organization, authorName, authorEmail, authorUrl, licenseType, licenseUrl, codeLicenseBlock, htmlLicenseBlock

To generate the default package skeleton from scripts do:

var atropaPackageGenerator = require('atropa-package-generator');
atropaPackageGenerator.generate({
        packageName : 'your-package',
        outputDirectory : './node_modules'
});
// generates your-package in the node_modules folder. Go edit it.

Custom Templates

Templates are just regular directories and files. For a template called bob, the directory structure would look like this:

bob/
  |_static/
  |_dynamic/

The contents of the static and dynamic subdirectories are merged into the generated package. Contents of the dynamic directory are run through mustache.js. Any options given to atropaPackageGenerator.generate are passed to mustache's view and are available for expansion anywhere. File contents, file names, and folder names may contain mustache tags. Take a look at the templates in the templates directory. It's easy to make your own.

var atropaPackageGenerator = require('atropa-package-generator');
atropaPackageGenerator.generate({
        packageName : 'your-custom-package',
        outputDirectory : './node_modules',
        TemplateDirectory : './bob',
        hello : 'hello template'
});
// generates your-custom-package in the node_modules folder, using the bob template.

For full documentation see the docs folder. There's advanced stuff in there, like how to use something other than mustache if you'd like.

Hacking

There are several other scripts listed in package.json for development and hacking on this module. They can be run with npm run-script followed by the scripts property corresponding to the script you want to run. For example, given a script called buildDocs, it could be run from the package root by:

npm run-script buildDocs