mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
allow to specify presets cdn via env variable or dotenv file
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,6 +6,7 @@
|
||||
/.tx/tmp/
|
||||
npm-debug.log
|
||||
package-lock.json
|
||||
.env
|
||||
|
||||
transifex.auth
|
||||
|
||||
@@ -26,4 +27,4 @@ land.html
|
||||
/img
|
||||
/css/img
|
||||
/test/css
|
||||
/test/img
|
||||
/test/img
|
||||
|
||||
8
config/envs.mjs
Normal file
8
config/envs.mjs
Normal file
@@ -0,0 +1,8 @@
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
const envs = {
|
||||
ID_PRESETS_CDN_URL: JSON.stringify(process.env.ID_PRESETS_CDN_URL || null)
|
||||
}
|
||||
|
||||
export default envs;
|
||||
@@ -1,7 +1,9 @@
|
||||
import esbuild from 'esbuild';
|
||||
import envs from './envs.mjs';
|
||||
|
||||
esbuild
|
||||
.build({
|
||||
define: envs,
|
||||
minify: true,
|
||||
bundle: true,
|
||||
sourcemap: true,
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import esbuild from 'esbuild';
|
||||
import fs from 'node:fs';
|
||||
import parse from 'minimist';
|
||||
import envs from './envs.mjs';
|
||||
|
||||
let args = parse(process.argv.slice(2), {boolean: true});
|
||||
delete args._;
|
||||
|
||||
const context = await esbuild.context({
|
||||
define: envs,
|
||||
bundle: true,
|
||||
sourcemap: true,
|
||||
entryPoints: ['./modules/id.js'],
|
||||
@@ -23,4 +25,4 @@ if (args.watch) {
|
||||
fs.writeFileSync('./dist/esbuild.json', JSON.stringify(build.metafile, null, 2));
|
||||
}
|
||||
await context.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
//import * as env from 'env';
|
||||
|
||||
// cdns for external data packages
|
||||
const presetsCdnUrl = 'https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/';
|
||||
const presetsCdnUrl = ENV__ID_PRESETS_CDN_URL || 'https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/';
|
||||
const ociCdnUrl = 'https://cdn.jsdelivr.net/npm/osm-community-index@{version}/';
|
||||
const wmfSitematrixCdnUrl = 'https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/';
|
||||
const nsiCdnUrl = 'https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/';
|
||||
|
||||
@@ -86,8 +86,9 @@
|
||||
"cldr-localenames-full": "^41.0.0",
|
||||
"concat-files": "^0.1.1",
|
||||
"d3": "~7.8.1",
|
||||
"dotenv": "^16.0.3",
|
||||
"editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
|
||||
"esbuild": "^0.17.3",
|
||||
"esbuild": "^0.17.10",
|
||||
"esbuild-visualizer": "^0.4.0",
|
||||
"eslint": "^8.8.0",
|
||||
"fetch-mock": "^9.11.0",
|
||||
|
||||
Reference in New Issue
Block a user