Home Reference Source Repository
import Bundlerify from 'gulp-bundlerify/src/index.js'
public class | version 1.0.2 | source

Bundlerify

Bundlerify it's something between a generator and a boilerplate for ES6 projects. It uses Browserify, Babel, Watchify and BrowserSync, among others, to build your project with just a couple of lines, but at the same time, it's also highly customizable: You can inject your own dependencies and tasks.

Constructor Summary

Public Constructor
public

constructor(gulp: Function, config: Object | String)

Create a new instance of the plugin.

Member Summary

Public Members
public get

Get the Babelify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of Babelify.

public set

Set a custom version of BrowserSync.

public get

Get the BrowserSync instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public get

Get the Browserify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of Browserify.

public get

Get the current bundler object from Browserify (or Watchify).

public

The Bundlerify main settings.

public get

Get the ESDoc instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of ESDoc.

public get

Get the ESDoc Publisher instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of the ESDoc Publisher.

public get

Get the ESDoc Uploader instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of the ESDoc Uploader.

public

A reference to the main project's Gulp.

public get

Get the gulp-eslint instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of gulp-eslint.

public get

Get the gulp-if instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of gulp-if.

public get

Get the gulp-jscs instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of gulp-jscs.

public get

Get the gulp-streamify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of gulp-streamify.

public set

Set a custom version of gulp-uglify.

public get

Get the gulp-uglify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public get

Get the Gulp Util instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of Gulp Util.

public get

Get the Jest-cli instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of Jest-cli.

public set

Set a custom version of rimraf.

public get

Get the rimraf instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public get

Get the through instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of through.

public set

Set a custom version of vinyl-source-stream.

public get

Get the vinyl-source-stream instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of vinyl-transform

public get

Get the vinyl-transform instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public get

Get the Watchify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set

Set a custom version of Watchify.

Method Summary

Public Methods
public

Make a new build.

public

clean(callback: Function)

Clean the build (dist) directory.

public

cleanEs5(callback: Function)

Clean the ES5 output directory.

public

Generate the project documentation using ESDoc.

public

Compile your project to ES5 using.

public

Lint the project code.

public

Start the BrowserSync server and the watch for any change in the build.

public

Register the plugin tasks on the main project's Gulp. Because it returns the instance object, it can be used right after instantiating the plugin.

public

Run the Jest tests from your project.

public

uploadDocs(callback: Function)

Connects with the ESDoc hosting service API in order to generate the documentation for your project.

Public Constructors

public constructor(gulp: Function, config: Object | String) source

Create a new instance of the plugin.

Params:

NameTypeAttributeDescription
gulp Function

A reference to the main project's Gulp so the default tasks can be registered.

config Object | String

If an object it's used, it will be merged with the default settings, but if a string it's used, it would be the same as using an Object with just the mainFile setting.

Example:

const gulp = require('gulp');

// Instantiate with the default settings.
const instanceOne = new Bundlerify(gulp);

// Instantiate with custom settings.
const instanceTwo = new Bundlerify(gulp, {
    mainFile: './myApp/index.js',
    watchifyOptions: {
        debug: false,
    },
});

// Instantiate with the entry file and the default settings
const instanceThree = new Bundlerify(gulp, './myApp/index.js');

// Instantiate with shorthand settings
const instanceThree = new Bundlerify(gulp, {
    watchifyDebug: false, // alias for `.watchifyOptions.debug = false`
    browserSyncBaseDir: './', // alias for `.browserSyncOptions.server.baseDir = './'`
    browserSyncEnabled: false, // alias for `.browserSyncOptions.enabled = false`
    jscs: false, // alias for `.lint.jscs`
    eslint: false, // alias for `.lint.eslint`
});

Public Members

public get babelify: Function source

Get the Babelify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set babelify: Function source

Set a custom version of Babelify.

public set browserSync: Function source

Set a custom version of BrowserSync.

public get browserSync: Function source

Get the BrowserSync instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public get browserify: Function source

Get the Browserify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set browserify: Function source

Set a custom version of Browserify.

public get bundler: Function source

Get the current bundler object from Browserify (or Watchify). If it doesn't exists, it will create a new one.

public config: Object source

The Bundlerify main settings.

public get esdoc: Function source

Get the ESDoc instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set esdoc: Function source

Set a custom version of ESDoc.

public get esdocPublisher: Function source

Get the ESDoc Publisher instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set esdocPublisher: Function source

Set a custom version of the ESDoc Publisher.

public get esdocUploader: Function source

Get the ESDoc Uploader instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set esdocUploader: Function source

Set a custom version of the ESDoc Uploader.

public gulp: Function source

A reference to the main project's Gulp.

public get gulpESLint: Function source

Get the gulp-eslint instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set gulpESLint: Function source

Set a custom version of gulp-eslint.

public get gulpIf: Function source

Get the gulp-if instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set gulpIf: Function source

Set a custom version of gulp-if.

public get gulpJSCS: Function source

Get the gulp-jscs instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set gulpJSCS: Function source

Set a custom version of gulp-jscs.

public get gulpStreamify: Function source

Get the gulp-streamify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set gulpStreamify: Function source

Set a custom version of gulp-streamify.

public set gulpUglify: Function source

Set a custom version of gulp-uglify.

public get gulpUglify: Function source

Get the gulp-uglify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public get gulpUtil: Function source

Get the Gulp Util instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set gulpUtil: Function source

Set a custom version of Gulp Util.

public get jest: Function source

Get the Jest-cli instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set jest: Function source

Set a custom version of Jest-cli.

public set rimraf: Function source

Set a custom version of rimraf.

public get rimraf: Function source

Get the rimraf instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public get through: Function source

Get the through instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set through: Function source

Set a custom version of through.

public set vinylSourceStream: Function source

Set a custom version of vinyl-source-stream.

public get vinylSourceStream: Function source

Get the vinyl-source-stream instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set vinylTransform: Function source

Set a custom version of vinyl-transform

public get vinylTransform: Function source

Get the vinyl-transform instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public get watchify: Function source

Get the Watchify instance the plugin it's using. If a custom version was injected using the setter, it will return that, otherwise, it will require the one on the plugin package.json.

public set watchify: Function source

Set a custom version of Watchify.

Public Methods

public build(): Function source

Make a new build. This method it's called by the build task.

Return:

Function

It returns the stream used to create and write the build.

public clean(callback: Function) source

Clean the build (dist) directory. This method it's called by the clean task, which is a dependency of the build task.

Params:

NameTypeAttributeDescription
callback Function
  • optional
  • default: null

An optional callback sent by the Gulp task.

public cleanEs5(callback: Function) source

Clean the ES5 output directory. This method it's called by the cleanEs5 task, which is a dependency of the es5 task.

Params:

NameTypeAttributeDescription
callback Function
  • optional
  • default: null

An optional callback sent by the Gulp task.

public docs(): Function source

Generate the project documentation using ESDoc. This method it's called by the docs task.

Return:

Function

The result of the ESDoc generator.

public es5(): Function source

Compile your project to ES5 using. This method it's called by the es5 task.

Return:

Function

It returns the stream used to compile the files.

public lint(): Function source

Lint the project code. This method it's called by the serve task.

Return:

Function

It returns the stream used to create and write the build.

public serve(): Function source

Start the BrowserSync server and the watch for any change in the build. This method it's called by the serve task.

Return:

Function

It returns the stream used to create and write the build.

public tasks(): Bundlerify source

Register the plugin tasks on the main project's Gulp. Because it returns the instance object, it can be used right after instantiating the plugin.

Return:

Bundlerify

The current instance of the object.

Example:

const gulp = require('gulp');
const instance = new Bundlerify(gulp).tasks();

public test(): Function source

Run the Jest tests from your project. This method it's called by the test task.

Return:

Function

It returns the stream used to run Jest.

public uploadDocs(callback: Function) source

Connects with the ESDoc hosting service API in order to generate the documentation for your project. This method it's called by the uploadDocs task.

Params:

NameTypeAttributeDescription
callback Function
  • optional
  • default: null

An optional callback sent by the Gulp task.