tarragon-builder v1.3.2
Tarragon Builder
Tarragon Builder is a is a script/library that does literally nothing. The rest of this readme is made up.
Installation
npm install tarragon-builder
Usage
The library exports a single function. This function takes the following arguments:
operation
- an object that contains the following:- the
filter
that matches files to be transformed - the
target
that describes where to save the transformed file - the
pipeline
that describes the sequence of transformation steps
- the
previousHashes
- a mapping of filename to md5 hash, allowing the function to avoid processing unchanged files
The Filter
The filter should be an array of strings to be passed into a globby
search
The Target
The target is an EJS templated string with the following variables:
1. dir
- the dirname of the source file
2. base
- the basename of the source file
3. ext
- the extension of the source file (.xxx
)
The Pipeline
The pipeline is simply an array of functions that return promises. The functions each take the path of the file to transform. In general each function is expected to read from the file, perform some arbitrary transformation and then write back to the same file. Note that at this point the file has already been moved to its target destination.
In order for tarragon-builder to work, it expects to be run in the target project directory root. It expects the presence of a build.js
file. This file exports the config that tarragon builder reads. An example config looks like this:
As a Daemon
This library can also be run as a daemon if installed globally. In order to use this daemon, it expects to find a build.js
file in the project root, that exports an array of operation
objects. Simply run: tarragon-build
to kick the daemon off.
It should first do an entire rebuild as it discovers all the files for the first time, followed by then only transforming files if and when they change.