mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
allow processing preset icons data from files in npm run build:data
This commit is contained in:
@@ -97,9 +97,9 @@ function buildData() {
|
||||
minifyJSON('data/territory_languages.json', 'dist/data/territory_languages.min.json'),
|
||||
Promise.all([
|
||||
// Fetch the icons that are needed by the expected tagging schema version
|
||||
fetch(`${presetsUrl}/dist/presets.min.json`),
|
||||
fetch(`${presetsUrl}/dist/preset_categories.min.json`),
|
||||
fetch(`${presetsUrl}/dist/fields.min.json`),
|
||||
fetchOrRequire(`${presetsUrl}/dist/presets.min.json`),
|
||||
fetchOrRequire(`${presetsUrl}/dist/preset_categories.min.json`),
|
||||
fetchOrRequire(`${presetsUrl}/dist/fields.min.json`),
|
||||
// WARNING: we fetch the bleeding edge data too to make sure we're always hosting the
|
||||
// latest icons, but note that the format could break at any time
|
||||
fetch('https://raw.githubusercontent.com/openstreetmap/id-tagging-schema/main/dist/presets.min.json'),
|
||||
@@ -267,4 +267,13 @@ function minifyJSON(inPath, outPath) {
|
||||
}
|
||||
|
||||
|
||||
function fetchOrRequire(url) {
|
||||
if (url.startsWith('.')) {
|
||||
return Promise.resolve({ json: () => Promise.resolve(require(url)) });
|
||||
} else {
|
||||
return fetch(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = buildData;
|
||||
|
||||
Reference in New Issue
Block a user