Don't check in as many data/ generated files, less agressive minification

(partial revert of c2833ba to help prevent merge conflicts)
This commit is contained in:
Bryan Housel
2016-01-29 23:28:37 -05:00
parent 33330d11d9
commit 90cd412bbe
12 changed files with 47218 additions and 28 deletions

7
.gitignore vendored
View File

@@ -1,7 +1,12 @@
.DS_Store
transifex.auth
node_modules
npm-debug.log
dist/*.js
dist/*.css
dist/img/*.svg
transifex.auth
dist/locales/en.json
data/presets/categories.json
data/presets/fields.json
data/presets/presets.json
data/data.js

View File

@@ -13,7 +13,7 @@ MAKI_SOURCES = node_modules/maki/src/*.svg
$(MAKI_SOURCES): node_modules/.install
dist/img/maki-sprite.svg: $(MAKI_SOURCES) Makefile node_modules/.bin/svg-sprite
dist/img/maki-sprite.svg: $(MAKI_SOURCES) Makefile
node_modules/.bin/svg-sprite --symbol --symbol-dest . --symbol-sprite $@ $(MAKI_SOURCES)
data/feature-icons.json: $(MAKI_SOURCES)
@@ -106,7 +106,8 @@ dist/iD.css: css/*.css
cat css/reset.css css/map.css css/app.css > $@
node_modules/.install: package.json
npm install && touch node_modules/.install
npm install
touch node_modules/.install
clean:
rm -f $(BUILDJS_TARGETS) data/feature-icons.json dist/iD*.js dist/iD.css dist/img/*.svg
@@ -115,7 +116,8 @@ translations:
node data/update_locales
imagery:
npm install editor-imagery-index@git://github.com/osmlab/editor-imagery-index.git#gh-pages && node data/update_imagery
npm install editor-imagery-index@git://github.com/osmlab/editor-imagery-index.git#gh-pages
node data/update_imagery
suggestions:
npm install name-suggestion-index@git://github.com/osmlab/name-suggestion-index.git

View File

@@ -8,8 +8,6 @@
### Make release
TODO: turn this into a script.
- [ ] `make translations`
- [ ] `make imagery`
- [ ] `make suggestions`
@@ -17,7 +15,8 @@ TODO: turn this into a script.
- [ ] Update version number in `id.js`, `package.json`
- [ ] `git checkout release && git reset --hard master`
- [ ] `make`
- [ ] `git add -f dist/*.css dist/*.js dist/img/*.svg && git commit -m 'Check in build'`
- [ ] `git add -f dist/*.css dist/*.js dist/img/*.svg dist/locales/*.json`
- [ ] `git commit -m 'Check in build'`
- [ ] `git tag vA.B.C`
- [ ] `git push origin -f release vA.B.C`

View File

@@ -24,10 +24,6 @@ function rp(f) {
return r('presets/' + f);
}
function stringify(o) {
return JSON.stringify(o);
}
function validate(file, instance, schema) {
var result = jsonschema.validate(instance, schema);
if (result.length) {
@@ -239,9 +235,9 @@ validateCategoryPresets(categories, presets);
validatePresetFields(presets, fields);
// Save individual data files
fs.writeFileSync('data/presets/categories.json', stringify(categories));
fs.writeFileSync('data/presets/fields.json', stringify(fields));
fs.writeFileSync('data/presets/presets.json', stringify(presets));
fs.writeFileSync('data/presets/categories.json', JSON.stringify(categories));
fs.writeFileSync('data/presets/fields.json', JSON.stringify(fields));
fs.writeFileSync('data/presets/presets.json', JSON.stringify(presets));
fs.writeFileSync('data/presets.yaml',
YAML.dump({en: {presets: translate}}, {sortKeys: sortKeys})
.replace(/\'.*#\':/g, '#')
@@ -282,15 +278,15 @@ _.forEach(presets, function(preset) {
taginfo.tags.push(tag);
});
fs.writeFileSync('data/taginfo.json', stringify(taginfo));
fs.writeFileSync('data/taginfo.json', JSON.stringify(taginfo, null, 1));
// Push changes from data/core.yaml into en.json
var core = YAML.load(fs.readFileSync('data/core.yaml', 'utf8'));
var presets = {en: {presets: translations}};
var en = _.merge(core, presets);
fs.writeFileSync('dist/locales/en.json', stringify(en.en));
fs.writeFileSync('dist/locales/en.json', JSON.stringify(en.en, null, 1));
fs.writeFileSync('data/data.js', 'iD.data = ' + stringify({
fs.writeFileSync('data/data.js', 'iD.data = ' + JSON.stringify({
deprecated: r('deprecated.json'),
discarded: r('discarded.json'),
wikipedia: r('wikipedia.json'),
@@ -302,11 +298,11 @@ fs.writeFileSync('data/data.js', 'iD.data = ' + stringify({
addressFormats: r('address-formats.json')
}) + ';');
fs.writeFileSync('dist/presets.js', 'iD.data.presets = ' + stringify({
fs.writeFileSync('dist/presets.js', 'iD.data.presets = ' + JSON.stringify({
presets: rp('presets.json'),
defaults: rp('defaults.json'),
categories: rp('categories.json'),
fields: rp('fields.json')
}) + ';');
fs.writeFileSync('dist/imagery.js', 'iD.data.imagery = ' + stringify(r('imagery.json')) + ';');
fs.writeFileSync('dist/imagery.js', 'iD.data.imagery = ' + JSON.stringify(r('imagery.json')) + ';');

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
{"category-building":{"geometry":"area","name":"Building","icon":"building","members":["building/house","building/apartments","building/commercial","building/industrial","building/residential","building"]},"category-golf":{"geometry":"area","name":"Golf","icon":"golf","members":["golf/fairway","golf/green","golf/lateral_water_hazard","golf/rough","golf/bunker","golf/tee","golf/water_hazard"]},"category-landuse":{"geometry":"area","name":"Land Use","icon":"land-use","members":["landuse/residential","landuse/industrial","landuse/commercial","landuse/retail","landuse/farmland","landuse/farmyard","landuse/forest","landuse/meadow","landuse/cemetery","landuse/military"]},"category-path":{"geometry":"line","name":"Path","icon":"category-path","members":["highway/pedestrian","highway/footway","highway/cycleway","highway/bridleway","highway/path","highway/steps"]},"category-rail":{"geometry":"line","name":"Rail","icon":"category-rail","members":["railway/rail","railway/subway","railway/tram","railway/monorail","railway/disused","railway/abandoned"]},"category-restriction":{"geometry":"relation","name":"Restriction","icon":"restriction","members":["type/restriction/no_left_turn","type/restriction/no_right_turn","type/restriction/no_straight_on","type/restriction/no_u_turn","type/restriction/only_left_turn","type/restriction/only_right_turn","type/restriction/only_straight_on","type/restriction"]},"category-road":{"geometry":"line","name":"Road","icon":"category-roads","members":["highway/residential","highway/motorway","highway/trunk","highway/primary","highway/secondary","highway/tertiary","highway/service","highway/motorway_link","highway/trunk_link","highway/primary_link","highway/secondary_link","highway/tertiary_link","highway/unclassified","highway/track","highway/road"]},"category-route":{"geometry":"relation","name":"Route","icon":"route","members":["type/route/road","type/route/bicycle","type/route/foot","type/route/hiking","type/route/bus","type/route/train","type/route/tram","type/route/ferry","type/route/power","type/route/pipeline","type/route/detour","type/route_master","type/route"]},"category-water-area":{"geometry":"area","name":"Water","icon":"water","members":["natural/water/lake","natural/water/pond","natural/water/reservoir","natural/water"]},"category-water-line":{"geometry":"line","name":"Water","icon":"category-water","members":["waterway/river","waterway/stream","waterway/canal","waterway/ditch","waterway/drain"]}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -102,4 +102,4 @@ imagery.sort(function(a, b) {
return a.name.localeCompare(b.name);
});
fs.writeFileSync('data/imagery.json', JSON.stringify(imagery));
fs.writeFileSync('data/imagery.json', JSON.stringify(imagery, null, 1));

View File

@@ -38,10 +38,10 @@ asyncMap(resources, getResource, function(err, locales) {
for (var i in locale) {
if (i === 'en' || _.isEmpty(locale[i])) continue;
codes.push(i);
fs.writeFileSync(outdir + i + '.json', JSON.stringify(locale[i]));
fs.writeFileSync(outdir + i + '.json', JSON.stringify(locale[i], null, 1));
}
fs.writeFileSync('data/locales.json', JSON.stringify(codes));
fs.writeFileSync('data/locales.json', JSON.stringify(codes, null, 1));
});
function getResource(resource, callback) {

File diff suppressed because one or more lines are too long