feat: run command on changes

based on dependencies, devDependencies, and hashes of other included files
This commit is contained in:
2019-04-04 15:50:15 -07:00
parent ca2fc85135
commit 5d05775560
4 changed files with 42 additions and 9 deletions

View File

@@ -29,6 +29,11 @@ exports.read = (fileRoot, ident) => {
};
exports.write = (fileRoot, ident, payload) => {
console.log('WRITE', { fileRoot, ident, payload });
throw new Error('Data write not implemented');
const filePath = path.join(fileRoot, CONFIG_FILENAME);
const existingCache = JSON.parse(fs.readFileSync(filePath));
// update the cache
existingCache[ident] = payload;
fs.writeFileSync(filePath, JSON.stringify(existingCache));
};