Created
March 8, 2013 21:02
-
-
Save tmcw/5119815 to your computer and use it in GitHub Desktop.
This file contains 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
var fs = require('fs'), | |
glob = require('glob'); | |
function read(f) { | |
JSON.parse(fs.readFileSync(f)); | |
} | |
function r(f) { | |
return read(__dirname + '/data/' + f); | |
} | |
function rp(f) { | |
return r('presets/' + f); | |
} | |
fs.writeFileSync('data/presets/presets.json', JSON.stringify( | |
glob.sync(__dirname + '/data/presets/presets/**/*.json').map(function(file) { | |
return read(file); | |
}))); | |
fs.writeFileSync('data.js', 'iD.data = ' + JSON.stringify({ | |
deprecated: r('deprecated.json'), | |
discarded: r('discarded.json'), | |
keys: r('keys.json'), | |
presets: { | |
presets: rp('presets.json'), | |
defaults: rp('defaults.json'), | |
categories: rp('categories.json'), | |
forms: rp('forms.json') | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment