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
|
|
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 |
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 |
|
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 |
|
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
|
|
public set |
Set a custom version of Watchify. |
Method Summary
Public Methods | ||
public |
Make a new build. |
|
public |
Clean the build (dist) directory. |
|
public |
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 |
tasks(): Bundlerify 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:
Name | Type | Attribute | Description |
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
|
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 Methods
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:
Name | Type | Attribute | Description |
callback | Function |
|
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:
Name | Type | Attribute | Description |
callback | Function |
|
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.
public es5(): Function source
Compile your project to ES5 using. This method it's called by the es5
task.
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.
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.
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.
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:
Name | Type | Attribute | Description |
callback | Function |
|
An optional callback sent by the Gulp task. |