Created
September 9, 2014 11:19
-
-
Save fiznool/b4fe3e345beeba81e3a3 to your computer and use it in GitHub Desktop.
Converts a directory of JSON files to JS ones.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var util = require('util'), | |
fs = require('fs'); | |
var path = './server/services/defs'; | |
var dirs = fs.readdirSync(path); | |
dirs.forEach(function(dir) { | |
var servicePath = path + '/' + dir; | |
var config = require(servicePath + '/config.json'); | |
fs.writeFileSync(servicePath + '/config.js', 'module.exports = ' + util.inspect(config, { depth: null }) + ';'); | |
}); | |
process.exit(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment