/node-module-starter-kit

Node module starter kit.

Primary LanguageJavaScriptMIT LicenseMIT

Node Module Starter Kit

NPM version Build Status Coverage Status Dependencies

Node module starter kit.

Installation

$ npm install @kgryte/node-module-starter-kit

Usage

var starter = require( '@kgryte/node-module-starter-kit' );

starter( dest[, opts ][, clbk ] )

Runs starter tasks.

var dir = 'path/to/a/directory';

starter( dir, done );

function done( error ) {
	if ( error ) {
		throw error;
	}
	console.log( 'Success!' );
}

The function accepts the following options:

  • name: module name.
  • desc: module description.
  • author: module author.
  • email: author email address.
  • keywords: keywords describing the module.
  • cmd: command name, if module is a CLI tool.
  • repo: module Github repository.
  • license: module license.
  • holder: copyright holder (the author and copyright holder may be different people/organizations).
  • browser: boolean indicating whether a module is browser compatible. Default: true.
  • git: boolean indicating whether to initialize a local Git repository. Default: true.
  • remote: boolean indicating whether to create a remote Github repository. Default: true.
  • star: boolean indicating whether to star a remote Github repository. Default: true.
  • ci: boolean indicating whether to initialize continuous integration. Default: true.
  • install: boolean indicating whether to run installation tasks. Default: true.
  • open: command to open a destination directory or false. Default: 'subl .'.
  • silent: boolean indicating whether to silence verbose logging. Default: false.
opts = {
	'name': 'example',
	'desc': 'An example module.',
	'author': 'Jane Doe',
	'email': 'janedoe@example.com',
	'keywords': [
		'beep',
		'boop',
		'bop'
	],
	'cmd': 'eg',
	'repo': 'janedoe/example',
	'license': 'MIT',
	'holder': 'D&D, Inc'
};

starter( dir, opts, done );

function done( error ) {
	if ( error ) {
		throw error;
	}
	console.log( 'Success!' );
}

Notes

Examples

To run the example code from the top-level application directory,

$ node ./examples/index.js

CLI

Installation

To use the module as a general utility, install the module globally

$ npm install -g @kgryte/node-module-starter-kit

Usage

Usage: nodemodule [options] [destination]

Options:

  -h,     --help                Print this message.
  -V,     --version             Print the package version.
          --name name           Module name.
  -desc,  --description desc    Module description.
          --author author       Module author.
          --email email         Author email.
          --keywords keywords   Keywords describing module; e.g., word1,word2,...
          --cmd cmd             Command-line interface command.
          --repo repo           Module repository.
          --license name        License. Default: 'MIT'.
          --holder holder       Copyright author.
  -o,     --open cmd            Command to open a destination directory. 
                                Default: 'subl .'.
          --no-browser          Module is not browser compatible.
          --no-git              Do not initialize a git repository.
          --no-remote           Do not initialize a remote git repository.
          --no-star             Do not star the remote git repository.
          --no-ci               Do not initialize continuous integration.
          --no-install          Do not run installation tasks.
          --no-open             Do not open module directory in a text editor.
          --silent              Do not display verbose logging.

Notes

  • By default, the destination directory is the current working directory.

Examples

$ cd ~/my/project/directory
$ nodemodule
# => runs starter tasks in the current working directory

To specify a destination other than the current working directory, provide a destination.

$ nodemodule ./../some/other/directory

Tests

Unit

This repository uses tape for unit tests. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ make view-cov

License

MIT license.

Copyright

Copyright © 2015-2016. Athan Reines.