Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6751c0a
bundle: checkpoint - Fixed logLevel parsing using visitors.Commander …
kuakman Mar 26, 2017
701e886
bundle: checkpoint - Fixed visitors.formatter.Json issue with circula…
kuakman Mar 27, 2017
4273e17
bundle: checkpoint - Added dependsOn directive on each subcommand to …
kuakman Apr 10, 2017
6ac4d5c
bundle: checkpoint - Fixed bin.SquareBox dependents subcommands unit …
kuakman Apr 11, 2017
b67401b
bundle: checkpoint - progress on building bundle supported AST elemen…
kuakman Apr 25, 2017
054b6fc
bundle: checkpoint - added external configuration option (alias l). R…
kuakman Apr 25, 2017
e80c156
bundle: checkpoint - Added escodegen production dependency for writin…
kuakman Apr 26, 2017
6d6abbd
bundle: checkpoint - Added bundle.task.metadata.Metadata domain ADT a…
kuakman Apr 26, 2017
6226f23
bundle: checkpoint - progress on metadata parsing via glob, fs and ac…
kuakman Apr 28, 2017
463cf22
bundle: checkpoint - comments for apidocs clean up. Added support for…
kuakman May 1, 2017
5ec538c
bundle: checkpoint - progress on Annotation parsing.
kuakman May 2, 2017
6989cf5
bundle: checkpoint - replaced jsonpath with astq library to query abs…
kuakman May 4, 2017
ff525da
bundle: checkpoint - implemented annotation parsing. json5 added as a…
kuakman May 5, 2017
c29ae3f
bundle: checkpoint - Refactored es6 specs testing files. Also, added …
kuakman May 8, 2017
f956c35
bundle: checkpoint - Moving into bundle.types.import.Import for parsi…
kuakman May 10, 2017
51278c3
bundle: checkpoint - Progress on CommonJs Import declaration astq que…
kuakman May 15, 2017
60680bb
bundle: checkpoint - Progress refactoring & Import Type query impleme…
kuakman Jun 5, 2017
dc8e75e
bundle: checkpoint - Refactored and progress on import queries and as…
kuakman Jun 12, 2017
8fa687a
bundle - checkpoint: fixed import path.
kuakman Jun 12, 2017
4a5b9e1
bundle: checkpoint - Added basePath to config path (fixed unit tests)…
kuakman Jun 13, 2017
61475be
bundle: checkpoint - progress on amd imports parsing.
kuakman Jun 30, 2017
200de10
bundle: checkpoint - added gitter badge and webhook for push notifica…
kuakman Jul 12, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ node_modules
# Logs & System
*.log
*.pid

# IDE
.idea
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ script:
- npm run it
after_success:
- test $TRAVIS_BRANCH = "master" && npm run coveralls
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/19547337979e0c84f48d
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # options: [always|never|change] default: always
37 changes: 22 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

[![Build Status](https://travis-ci.org/nahuelio/squarebox.svg?branch=master)](https://travis-ci.org/nahuelio/squarebox)
[![Coverage Status](https://coveralls.io/repos/github/nahuelio/squarebox/badge.svg)](https://coveralls.io/github/nahuelio/squarebox)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sqbox/General?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Version](https://img.shields.io/badge/Version-1.0.0-blue.svg?style=flat)]()
[![Version](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](http://www.opensource.org/licenses/mit-license.php)
[![GitHub stars](https://img.shields.io/github/stars/nahuelio/squarebox.svg?style=social&label=Stars)]()
Expand All @@ -15,42 +16,48 @@ Experimental ES6/CommonJS/AMD Module Bundler

```npm install [-g] squarebox```

#### Usage
### Usage

CLI Commands
```sqbox [command] [options]```

```
global option: -c (sqbox.js|.sqboxrc|URL) | Default: ./.sqboxrc
contextual help - sqbox [command] help
#### Commands

* sqbox help - global help (list of commands and general usage)
* sbox bundle --options
* sbox clean
* sbox visualize
```
* **help** - Global Help
* **bundle help** - Contextual help for command ```bundle```
* **bundle** - Bundles your project
* Options
* [-c, --config] (sqbox.js, .sqboxrc, or a remote url) | Default: [currentDirectory]/.sqboxrc
* TODO Overrides...
* **clean** - Clean destination folder
* Options
* ...TODO
* **graph** - Generates a graphical report of your current bundling strategy
* Options
* ...TODO

Programmatic API
#### Programmatic API

```
const sqbox = require('squarebox');
// Or ES6: import sqbox from 'squarebox';
sqbox.clean([opts])
.bundle([config])
.visualize([opts]);
.graph([opts]);
```

#### Official Documentation

```
TODO
TODO: Official Website / APIDocs
```

#### Configuration
#### Contribute

```
TODO
```

#### Contribute
#### License

```
TODO
Expand Down
8 changes: 6 additions & 2 deletions lib/bin/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"override": { "default": false },
"config": { "default": ".sqboxrc" },
"url": {},
"target": { "default": "./dist" }
"target": { "default": "./dist" },
"logLevel": { "alias": "lv", "default": "output" }
}
}, {
"name": "bundle",
Expand All @@ -28,10 +29,12 @@
"override": { "default": false },
"config": { "default": ".sqboxrc" },
"url": { "alias": "u" },
"basePath": { "alias": "b", "default": "./" },
"scan": { "alias": "s", "default": "." },
"exclude": { "alias": "x" },
"extensions": { "alias": "e", "default": ".js,.jsx,.es6,.es" },
"alias": { "alias": "a", "default": {} },
"external": { "alias": "l", "default": "" },
"target": { "alias": "t", "default": "dist>umd:./dist" },
"logLevel": { "alias": "lv", "default": "output" }
}
Expand All @@ -44,6 +47,7 @@
"override": { "default": false },
"config": { "default": ".sqboxrc" },
"url": {},
"target": { "default": "./dist" }
"target": { "default": "./dist" },
"logLevel": { "alias": "lv", "default": "output" }
}
}]
78 changes: 47 additions & 31 deletions lib/bin/sqbox.es6
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/**
* @module bin
* @author Patricio Ferreira <3dimentionar@gmail.com>
* @Notes Think about the API require('sqbox').clean({}).bundle({}).graph({});
**/
import 'util/mixins';
import extend from 'extend';
import Collection from 'util/adt/collection';
import StackAsync from 'util/adt/stack-async';
import Factory from 'util/factory/factory';
import Command from 'command';
import CommandsList from './commands.json';
Expand All @@ -23,21 +25,22 @@ class SquareBox extends Command {
/**
* Constructor
* @public
* @param {Object} [args = {}] - Constructor arguments
* @param {Symbol} _enforcer - private enforcer symbol
* @param {Object} [...args] - Constructor arguments
* @return {bin.SquareBox}
**/
constructor(...args) {
constructor(_enforcer, ...args) {
super(...args);
return SquareBox.isPrivate(this.attachEvents());
return SquareBox.isPrivate(_enforcer, this.attachEvents());
}

/**
* Attaches Events
* Attach Events
* @public
* @return {bin.SquareBox}
**/
attachEvents() {
this.once(SquareBox.events.done, this.after);
this.stack.on(StackAsync.events.push, _.bind(this.onCommand, this));
return this;
}

Expand All @@ -48,7 +51,6 @@ class SquareBox extends Command {
* @return {bin.SquareBox}
**/
before() {
super.before();
this.commander.read();
return this;
}
Expand All @@ -61,44 +63,57 @@ class SquareBox extends Command {
**/
run() {
this.before();
this.configuration.parse().then(_.bind(this.onConfiguration, this));
this.configuration.parse()
.then(_.bind(this.push, this, this, this.options.path))
.catch(_.bind(this.after, this));
return this;
}

/**
* Configuration Loaded and Parsed Handler
* Subcommand push Handler
* @public
* @param {visitors.Configuration} configuration - configuration visitor reference
* @param {util.adt.StackAsync} stack - stack reference
* @param {Command} command - command offered
* @return {bin.SquareBox}
**/
onConfiguration() {
const { path } = this.options;
//console.log(_.pick(this, Command.options));
// TODO: Factory.get(path, this.params()).run();
return this;
onCommand(stack, command) {
let dependents = command.getDependsOn();
return (dependents.length > 0) ? _.reduce(dependents, this.push, this, this) : this.after();
}

/**
* Constructor Validation
* After Run
* @public
* @throws {Error} Private violation
* @param {Symbol} pte - constructor enforcer
* @override
* @param {Error} [err] - error reference
* @return {bin.SquareBox}
**/
isPrivate(pte) {
if(!_.isEqual(pte, enforcer)) throw new Error('Private Violation');
after(err, results) {
if(_.defined(err)) logger(err.message).fatal();
if(this.stack.isEmpty()) return this.complete(results);
this.stack.pop().then(_.bind(this.after, this, null)).catch(_.bind(this.after, this));
return this;
}

/**
* Register Command Factories
* SquareBox Complete Handler
* @public
* @override
* @param {Array} results - all Results
* @return {bin.SquareBox}
**/
register() {
super.register();
Factory.registerAll(this.constructor.commands);
complete(results) {
return super.after();
}

/**
* Constructor Validation
* @public
* @throws {Error} Private violation
* @param {Symbol} pte - constructor enforcer
* @return {bin.SquareBox}
**/
isPrivate(pte) {
if(!_.isEqual(pte, enforcer)) throw new Error('Private Violation');
return this;
}

Expand All @@ -110,24 +125,25 @@ class SquareBox extends Command {
static commands = Collection.new(CommandsList);

/**
* SquareBox visitors
* Command Visitors
* @static
* @override
* @type {Array}
* @type {util.adt.Collection}
**/
static visitors = [
static visitors = Collection.new(Command.visitors.toJSON().concat([
'visitors/commander',
'visitors/configuration'
].concat(Command.visitors);
]));

/**
* Static enforcer validation
* @static
* @param {Symbol} _enforcer - private enforcer symbol
* @param {bin.SquareBox} instance - squarebox instance reference
* @return {bin.SquareBox}
**/
static isPrivate(instance) {
return instance.isPrivate(enforcer);
static isPrivate(_enforcer, instance) {
return instance.isPrivate(_enforcer);
}

/**
Expand All @@ -144,7 +160,7 @@ class SquareBox extends Command {
* @return {bin.SquareBox}
**/
static run(cwd = process.cwd()) {
return this.new({ cwd }).run();
return this.new(enforcer, { cwd }).run();
}

}
Expand Down
Loading