deathcap/nodeachrome

browserify command-line interface

Closed this issue · 2 comments

app/userland/npm_cli.js allows calling the npm command-line tool, but browserify should be also exposed via its command-line script app/node_modules/browserify/bin/cmd.js, (not only the browserify API). Generalize the CLI utility invocation as possible

nodeachrome $ node -e 'require("./app/node_modules/browserify/bin/cmd.js")'
Usage: browserify [entry files] {OPTIONS}

Standard Options:

    --outfile, -o  Write the browserify bundle to this file.
                   If unspecified, browserify prints to stdout.

    --require, -r  A module name or file to bundle.require()
                   Optionally use a colon separator to set the target.

      --entry, -e  An entry point of your app

     --ignore, -i  Replace a file with an empty stub. Files can be globs.

    --exclude, -u  Omit a file from the output bundle. Files can be globs.

   --external, -x  Reference a file from another bundle. Files can be globs.

  --transform, -t  Use a transform module on top-level files.

    --command, -c  Use a transform command on top-level files.

  --standalone -s  Generate a UMD bundle for the supplied export name.
                   This bundle works with other module systems and sets the name
                   given as a window global if no module system is found.

       --debug -d  Enable source maps that allow you to debug your files
                   separately.

       --help, -h  Show this message

For advanced options, type `browserify --help advanced`.

Specify a parameter.

Attempting to add to global:

--- a/app/userland/userland.js
+++ b/app/userland/userland.js
@@ -37,6 +37,7 @@ Object.assign(global, {

   // Useful apps
   browserify: require('browserify'),
+  browserify_cli: require('browserify/bin/cmd.js'),
   npm: require('npm'),
   npm_cli: require('./npm-cli'),
 });

but it runs too early, before process.env, process.stdin, etc. is defined (by require('./process2')). Need to wrap the require.