index.js
function save(template, distpath) {
  var data = generate(template);
  var dir = path.dirname(distpath);

  mkdirp(dir, function(err) {
    if(err) {
      console.log(err.message);
      return;
    }

    fs.writeFile(distpath, JSON.stringify(data, null, 2), function(err) {
      if(err) {
        console.log(err.message);
        return;
      }
    });

  });

}
function save(template, distpath) {
  var data = generate(template);
  var dir = path.dirname(distpath);

  mkdirp(dir, function(err) {
    if(err) {
      console.log(err.message);
      return;
    }

    fs.writeFile(distpath, JSON.stringify(data, null, 2), function(err) {
      if(err) {
        console.log(err.message);
        return;
      }
    });

  });

}
function save ( template , distpath ) { var data = generate ( template ) ; var dir = path . dirname ( distpath ) ; mkdirp ( dir , function ( err ) { if ( err ) { console . log ( err . message ) ; return ; } fs . writeFile ( distpath , JSON . stringify ( data , null , 2 ) , function ( err ) { if ( err ) { console . log ( err . message ) ; return ; } } ) ; } ) ; }
save as json file
@param template - json scheme
@param path - path to save file
save as json file