diff --git a/sitegin/readFiles.js b/sitegin/readFiles.js index c246ccab4951e0e4ac0bf1c0e4ca137c56b180ce..f71b80e42691369fb284079c50d443d784930335 100644 --- a/sitegin/readFiles.js +++ b/sitegin/readFiles.js @@ -2,9 +2,11 @@ const walk = require('walk') const fs = require('fs') const path = require('path') -module.exports = obj => { +module.exports = (obj) => { console.log('Build step: ReadFiles') const onFile = (root, fileStats, next, array) => { + // ignore files like .gitkeep + if (fileStats.name.startsWith('.')) return next() const filename = path.join(root, fileStats.name) const file = path.relative(path.join(__dirname, '..', 'content'), filename) fs.readFile(filename, 'utf8', (err, data) => { @@ -22,7 +24,7 @@ module.exports = obj => { }) } - const promise1 = new Promise(resolve => { + const promise1 = new Promise((resolve) => { const pages = [] walk .walk(path.join(__dirname, '..', 'content', 'articles')) @@ -38,7 +40,7 @@ module.exports = obj => { }) }) - const promise2 = new Promise(resolve => { + const promise2 = new Promise((resolve) => { const redirects = [] walk .walk(path.join(__dirname, '..', 'content', 'redirects')) @@ -53,8 +55,8 @@ module.exports = obj => { resolve({ type: 'redirects', val: redirects }) }) }) - return Promise.all([promise1, promise2]).then(arr => { - arr.forEach(v => { + return Promise.all([promise1, promise2]).then((arr) => { + arr.forEach((v) => { // eslint-disable-next-line no-param-reassign obj[v.type] = v.val })