gulp-runner-tdp-plugin-helper-lib

1.0.3 • Public • Published

gulp-runner-tdp-plugin-helper-lib

Travis CI Coveralls - code coverage status

Overview

A helper library (to remove boilerplate) for gulp-runner-tdp plugins.

Currently, there are 2 public API methods:

  • getPluginConfig - finds the highest preference configuration file for the plugin from an array of possible paths
  • copyConfigFileToProjectRoot - copies a specified configuration file to the project root (which it will find automatically)

Semver

This project aims to maintain the semver version numbering scheme.

Changelog

See the changelog file

Requirements

  • Node runtime - either:
    • Node >= 0.12
    • IOJS >= 1.0
  • Installation:
    • NPM
    • Git/GitHub
  • gulp (obviously!)

NPM/Node package dependencies

Production

None!

development

Installation

Installation is super simple, in your command line terminal, just cd to your gulp-runner-tdp plugin project root and run:

npm install gulp-runner-tdp-plugin-helper-lib --save

Usage

This library is intended to be used in plugins for gulp-runner-tdp via a simple require. The library exposes just two public API methods (currently) and is stateless, therefore can be used as follows:

 
// NOTE: You'd be running this in a plugin which would be installed at (relative to the project)
  // /node_modules/<plugin-name>/ so set paths accordingly
 
var pluginHelper=require("gulp-runner-tdp-plugin-helper-lib");
 
// getPluginConfig
var configPaths=
[
    path.join(__dirname, "/config/non-existant-config.js"),
    path.join(__dirname, "/config/config.js"),
    path.join(__dirname, "/non-existant-config-dir/non-existant-config-2.js")
];
 
pluginHelper.getPluginConfig(configPaths, function(err, config)
{
  //...
}
 
// copyConfigFileToProjectRoot
var path=require("path");
var fs=require("fs");
 
var pluginDir=__dirname;
var sourceConfigFilename=path.join(__dirname, "/config/<plugin-name>-config.js");
 
pluginHelper.copyConfigFileToProjectRoot(fs, path, pluginDir, sourceConfigFilename, function(err, res)
{
  //...
});

Known issues

None currently

Tests

There are some built-in tests which use Mocha, you can run these (after installation) via:

npm test

All test should pass - we use Travis CI to verify this with each push to the GitHub master branch.

Package Sidebar

Install

npm i gulp-runner-tdp-plugin-helper-lib

Weekly Downloads

0

Version

1.0.3

License

MIT

Last publish

Collaborators

  • tdp_org