Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including packagingjs-cli with all npm packages installed. Try it out:

var packagingjsCli = require("packagingjs-cli")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

packagingjs-cli v0.1.0

A command line too for PackagingJS and more!

PackagingJS Command Line Interface

ES4 style packaging, namespacing, and dependency implementation in JavaScript with added ES6/JSX transpiling from single commands. This is the command line tool for PackagingJS style JS. For more info on writing PackagingJS code see its docs.


$ npm install -g packagingjs-cli

The PackagingJS CLI is intended for smaller projects where creating package.json files and having a bunch of project dependencies is not sensible, but where you still want the basic ability to have a JS module system and ES6/7 and JSX transpiling. Therefore a global install is all you need.


$ pjs input.js -o output.js

The above will compile input.js and any PackagingJS style imported dependencies, transpile the ES6 and JSX via Babel, and output it into one file named output.js.

The main compiling option is -o <outputfilename> or --output <outputfilename> which determines the destination file. If none is given it will just output the same filename with app. prepended to it. So $ pjs input.js all by itself would output to a file app.input.js.

The 3 main options aside from the output are -p, -b, -r for PackagingJS, Babel, and React JSX respectively. If none of those 3 options are included it just assumes you want all 3 (which is why the examples above work). So to compile with PackagingJS and Babel, but not any JSX you could use $ pjs input.js -o output.js -p -b and likewise to not do any ES6 transpiling at all and just use the module handling: $ pjs input.js -o output.js -p would work.

Note that Babel compiles to stage-0 as effective within the browser version of Babel. The browser version is used due to the fact that the npm version is quite heavy and slow on many systems. This CLI is made to be light and fast for basic usage. If you need more control and the latest version of Babel and want to work with PackagingJS then try the gulp-packagingjs npm module and use with Gulp.

Other options are --autorun <static|instance|none> which determines the PackagingJS autorun method, and --global <globalname> which can be used to determine the global object used by PackagingJS. See the PackagingJS docs for info on both concepts.

Intended Usage

For What:

As has been said already: this is for small stuff. There are tons of ways to use modules and ES6 in projects...they just tend to be heavy and require setup. I wanted a simple way that I could write modular ES6 style (and with PackagingJS ES4 style) code without any project setup and just compile via a single command. I've found tools that do it for being modular...and tools that do it for ES6...but remarkably little that handles both for simple usage. With this you can mock up a quick demo or a mini-project without setting up a big project structure.

Other Instructions:

IMPORTANT! This tool is intended to be used FROM the directory holding the base class, and that base class is intended to be non-namespaced. It may work in other situations, but results will be unpredictable. Use as intended for best results.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free