It would be good if this wasn't sync (i.e., used a callback).  Same for the `fs.writeFile`.  Something like:

```javascript
function writeFile( relPath, exports, callback ) {
  callback = callback || function(){};
  var absPath = paths.join(options.dir, relPath);
  mkpath(paths.dirname(absPath), function( err ) {
    if ( err ) {
      return callback( err );
    }
    fs.writeFileSync(absPath, exports, { encoding: "utf-8" }, function( err ) {
      if ( err ) {
        return callback( err );
      }
      callback();
    });
  });
```

I haven't tested this code, so only use it as a guide.