Create data/ folder instead of crashing

This commit is contained in:
Christopher Chedeau
2017-01-06 06:00:09 -08:00
committed by Dan Abramov
parent a0bc99409d
commit 7684c14d0c
+6 -1
View File
@@ -50,8 +50,13 @@ const COMMANDS = [
// Simple helper to write out some JSON for debugging
function writeTo(file, data) {
var folder = path.join(__dirname, 'data');
if (!fs.existsSync(folder)) {
fs.mkdirSync(folder);
}
fs.writeFile(
path.join(__dirname, 'data', file),
path.join(folder, file),
JSON.stringify(data, null, 2)
);
}