Auton
Your plastic pal who's fun to code with
Auton is an automated node.js development environment & resource compiler which is meant to be flexible and extensible. A few things you can pull off with Auton:
- Automatically regenerate files when updated
- Immediately running a linter or associated test when
- CommonJS to AMD translation for server/browser parity
- Monitor your resource compiling and server debug output in the same window!
Auton's file watcher API (currently using watchr underneath) provides an API that should feel comfortable to anyone used to programming in express.
var Auton = Auton;var mw = AutonMiddleware; var robot = root : __dirname server : path: 'server.js' ; robot; robot; // run for all matched filesrobot; robot;robot;robot; robotserverstart;robotwatcherstart;robot;
{ { var filename = filepath; // all middleware always have this var fullpath = filefullpath; // same with this var destname = filedestination; // these are normally generated by Auton.Middleware.destination() var fullpath = filefulldestination; // but any middleware could manually set them var root = fileroot; // Auton's root directory // In addition, middleware can cause Auton to output using one of the following. Auton's UI may throw these messages away or display them depending on user preference: this; this; this; this; this; this; } };
Built-In Middleware
Auton.Middleware.read()
- reads contents of file located at file.path into file.data.
Auton.Middleware.destination()
This middleware sets file.destination to a path which is calculated from file.path.
// using a static filename robot; // somefile.js -> outputfile.js robot; // somefile.js -> outputfile.js // mw.destination(a,b) and mw.destination([a,b]) get turned into file.replace(a,b) robot; // somedir/file.js -> outputdir/file.js robot; // banana-man.js -> boonoonoo-moon.js robot; // equivalent to mw.destination( p, r ); // "mw.destination( someFunction );" is a shortcut for "file.destination = someFunction( file.path );" var { return _input ; }; robot; // function which takes input filename and returns output filename robot; // shortcut for above, both do: src/foo.coffee -> public/foo.js
Both mw.copy() and mw.save() use this middleware to determine the proper file to save to. Underneath, all it does is set file.destination = newPath, so you can replace a call to mw.destination() with a middleware which sets file.destination to a string value of your choice and both .save() and .copy() would listen to you (unless they're called with a custom destination, in which case this field is ignored. see below.)
Auton.Middleware.save()
Auton.Middleware.copy()
Auton.Middleware.checkAge()
Auton.Middleware.last()
Auton.Middleware.commonJsToAmd()
Performs a CommonJS to AMD translation, useful for code meant to run both natively under node and in the browser through an AMD-compatible loader such as require.js.