npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

packagingjs-cli

0.1.0 • Public • Published

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.

Install

$ 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.

Usage

$ 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.

Keywords

none

install

npm i packagingjs-cli

Downloadsweekly downloads

3

version

0.1.0

license

MIT

last publish

collaborators

  • avatar
Report a vulnerability