aboutsummaryrefslogtreecommitdiffstats
path: root/development
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-11-20 01:04:32 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-11-21 01:34:50 +0800
commit5dc87b6835f446d009b39e9b28c0b98d01a1001d (patch)
treed9692424b68ffd36afd7e5a6a57a8da443eb8296 /development
parentf1248ac26abd6641f29476e40bef6193a7130f16 (diff)
downloadtangerine-wallet-browser-5dc87b6835f446d009b39e9b28c0b98d01a1001d.tar.gz
tangerine-wallet-browser-5dc87b6835f446d009b39e9b28c0b98d01a1001d.tar.zst
tangerine-wallet-browser-5dc87b6835f446d009b39e9b28c0b98d01a1001d.zip
Speed up genStates script by using built-in require fn
Diffstat (limited to 'development')
-rw-r--r--development/genStates.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/development/genStates.js b/development/genStates.js
index 0ac1059be..15e0863e8 100644
--- a/development/genStates.js
+++ b/development/genStates.js
@@ -2,7 +2,7 @@ const fs = require('fs')
const path = require('path')
const promisify = require('pify')
const enLocaleMessages = require('../app/_locales/en/messages.json')
-
+const writeFile = promisify(fs.writeFile)
start().catch(console.error)
@@ -12,8 +12,7 @@ async function start () {
const states = {}
await Promise.all(stateFilesNames.map(async (stateFileName) => {
const stateFilePath = path.join(__dirname, 'states', stateFileName)
- const stateFileContent = await promisify(fs.readFile)(stateFilePath, 'utf8')
- const state = JSON.parse(stateFileContent)
+ const state = require(stateFilePath)
state.localeMessages = { en: enLocaleMessages, current: {} }
@@ -22,5 +21,5 @@ async function start () {
}))
const generatedFileContent = `module.exports = ${JSON.stringify(states)}`
const generatedFilePath = path.join(__dirname, 'states.js')
- await promisify(fs.writeFile)(generatedFilePath, generatedFileContent)
+ await writeFile(generatedFilePath, generatedFileContent)
}