Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit 90cd412

Browse files
committed
Don't check in as many data/ generated files, less agressive minification
(partial revert of c2833ba to help prevent merge conflicts)
1 parent 33330d1 commit 90cd412

12 files changed

+47218
-28
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
.DS_Store
2+
transifex.auth
23
node_modules
34
npm-debug.log
45
dist/*.js
56
dist/*.css
67
dist/img/*.svg
7-
transifex.auth
8+
dist/locales/en.json
9+
data/presets/categories.json
10+
data/presets/fields.json
11+
data/presets/presets.json
12+
data/data.js

Makefile

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ MAKI_SOURCES = node_modules/maki/src/*.svg
1313

1414
$(MAKI_SOURCES): node_modules/.install
1515

16-
dist/img/maki-sprite.svg: $(MAKI_SOURCES) Makefile node_modules/.bin/svg-sprite
16+
dist/img/maki-sprite.svg: $(MAKI_SOURCES) Makefile
1717
node_modules/.bin/svg-sprite --symbol --symbol-dest . --symbol-sprite $@ $(MAKI_SOURCES)
1818

1919
data/feature-icons.json: $(MAKI_SOURCES)
@@ -106,7 +106,8 @@ dist/iD.css: css/*.css
106106
cat css/reset.css css/map.css css/app.css > $@
107107

108108
node_modules/.install: package.json
109-
npm install && touch node_modules/.install
109+
npm install
110+
touch node_modules/.install
110111

111112
clean:
112113
rm -f $(BUILDJS_TARGETS) data/feature-icons.json dist/iD*.js dist/iD.css dist/img/*.svg
@@ -115,7 +116,8 @@ translations:
115116
node data/update_locales
116117

117118
imagery:
118-
npm install editor-imagery-index@git://github.com/osmlab/editor-imagery-index.git#gh-pages && node data/update_imagery
119+
npm install editor-imagery-index@git://github.com/osmlab/editor-imagery-index.git#gh-pages
120+
node data/update_imagery
119121

120122
suggestions:
121123
npm install name-suggestion-index@git://github.com/osmlab/name-suggestion-index.git

RELEASING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@
88

99
### Make release
1010

11-
TODO: turn this into a script.
12-
1311
- [ ] `make translations`
1412
- [ ] `make imagery`
1513
- [ ] `make suggestions`
1614
- [ ] Update `CHANGELOG.md`
1715
- [ ] Update version number in `id.js`, `package.json`
1816
- [ ] `git checkout release && git reset --hard master`
1917
- [ ] `make`
20-
- [ ] `git add -f dist/*.css dist/*.js dist/img/*.svg && git commit -m 'Check in build'`
18+
- [ ] `git add -f dist/*.css dist/*.js dist/img/*.svg dist/locales/*.json`
19+
- [ ] `git commit -m 'Check in build'`
2120
- [ ] `git tag vA.B.C`
2221
- [ ] `git push origin -f release vA.B.C`
2322

build.js

+8-12
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ function rp(f) {
2424
return r('presets/' + f);
2525
}
2626

27-
function stringify(o) {
28-
return JSON.stringify(o);
29-
}
30-
3127
function validate(file, instance, schema) {
3228
var result = jsonschema.validate(instance, schema);
3329
if (result.length) {
@@ -239,9 +235,9 @@ validateCategoryPresets(categories, presets);
239235
validatePresetFields(presets, fields);
240236

241237
// Save individual data files
242-
fs.writeFileSync('data/presets/categories.json', stringify(categories));
243-
fs.writeFileSync('data/presets/fields.json', stringify(fields));
244-
fs.writeFileSync('data/presets/presets.json', stringify(presets));
238+
fs.writeFileSync('data/presets/categories.json', JSON.stringify(categories));
239+
fs.writeFileSync('data/presets/fields.json', JSON.stringify(fields));
240+
fs.writeFileSync('data/presets/presets.json', JSON.stringify(presets));
245241
fs.writeFileSync('data/presets.yaml',
246242
YAML.dump({en: {presets: translate}}, {sortKeys: sortKeys})
247243
.replace(/\'.*#\':/g, '#')
@@ -282,15 +278,15 @@ _.forEach(presets, function(preset) {
282278
taginfo.tags.push(tag);
283279
});
284280

285-
fs.writeFileSync('data/taginfo.json', stringify(taginfo));
281+
fs.writeFileSync('data/taginfo.json', JSON.stringify(taginfo, null, 1));
286282

287283
// Push changes from data/core.yaml into en.json
288284
var core = YAML.load(fs.readFileSync('data/core.yaml', 'utf8'));
289285
var presets = {en: {presets: translations}};
290286
var en = _.merge(core, presets);
291-
fs.writeFileSync('dist/locales/en.json', stringify(en.en));
287+
fs.writeFileSync('dist/locales/en.json', JSON.stringify(en.en, null, 1));
292288

293-
fs.writeFileSync('data/data.js', 'iD.data = ' + stringify({
289+
fs.writeFileSync('data/data.js', 'iD.data = ' + JSON.stringify({
294290
deprecated: r('deprecated.json'),
295291
discarded: r('discarded.json'),
296292
wikipedia: r('wikipedia.json'),
@@ -302,11 +298,11 @@ fs.writeFileSync('data/data.js', 'iD.data = ' + stringify({
302298
addressFormats: r('address-formats.json')
303299
}) + ';');
304300

305-
fs.writeFileSync('dist/presets.js', 'iD.data.presets = ' + stringify({
301+
fs.writeFileSync('dist/presets.js', 'iD.data.presets = ' + JSON.stringify({
306302
presets: rp('presets.json'),
307303
defaults: rp('defaults.json'),
308304
categories: rp('categories.json'),
309305
fields: rp('fields.json')
310306
}) + ';');
311307

312-
fs.writeFileSync('dist/imagery.js', 'iD.data.imagery = ' + stringify(r('imagery.json')) + ';');
308+
fs.writeFileSync('dist/imagery.js', 'iD.data.imagery = ' + JSON.stringify(r('imagery.json')) + ';');

data/imagery.json

+44,697-1
Large diffs are not rendered by default.

data/presets/categories.json

-1
This file was deleted.

data/presets/fields.json

-1
This file was deleted.

data/presets/presets.json

-1
This file was deleted.

data/taginfo.json

+2,497-1
Large diffs are not rendered by default.

data/update_imagery.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ imagery.sort(function(a, b) {
102102
return a.name.localeCompare(b.name);
103103
});
104104

105-
fs.writeFileSync('data/imagery.json', JSON.stringify(imagery));
105+
fs.writeFileSync('data/imagery.json', JSON.stringify(imagery, null, 1));

data/update_locales.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ asyncMap(resources, getResource, function(err, locales) {
3838
for (var i in locale) {
3939
if (i === 'en' || _.isEmpty(locale[i])) continue;
4040
codes.push(i);
41-
fs.writeFileSync(outdir + i + '.json', JSON.stringify(locale[i]));
41+
fs.writeFileSync(outdir + i + '.json', JSON.stringify(locale[i], null, 1));
4242
}
4343

44-
fs.writeFileSync('data/locales.json', JSON.stringify(codes));
44+
fs.writeFileSync('data/locales.json', JSON.stringify(codes, null, 1));
4545
});
4646

4747
function getResource(resource, callback) {

dist/locales/en.json

-1
This file was deleted.

0 commit comments

Comments
 (0)