diff --git a/app.js b/app.js index f1ce6fc..9473912 100644 --- a/app.js +++ b/app.js @@ -105,7 +105,7 @@ Steppy( project.load(baseDir, projectName, function(err, project) { if (err) { return console.error( - 'Error during load project "' + projectName + '": ' + + 'Error during load project "' + projectName + '": ', err.stack || err ); } diff --git a/lib/reader/json.js b/lib/reader/json.js index 591ec95..a6c6e4f 100644 --- a/lib/reader/json.js +++ b/lib/reader/json.js @@ -1,8 +1,10 @@ 'use strict'; -var inherits = require('util').inherits, +var Steppy = require('twostep').Steppy, + inherits = require('util').inherits, ParentReader = require('./base').Reader, - path = require('path'); + path = require('path'), + fs = require('fs'); function Reader() { @@ -16,6 +18,14 @@ exports.Reader = Reader; Reader.prototype.ext = 'json'; Reader.prototype._load = function(dir, name, callback) { - var content = require(path.join(dir, name + '.' + this.ext)); - callback(null, content); + var self = this; + Steppy( + function() { + fs.readFile(path.join(dir, name + '.' + self.ext), 'utf8', this.slot()) + }, + function(err, content) { + this.pass(JSON.parse(content)); + }, + callback + ); };