Better dev server integration

This commit is contained in:
MICHAEL JACKSON
2018-02-16 16:00:06 -08:00
parent a22e0fa801
commit d6f2bc089a
42 changed files with 1753 additions and 1154 deletions

View File

@ -0,0 +1,25 @@
const fs = require("fs");
const path = require("path");
const getFileStats = require("./getFileStats");
function getEntries(dir) {
return new Promise((resolve, reject) => {
fs.readdir(dir, function(error, files) {
if (error) {
reject(error);
} else {
resolve(
Promise.all(
files.map(file => getFileStats(path.join(dir, file)))
).then(statsArray => {
return statsArray.map((stats, index) => {
return { file: files[index], stats };
});
})
);
}
});
});
}
module.exports = getEntries;