diff options
First simple version of ui mocker
Diffstat (limited to 'development/genStates.js')
-rw-r--r-- | development/genStates.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/development/genStates.js b/development/genStates.js new file mode 100644 index 000000000..39a672ee0 --- /dev/null +++ b/development/genStates.js @@ -0,0 +1,18 @@ +const fs = require('fs') +const path = require('path') + +const statesPath = path.join(__dirname, 'states') +const stateNames = fs.readdirSync(statesPath) + +const states = stateNames.reduce((result, stateFileName) => { + const statePath = path.join(__dirname, 'states', stateFileName) + const stateFile = fs.readFileSync(statePath).toString() + const state = JSON.parse(stateFile) + result[stateFileName.split('.')[0].replace(/-/g, ' ', 'g')] = state + return result +}, {}) + +const result = `module.exports = ${JSON.stringify(states)}` + +const statesJsonPath = path.join(__dirname, 'states.js') +fs.writeFileSync(statesJsonPath, result) |