bin/build.js
function bundleJavascript() {
  const bundleEntryPath = path.resolve(__dirname, '..', 'dist', 'static', 'hierplane.js');
  const bundlePath = path.resolve(__dirname, '..', 'dist', 'static', 'hierplane.bundle.js');

  // Put together our "bundler", which uses browserify
  const browserifyOpts = {
    entries: [ bundleEntryPath ],
    standalone: 'hierplane'
  };

  // If we're watching or changes, enable watchify
  if (isWatchTarget) {
    // These are required for watchify
    browserifyOpts.packageCache = {};
    browserifyOpts.cache = {};

    // Enable the plugin
    browserifyOpts.plugin = [ watchify ];
  };

  // Construct the bundler
  const bundler = browserify(browserifyOpts);

  // Make an inline function which writes out the bundle, so that we can invoke it whenever
  // an update is detected if the watch target is being executed.
  const writeBundle = () => {
    console.log(chalk.cyan(`bundling ${chalk.magenta(path.relative(execArgs.cwd, bundleEntryPath))}`));
    bundler.bundle().pipe(fs.createWriteStream(bundlePath))
    console.log(chalk.green(`wrote ${chalk.magenta(path.relative(execArgs.cwd, bundlePath))}`));
  };

  // Write out the bundle once
  writeBundle();

  // If we're supposed to watch for changes, write out the bundle whenever they occur
  if (isWatchTarget) {
    bundler.on('update', writeBundle);
  }
}
function bundleJavascript() {
  const bundleEntryPath = path.resolve(__dirname, '..', 'dist', 'static', 'hierplane.js');
  const bundlePath = path.resolve(__dirname, '..', 'dist', 'static', 'hierplane.bundle.js');

  // Put together our "bundler", which uses browserify
  const browserifyOpts = {
    entries: [ bundleEntryPath ],
    standalone: 'hierplane'
  };

  // If we're watching or changes, enable watchify
  if (isWatchTarget) {
    // These are required for watchify
    browserifyOpts.packageCache = {};
    browserifyOpts.cache = {};

    // Enable the plugin
    browserifyOpts.plugin = [ watchify ];
  };

  // Construct the bundler
  const bundler = browserify(browserifyOpts);

  // Make an inline function which writes out the bundle, so that we can invoke it whenever
  // an update is detected if the watch target is being executed.
  const writeBundle = () => {
    console.log(chalk.cyan(`bundling ${chalk.magenta(path.relative(execArgs.cwd, bundleEntryPath))}`));
    bundler.bundle().pipe(fs.createWriteStream(bundlePath))
    console.log(chalk.green(`wrote ${chalk.magenta(path.relative(execArgs.cwd, bundlePath))}`));
  };

  // Write out the bundle once
  writeBundle();

  // If we're supposed to watch for changes, write out the bundle whenever they occur
  if (isWatchTarget) {
    bundler.on('update', writeBundle);
  }
}
function bundleJavascript ( ) { const bundleEntryPath = path . resolve ( __dirname , '..' , 'dist' , 'static' , 'hierplane.js' ) ; const bundlePath = path . resolve ( __dirname , '..' , 'dist' , 'static' , 'hierplane.bundle.js' ) ; // Put together our "bundler", which uses browserify const browserifyOpts = { entries : [ bundleEntryPath ] , standalone : 'hierplane' } ; // If we're watching or changes, enable watchify if ( isWatchTarget ) { // These are required for watchify browserifyOpts . packageCache = { } ; browserifyOpts . cache = { } ; // Enable the plugin browserifyOpts . plugin = [ watchify ] ; } ; // Construct the bundler const bundler = browserify ( browserifyOpts ) ; // Make an inline function which writes out the bundle, so that we can invoke it whenever // an update is detected if the watch target is being executed. const writeBundle = ( ) => { console . log ( chalk . cyan ( ` ${ chalk . magenta ( path . relative ( execArgs . cwd , bundleEntryPath ) ) } ` ) ) ; bundler . bundle ( ) . pipe ( fs . createWriteStream ( bundlePath ) ) console . log ( chalk . green ( ` ${ chalk . magenta ( path . relative ( execArgs . cwd , bundlePath ) ) } ` ) ) ; } ; // Write out the bundle once writeBundle ( ) ; // If we're supposed to watch for changes, write out the bundle whenever they occur if ( isWatchTarget ) { bundler . on ( 'update' , writeBundle ) ; } }
Compresses the static javascript bundle into a single file with all required dependencies so
that people can use it in their browser.

@return {undefined}
Compresses the static javascript bundle into a single file with all required dependencies so that people can use it in their browser .