Create data/ folder instead of crashing

This commit is contained in:
Christopher Chedeau authored and Dan Abramov committed 2017-01-06 06:00:09 -08:00
1 parent a0bc99409d
commit 7684c14d0c
1 file changed
+6 -1
+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)
);
}