diff --git a/lib/config.js b/lib/config.js index 5d3b0f0..e8b0f69 100644 --- a/lib/config.js +++ b/lib/config.js @@ -3,7 +3,7 @@ const Joi = require('joi') const micromatch = require('micromatch') const union = require('lodash.union') const merge = require('lodash.merge') -const {accessSync} = require('fs') +const {accessSync, constants} = require('fs') const hygienist = require('hygienist-middleware') const BrowserSyncPlugin = require('browser-sync-webpack-plugin') const SpikePlugin = require('./plugin') @@ -288,7 +288,7 @@ module.exports = class Config { function loadFile (f) { try { - accessSync(f) + accessSync(f, constants.F_OK | constants.R_OK) return require(f) } catch (err) { if (err.code !== 'ENOENT') { throw new Error(err) } diff --git a/lib/index.js b/lib/index.js index cc6877a..0d3391c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -309,7 +309,7 @@ module.exports = Spike */ function initSprout (emit) { try { - fs.accessSync(Spike.tplPath) + fs.accessSync(Spike.tplPath, fs.constants.F_OK | fs.constants.R_OK | fs.constants.W_OK) } catch (_) { emit('info', 'configuring template storage') mkdirp.sync(Spike.tplPath) @@ -350,13 +350,13 @@ function ensureConfigExists () { } try { - fs.accessSync(Spike.tplPath) + fs.accessSync(Spike.tplPath, fs.constants.F_OK | fs.constants.R_OK | fs.constants.W_OK) } catch (_) { mkdirp.sync(Spike.tplPath) } try { - fs.accessSync(Spike.configPath) + fs.accessSync(Spike.configPath, fs.constants.F_OK | fs.constants.R_OK | fs.constants.W_OK) } catch (_) { fs.writeFileSync(Spike.configPath, JSON.stringify(defaultConfig)) }