mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-16 05:49:16 +02:00
Cleanup build_src script.. add emojis to build messages
This commit is contained in:
@@ -25,8 +25,8 @@ function buildAll() {
|
||||
|
||||
|
||||
function buildBundle() {
|
||||
return buildData();
|
||||
// .then(() => buildSrc());
|
||||
return buildData()
|
||||
.then(() => buildSrc());
|
||||
}
|
||||
|
||||
module.exports = buildAll;
|
||||
|
||||
+9
-3
@@ -12,18 +12,24 @@ buildCSS();
|
||||
function buildCSS() {
|
||||
if (_currBuild) return _currBuild;
|
||||
|
||||
console.log('building css');
|
||||
console.time(colors.green('css built'));
|
||||
const START = '🏗 ' + colors.yellow('Building css...');
|
||||
const END = '👍 ' + colors.green('css built');
|
||||
|
||||
console.log('');
|
||||
console.log(START);
|
||||
console.time(END);
|
||||
|
||||
return _currBuild =
|
||||
doGlob('css/**/*.css')
|
||||
.then((files) => doConcat(files, 'dist/iD.css'))
|
||||
.then(() => {
|
||||
console.timeEnd(colors.green('css built'));
|
||||
console.timeEnd(END);
|
||||
console.log('');
|
||||
_currBuild = null;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
console.log('');
|
||||
_currBuild = null;
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
+18
-3
@@ -32,8 +32,12 @@ buildData();
|
||||
function buildData() {
|
||||
if (_currBuild) return _currBuild;
|
||||
|
||||
console.log('building data');
|
||||
console.time(colors.green('data built'));
|
||||
const START = '🏗 ' + colors.yellow('Building data...');
|
||||
const END = '👍 ' + colors.green('data built');
|
||||
|
||||
console.log('');
|
||||
console.log(START);
|
||||
console.time(END);
|
||||
|
||||
// Create symlinks if necessary.. { 'target': 'source' }
|
||||
const symlinks = {
|
||||
@@ -110,11 +114,13 @@ function buildData() {
|
||||
return _currBuild =
|
||||
Promise.all(tasks)
|
||||
.then(() => {
|
||||
console.timeEnd(colors.green('data built'));
|
||||
console.timeEnd(END);
|
||||
console.log('');
|
||||
_currBuild = null;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
console.log('');
|
||||
_currBuild = null;
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -138,6 +144,7 @@ function validate(file, instance, schema) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
console.log('');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -616,6 +623,7 @@ function validateCategoryPresets(categories, presets) {
|
||||
category.members.forEach(preset => {
|
||||
if (presets[preset] === undefined) {
|
||||
console.error('Unknown preset: ' + preset + ' in category ' + category.name);
|
||||
console.log('');
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
@@ -636,9 +644,11 @@ function validatePresetFields(presets, fields) {
|
||||
let p2geometry = replacementPreset.geometry.slice().sort.toString();
|
||||
if (replacementPreset === undefined) {
|
||||
console.error('Unknown preset "' + preset.replacement + '" referenced as replacement of preset ' + preset.name);
|
||||
console.log('');
|
||||
process.exit(1);
|
||||
} else if (p1geometry !== p2geometry) {
|
||||
console.error('The preset "' + presetID + '" has different geometry than its replacement preset, "' + preset.replacement + '". They must match for tag upgrades to work.');
|
||||
console.log('');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -658,10 +668,12 @@ function validatePresetFields(presets, fields) {
|
||||
let foreignPresetID = regexResult[0];
|
||||
if (presets[foreignPresetID] === undefined) {
|
||||
console.error('Unknown preset "' + foreignPresetID + '" referenced in "' + fieldsKey + '" array of preset ' + preset.name);
|
||||
console.log('');
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
console.error('Unknown preset field "' + field + '" in "' + fieldsKey + '" array of preset ' + preset.name);
|
||||
console.log('');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -682,6 +694,7 @@ function validatePresetFields(presets, fields) {
|
||||
}
|
||||
if (fieldCount > maxFieldsBeforeError) {
|
||||
console.error(fieldCount + ' values in "fields" of "' + preset.name + '" (' + presetID + '). Limit: ' + maxFieldsBeforeError + '. Please move lower-priority fields to "moreFields".');
|
||||
console.log('');
|
||||
process.exit(1);
|
||||
}
|
||||
else if (fieldCount > maxFieldsBeforeWarning) {
|
||||
@@ -697,6 +710,7 @@ function validateDefaults(defaults, categories, presets) {
|
||||
members.forEach(id => {
|
||||
if (!presets[id] && !categories[id]) {
|
||||
console.error('Unknown category or preset: ' + id + ' in default ' + name);
|
||||
console.log('');
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
@@ -853,4 +867,5 @@ function readFileProm(path, options) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
module.exports = buildData;
|
||||
+62
-54
@@ -8,65 +8,73 @@ const rollup = require('rollup');
|
||||
const shell = require('shelljs');
|
||||
//const visualizer = require('rollup-plugin-visualizer');
|
||||
|
||||
let _isBuilding = false;
|
||||
let _currBuild = null;
|
||||
|
||||
// if called directly, do the thing.
|
||||
buildSrc();
|
||||
|
||||
|
||||
module.exports = function buildSrc() {
|
||||
return function () {
|
||||
if (_isBuilding) return;
|
||||
function buildSrc() {
|
||||
if (_currBuild) return _currBuild;
|
||||
|
||||
// Start clean
|
||||
shell.rm('-f', [
|
||||
//'docs/statistics.html',
|
||||
'dist/iD.js',
|
||||
'dist/iD.js.map'
|
||||
]);
|
||||
const START = '🏗 ' + colors.yellow('Building bundles...');
|
||||
const END = '👍 ' + colors.green('bundles built');
|
||||
|
||||
console.log('building src');
|
||||
console.time(colors.green('src built'));
|
||||
console.log('');
|
||||
console.log(START);
|
||||
console.time(END);
|
||||
|
||||
_isBuilding = true;
|
||||
// Start clean
|
||||
shell.rm('-f', [
|
||||
//'docs/statistics.html',
|
||||
'dist/iD.js',
|
||||
'dist/iD.js.map'
|
||||
]);
|
||||
|
||||
return rollup
|
||||
.rollup({
|
||||
input: './modules/id.js',
|
||||
plugins: [
|
||||
includePaths({
|
||||
paths: ['node_modules/d3/node_modules'], // npm2 or windows
|
||||
include: {
|
||||
'martinez-polygon-clipping': 'node_modules/martinez-polygon-clipping/dist/martinez.umd.js'
|
||||
}
|
||||
}),
|
||||
nodeResolve({
|
||||
mainFields: ['module', 'main'],
|
||||
browser: false,
|
||||
dedupe: ['object-inspect']
|
||||
}),
|
||||
commonjs(),
|
||||
json({ indent: '' }),
|
||||
// viz causes src build to take about 3x longer; skip
|
||||
// visualizer({
|
||||
// filename: 'docs/statistics.html',
|
||||
// sourcemap: true
|
||||
// })
|
||||
]
|
||||
})
|
||||
.then((bundle) => {
|
||||
return bundle.write({
|
||||
format: 'iife',
|
||||
file: 'dist/iD.js',
|
||||
sourcemap: true,
|
||||
strict: false
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
_isBuilding = false;
|
||||
console.timeEnd(colors.green('src built'));
|
||||
})
|
||||
.catch((err) => {
|
||||
_isBuilding = false;
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
return _currBuild =
|
||||
rollup.rollup({
|
||||
input: './modules/id.js',
|
||||
plugins: [
|
||||
includePaths({
|
||||
paths: ['node_modules/d3/node_modules'], // npm2 or windows
|
||||
include: {
|
||||
'martinez-polygon-clipping': 'node_modules/martinez-polygon-clipping/dist/martinez.umd.js'
|
||||
}
|
||||
}),
|
||||
nodeResolve({
|
||||
mainFields: ['module', 'main'],
|
||||
browser: false,
|
||||
dedupe: ['object-inspect']
|
||||
}),
|
||||
commonjs(),
|
||||
json({ indent: '' }),
|
||||
// viz causes src build to take about 3x longer; skip
|
||||
// visualizer({
|
||||
// filename: 'docs/statistics.html',
|
||||
// sourcemap: true
|
||||
// })
|
||||
]
|
||||
})
|
||||
.then((bundle) => {
|
||||
return bundle.write({
|
||||
format: 'iife',
|
||||
file: 'dist/iD.js',
|
||||
sourcemap: true,
|
||||
strict: false
|
||||
});
|
||||
};
|
||||
})
|
||||
.then(() => {
|
||||
console.timeEnd(END);
|
||||
console.log('');
|
||||
_currBuild = false;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
_currBuild = false;
|
||||
console.log('');
|
||||
process.exit(1);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = buildSrc;
|
||||
|
||||
Reference in New Issue
Block a user