mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-11 02:15:08 +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) {
|
project.load(baseDir, projectName, function(err, project) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return console.error(
|
return console.error(
|
||||||
'Error during load project "' + projectName + '": ' +
|
'Error during load project "' + projectName + '": ',
|
||||||
err.stack || err
|
err.stack || err
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var inherits = require('util').inherits,
|
var Steppy = require('twostep').Steppy,
|
||||||
|
inherits = require('util').inherits,
|
||||||
ParentReader = require('./base').Reader,
|
ParentReader = require('./base').Reader,
|
||||||
path = require('path');
|
path = require('path'),
|
||||||
|
fs = require('fs');
|
||||||
|
|
||||||
|
|
||||||
function Reader() {
|
function Reader() {
|
||||||
@ -16,6 +18,14 @@ exports.Reader = Reader;
|
|||||||
Reader.prototype.ext = 'json';
|
Reader.prototype.ext = 'json';
|
||||||
|
|
||||||
Reader.prototype._load = function(dir, name, callback) {
|
Reader.prototype._load = function(dir, name, callback) {
|
||||||
var content = require(path.join(dir, name + '.' + this.ext));
|
var self = this;
|
||||||
callback(null, content);
|
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