GROM.js
Awesome co-powered build system.
npm install -g gromjs
Why?
The goal of grom.js is to be a plugin-less build system that will allow to use any node module to process files without pain. Gives more control
Super simple
In gromfile.js
:
var processor = var R = moduleexports{ var filesSet = this var mappedFilesSet = filesSet return this}
In terminal:
$ gromjs task
That's it. No special grom-whatever
plugins, use whatever you want.
API
-
yield this.read(glob)
Returns ordered Set of Files -
yield this.watch(glob)
Returns events emitter, uses npm modulewatch
andwatch.createMonitor
method -
yield this.write(glob, Set)
Accepts glob, Set of Files and writes everything in right place. -
yield this.async(tasks)
Accepts array of tasks and runs in asynchronously and independent to each other. -
yield this.seq(tasks)
Runs tasks one by one from left to right, every next one get result from previous.
Set
Is a set of Files
uniq by glob, have next methods:
-
elements()
ReturnsSet
's elements -
isContains(file)
Checks iffile
is inSet
by file's glob -
add(file)
Returns newSet
with all elements plus new one -
remove(element)
Returns newSet
without singleelement
-
union(set)
Returns newSet
that is union of elements from both sets -
intersection(set)
Returns newSet
that is intersection between sets -
difference(set)
Returns newSet
that is difference between sets -
filter(interator*)
Returns newSet
with filtered elements -
sort(interator*)
Returns newSet
with sorted elements -
reduce(interator*, accumulator)
Returns reduced value -
map(interator*)
Returns newSet
with mapped elements -
forEach(interator*)
Iterates over elements and returns currentSet
File
-
path()
Returns full path -
glob()
Returns glob -
name()
Returns name with extension -
source()
Generator, returns file's source code -
clone([glob], [source])
Creates new File, glob can be presented as hash withdir
,name
,ext
fields which will be merged with parent file's path, path also can be just a string, ifglob
orsource
isn't provided,clone
takes it from parent.
Examples:
run tasks in sequence:
var filesProcessor = var { return this} var { return set} var { return this} moduleexports{ this}
watch files:
moduleexports{ var monitor = this monitor}
compile less:
var less = moduleexports{ var lessFilesSet = this var cssFilesSet = lessFilesSet return this}
CLI
$ gromjs <task-name>
TODO
- Tasks logger
- Tests
- More examples