diff --git a/.env b/.env new file mode 100644 index 000000000..bfff9dde8 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +NODE_OPTIONS=$(node 'scripts/node_options.js') diff --git a/.npmrc b/.npmrc deleted file mode 100644 index ec57b5f76..000000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -node-options="--no-warnings --no-experimental-global-navigator" diff --git a/package-lock.json b/package-lock.json index a3094d0e4..0267a4b59 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,6 +43,7 @@ "wkt": "^0.1.1" }, "devDependencies": { + "@dotenvx/dotenvx": "^1.14.0", "@fortawesome/fontawesome-svg-core": "^6.6.0", "@fortawesome/free-brands-svg-icons": "^6.6.0", "@fortawesome/free-regular-svg-icons": "^6.6.0", @@ -489,6 +490,95 @@ "kuler": "^2.0.0" } }, + "node_modules/@dotenvx/dotenvx": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@dotenvx/dotenvx/-/dotenvx-1.14.0.tgz", + "integrity": "sha512-ujWncblsqokvW8w6tCW35hjwlD3FHySMdrC5OPMYqfcGR96B/H6xK9xSu5F/SyZ8uk8USoPZynsXxB24IGvfmQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "commander": "^11.1.0", + "dotenv": "^16.4.5", + "eciesjs": "^0.4.6", + "execa": "^5.1.1", + "fdir": "^6.2.0", + "ignore": "^5.3.0", + "object-treeify": "1.1.33", + "picomatch": "^4.0.2", + "which": "^4.0.0" + }, + "bin": { + "dotenvx": "src/cli/dotenvx.js", + "git-dotenvx": "src/cli/dotenvx.js" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/@dotenvx/dotenvx/node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + } + }, + "node_modules/@dotenvx/dotenvx/node_modules/fdir": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.3.0.tgz", + "integrity": "sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/@dotenvx/dotenvx/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16" + } + }, + "node_modules/@dotenvx/dotenvx/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@dotenvx/dotenvx/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, "node_modules/@esbuild/darwin-x64": { "version": "0.23.1", "cpu": [ @@ -909,6 +999,45 @@ "dev": true, "license": "MIT" }, + "node_modules/@noble/ciphers": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.5.3.tgz", + "integrity": "sha512-B0+6IIHiqEs3BPMT0hcRmHvEj2QHOLu+uwt+tqDDeVd0oyVzh7BPrDcPjRnV1PV/5LaknXJJQvOuRGR0zQJz+w==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", + "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.5.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "dev": true, @@ -3271,6 +3400,19 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/earcut": { "version": "2.2.4", "license": "ISC" @@ -3280,6 +3422,21 @@ "dev": true, "license": "MIT" }, + "node_modules/eciesjs": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/eciesjs/-/eciesjs-0.4.7.tgz", + "integrity": "sha512-4JQahOkBdDy27jjW4q3FJQigHlcwZXx28sCtBQkBamF2XUdcNXrInpgrr8h205MtVIS0CMHufyIKGVjtjxQ2ZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@noble/ciphers": "^0.5.3", + "@noble/curves": "^1.4.0", + "@noble/hashes": "^1.4.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/editor-layer-index": { "version": "0.0.0", "resolved": "git+ssh://git@github.com/osmlab/editor-layer-index.git#ca5185ae03ab68e48904ec733df265ccb465f78a", @@ -3837,6 +3994,30 @@ "version": "4.0.7", "license": "MIT" }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, "node_modules/extend": { "version": "3.0.2", "dev": true, @@ -4803,6 +4984,16 @@ "node": ">=8.0.0" } }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, "node_modules/iconv-lite": { "version": "0.6.3", "license": "MIT", @@ -6376,6 +6567,13 @@ "node": ">=0.10.0" } }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "license": "MIT" + }, "node_modules/mime": { "version": "2.6.0", "dev": true, @@ -6406,6 +6604,16 @@ "node": ">= 0.6" } }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/min-document": { "version": "2.19.0", "dev": true, @@ -6905,6 +7113,19 @@ "which": "bin/which" } }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/nth-check": { "version": "2.1.1", "dev": true, @@ -6938,6 +7159,16 @@ "node": ">= 0.4" } }, + "node_modules/object-treeify": { + "version": "1.1.33", + "resolved": "https://registry.npmjs.org/object-treeify/-/object-treeify-1.1.33.tgz", + "integrity": "sha512-EFVjAYfzWqWsBMRHPMAXLCDIJnpMhdWAqR7xG6M6a2cs6PMFpl/+Z20w9zDW4vkxOFfddegBKq9Rehd0bxWE7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, "node_modules/object.assign": { "version": "4.1.4", "dev": true, @@ -6982,6 +7213,22 @@ "fn.name": "1.x.x" } }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/open": { "version": "8.4.0", "dev": true, @@ -8753,6 +9000,16 @@ "node": ">=4" } }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/strip-indent": { "version": "1.0.1", "dev": true, diff --git a/package.json b/package.json index 11ec73a39..1a22e490e 100644 --- a/package.json +++ b/package.json @@ -17,14 +17,14 @@ "benchmark": "run-p start:server test:benchmark", "benchmark-cicd": "run-p start:server test:cicd-benchmark", "build": "run-s build:css build:data build:bundle", - "build:css": "node scripts/build_css.js", + "build:css": "dotenvx run --quiet -- node scripts/build_css.js", "build:data": "shx mkdir -p dist/data && node scripts/build_data.js", - "build:bundle": "node config/esbuild.config.modern.js", + "build:bundle": "dotenvx run --quiet -- node config/esbuild.config.modern.js", "clean": "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*-sprite.svg", "dist": "run-p dist:**", - "dist:legacy:bundle": "node config/esbuild.config.legacy.js", - "dist:min:bundle": "node config/esbuild.config.modern-min.js", - "dist:min:legacy:bundle": "node config/esbuild.config.legacy-min.js", + "dist:legacy:bundle": "dotenvx run --quiet -- node config/esbuild.config.legacy.js", + "dist:min:bundle": "dotenvx run --quiet -- node config/esbuild.config.modern-min.js", + "dist:min:legacy:bundle": "dotenvx run --quiet -- node config/esbuild.config.legacy-min.js", "dist:svg:community": "svg-sprite --symbol --symbol-dest . --shape-id-generator \"community-%s\" --symbol-sprite dist/img/community-sprite.svg node_modules/osm-community-index/dist/img/*.svg", "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg", "dist:svg:maki": "svg-sprite --symbol --symbol-dest . --shape-id-generator \"maki-%s\" --symbol-sprite dist/img/maki-sprite.svg node_modules/@mapbox/maki/icons/*.svg", @@ -34,7 +34,7 @@ "dist:svg:roentgen": "svg-sprite --symbol --symbol-dest . --shape-id-generator \"roentgen-%s\" --symbol-sprite dist/img/roentgen-sprite.svg svg/roentgen/*.svg", "dist:svg:temaki": "svg-sprite --symbol --symbol-dest . --shape-id-generator \"temaki-%s\" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@rapideditor/temaki/icons/*.svg", "docs": "jsdoc -c webdoc.conf.json -r", - "imagery": "node scripts/update_imagery.js", + "imagery": "dotenvx run --quiet -- node scripts/update_imagery.js", "lint": "eslint modules test", "start": "run-s build:css build:bundle start:server", "quickstart": "npm run start", @@ -42,14 +42,14 @@ "stats:codeviz": "esbuild-visualizer --metadata dist/esbuild.json --filename docs/statistics.html", "stats:cloc:modules": "npx cloc --skip-uniqueness --include-ext=css,js,ts,jsx,tsx ./css ./data ./modules", "stats:cloc:tests": "npx cloc --skip-uniqueness --include-ext=css,js,ts,jsx,tsx ./test", - "start:server": "node scripts/server.js", + "start:server": "dotenvx run --quiet -- node scripts/server.js", "test": "npm-run-all -s lint build test:unit test:browser", "test:benchmark": "npm run test:unzip-benchmark-data && npx playwright test --workers=1 --config=test/benchmark/playwright.config.mjs && npm run test:cleanup-benchmark-data", "test:browser": "karma start karma.conf.cjs", - "test:unit": "c8 node --test-reporter spec --test test/unit/**/*.test.js", + "test:unit": "dotenvx run --quiet -- c8 node --test-reporter spec --test test/unit/**/*.test.js", "test:unzip-benchmark-data": "tar -xvf test/benchmark/tokyo_canned_data.zip -C test/benchmark", "test:cleanup-benchmark-data": "rm test/benchmark/tokyo_*_canned_osm_data.js", - "translations": "node scripts/update_translations.js" + "translations": "dotenvx run --quiet -- node scripts/update_translations.js" }, "dependencies": { "@mapbox/geojson-area": "^0.2.2", @@ -86,6 +86,7 @@ "wkt": "^0.1.1" }, "devDependencies": { + "@dotenvx/dotenvx": "^1.14.0", "@fortawesome/fontawesome-svg-core": "^6.6.0", "@fortawesome/free-brands-svg-icons": "^6.6.0", "@fortawesome/free-regular-svg-icons": "^6.6.0", diff --git a/scripts/node_options.js b/scripts/node_options.js new file mode 100644 index 000000000..e950b22c7 --- /dev/null +++ b/scripts/node_options.js @@ -0,0 +1,10 @@ +// This script allows us to use different NODE_OPTIONS +// depending on the node version. +let options = '--no-warnings '; + +const NODE_MAJOR_VERSION = process.versions.node.split('.')[0]; +if (NODE_MAJOR_VERSION >= 22) { + options += '--no-experimental-global-navigator '; +} + +process.stdout.write(options);