lib/index.js
/**
 * Runs browserify or watchify with the given arguments for each file that matches the glob pattern.
 *
 * @param {string[]} args - the command-line arguments
 */
Runs browserify or watchify with the given arguments for each file that matches the glob pattern.
@param {string[]} args - the command-line arguments
Runs browserify or watchify with the given arguments for each file that matches the glob pattern . @param { string [] } args - the command - line arguments
function globify (args) {
  let parsed = new ParsedArgs(args);
  let expandGlob = parsed.args[parsed.globIndex];
  let renameOutfile = parsed.args[parsed.outfileIndex];
  let files = expandGlob && expandGlob(parsed.globOptions);
  if (!expandGlob) {
    if (renameOutfile) {
      parsed.args[parsed.outfileIndex] = renameOutfile();
    }
    browserify(parsed.cmd, parsed.args);
  }
  else if (!renameOutfile) {
    Array.prototype.splice.apply(parsed.args, [parsed.globIndex, 1].concat(files));
    browserify(parsed.cmd, parsed.args);
  }
  else {
    files.forEach((file) => {
      let fileArgs = parsed.args.slice();
      fileArgs[parsed.globIndex] = file;
      fileArgs[parsed.outfileIndex] = renameOutfile(file, parsed.baseDir);
      browserify(parsed.cmd, fileArgs);
    });
  }
}
function globify ( args ) { let parsed = new ParsedArgs ( args ) ; let expandGlob = parsed . args [ parsed . globIndex ] ; let renameOutfile = parsed . args [ parsed . outfileIndex ] ; let files = expandGlob && expandGlob ( parsed . globOptions ) ; if ( ! expandGlob ) { if ( renameOutfile ) { parsed . args [ parsed . outfileIndex ] = renameOutfile ( ) ; } browserify ( parsed . cmd , parsed . args ) ; } else if ( ! renameOutfile ) { Array . prototype . splice . apply ( parsed . args , [ parsed . globIndex , 1 ] . concat ( files ) ) ; browserify ( parsed . cmd , parsed . args ) ; } else { files . forEach ( ( file ) => { let fileArgs = parsed . args . slice ( ) ; fileArgs [ parsed . globIndex ] = file ; fileArgs [ parsed . outfileIndex ] = renameOutfile ( file , parsed . baseDir ) ; browserify ( parsed . cmd , fileArgs ) ; } ) ; } }
Runs browserify or watchify with the given arguments for each file that matches the glob pattern.
Runs browserify or watchify with the given arguments for each file that matches the glob pattern .
// No glob patterns were found, so just run browserify as-is // Run browserify with the expanded list of file names // Run browserify separately for each file