mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-10 23:35:09 +00:00
do not load json configs via require for prevent caching
This commit is contained in:
parent
92a8631cd3
commit
944a98947c
2
app.js
2
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
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user