Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created March 8, 2013 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/5119815 to your computer and use it in GitHub Desktop.
Save tmcw/5119815 to your computer and use it in GitHub Desktop.
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