catty
v0.1.0
Published
Mapshaper's build tool
Readme
Catty
Catty is the source file concatenator for Mapshaper.
Some features:
- Each source file lists its dependencies in a formatted comment (see below). There is no manifest, unlike some other tools.
- Concatenated files are (optionally) wrapped in a self-executing function, to protect the global namespace.
- Catty can monitor source files and regenerate output files when a required source file changes.
Command line tool
Usage: $ catty [options] input output
Options:
-fMonitor source files, re-cat when something changes.-gDon't wrap source files in an immediate function.-dComma-separated list of directories to monitor-hPrint help message
Example: $ catty -g -d src,lib src/input.js dist/output.js
Node module
Example
require('catty')({global: true})
.addLibrary('src')
.addLibrary('lib')
.cat('src/input.js', 'dist/output.js');Methods
#cat(input, output) Concatenate an input file with its dependencies. output may be a filename or a Node-style callback. If output is empty or contains a hyphen, catty sends its output to stdout.
#addLibrary(dir) Give catty a directory to search for dependencies.
#prepend(JS) Insert JavaScript before concatenated code.
#addDeps(deps) Inject one or more additional dependencies into the input file (comma-sep. list).
Comment format
Examples
/* @requires
mapshaper-innerlines
mapshaper-endpoints
mapshaper-dataset-utils
*//* @requires mapshaper-shapes, mapshaper-shape-geom */ls
