diff --git a/RELEASING.md b/RELEASING.md index 15b5098a4..a8076fddd 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -51,7 +51,7 @@ git push origin main ``` -### Update and tag `release` branch +### Update `release` branch The `release` branch checks in the contents of `/dist` too, this makes it suitable for deployment. It's basically a copy of `main` but with one additional commit appended to it. @@ -67,7 +67,8 @@ git commit -m 'Check in build' git push origin -f release ``` -Sanity check: +#### Sanity checks + - At this point, our GitHub deploy action should notice that a commit was pushed to the release branch. - You can check the status of the action to see where the release got deployed: https://github.com/facebook/Rapid/actions/workflows/deploy.yml @@ -76,6 +77,25 @@ Sanity check: - If something looks wrong, you can still go back to `main` and push more commits, then remake the `release` branch as above. +#### Dry run + +Confirm that publish will work, and that it won't be >150 MB. +If it is too large, the JSDelivr CDN will not serve it. See Rapid#1561 + +```bash +npm publish --dry-run +``` + +Typically you should see something like this: +``` +npm notice package size: 24.5 MB +npm notice unpacked size: 94.8 MB +``` +(someday: can we automate this check?) + + +#### Tag and Publish + The point of no return, tag and publish: ```bash git tag "$VERSION" @@ -116,6 +136,12 @@ curl 'https://purge.jsdelivr.net/npm/@rapideditor/rapid@2/dist/rapid.js' curl 'https://purge.jsdelivr.net/npm/@rapideditor/rapid@2/dist/rapid.min.js' ``` +### Update rapid-standalone + +See https://github.com/rapideditor/rapid-standalone +After publishing a new version of Rapid, you should also refresh and publish a new version of that project too. + + ### Notify Partners Notify anyone who uses Rapid that there is a new release. diff --git a/modules/core/AssetSystem.js b/modules/core/AssetSystem.js index f226afe77..3fe99c107 100644 --- a/modules/core/AssetSystem.js +++ b/modules/core/AssetSystem.js @@ -20,57 +20,17 @@ export class AssetSystem extends AbstractSystem { this.id = 'assets'; this.dependencies = new Set(); + // // Rapid's asset map contains all of the data files that we may need to load. // The data files are identified by keys, and are organized by origin. - // 'local' - will only load assets from the local folder. // 'latest' - may load latest assets from a CDN which match the expected semantic version + // 'local' - will only load assets from the local folder. + // + // Important: To use 'local', you'll need to have installed a version of Rapid + // that has all of these dependencies copied into `/dist/data/modules/`. + // See https://github.com/rapideditor/rapid-standalone if this is what you need. // this.sources = { - local: { - 'address_formats': 'data/address_formats.min.json', - 'imagery': 'data/imagery.min.json', - 'intro_graph': 'data/intro_graph.min.json', - 'intro_rapid_graph': 'data/intro_rapid_graph.min.json', - 'languages': 'data/languages.min.json', - 'locales': 'data/locales.min.json', - 'phone_formats': 'data/phone_formats.min.json', - 'qa_data': 'data/qa_data.min.json', - 'shortcuts': 'data/shortcuts.min.json', - 'tagging_preset_overrides': 'data/preset_overrides.min.json', - 'territory_languages': 'data/territory_languages.min.json', - 'wayback': 'data/wayback.min.json', - - 'mapillary_js': 'data/modules/mapillary-js/mapillary.js', // note no .min - 'mapillary_css': 'data/modules/mapillary-js/mapillary.css', // note no .min - - 'maplibre_js': 'data/modules/maplibre-gl/maplibre-gl.js', // note no .min - 'maplibre_css': 'data/modules/maplibre-gl/maplibre-gl.css', // note no .min - - 'nsi_data': 'data/modules/name-suggestion-index/nsi.min.json', - 'nsi_dissolved': 'data/modules/name-suggestion-index/dissolved.min.json', - 'nsi_features': 'data/modules/name-suggestion-index/featureCollection.min.json', - 'nsi_generics': 'data/modules/name-suggestion-index/genericWords.min.json', - 'nsi_presets': 'data/modules/name-suggestion-index/presets/nsi-id-presets.min.json', - 'nsi_replacements': 'data/modules/name-suggestion-index/replacements.min.json', - 'nsi_trees': 'data/modules/name-suggestion-index/trees.min.json', - - 'oci_defaults': 'data/modules/osm-community-index/defaults.min.json', - 'oci_features': 'data/modules/osm-community-index/featureCollection.min.json', - 'oci_resources': 'data/modules/osm-community-index/resources.min.json', - - 'pannellum_js': 'data/modules/pannellum/pannellum.js', // note no .min - 'pannellum_css': 'data/modules/pannellum/pannellum.css', // note no .min - - 'tagging_deprecated': 'data/modules/id-tagging-schema/deprecated.min.json', - 'tagging_discarded': 'data/modules/id-tagging-schema/discarded.min.json', - 'tagging_preset_categories': 'data/modules/id-tagging-schema/preset_categories.min.json', - 'tagging_preset_defaults': 'data/modules/id-tagging-schema/preset_defaults.min.json', - 'tagging_preset_fields': 'data/modules/id-tagging-schema/fields.min.json', - 'tagging_preset_presets': 'data/modules/id-tagging-schema/presets.min.json', - - 'wmf_sitematrix': 'data/modules/wmf-sitematrix/wikipedia.min.json' - }, - latest: { 'address_formats': 'data/address_formats.min.json', 'imagery': 'data/imagery.min.json', @@ -114,6 +74,51 @@ export class AssetSystem extends AbstractSystem { 'tagging_preset_presets': 'https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@6.6/dist/presets.min.json', 'wmf_sitematrix': 'https://cdn.jsdelivr.net/npm/wmf-sitematrix@0.1/wikipedia.min.json' + }, + + local: { + 'address_formats': 'data/address_formats.min.json', + 'imagery': 'data/imagery.min.json', + 'intro_graph': 'data/intro_graph.min.json', + 'intro_rapid_graph': 'data/intro_rapid_graph.min.json', + 'languages': 'data/languages.min.json', + 'locales': 'data/locales.min.json', + 'phone_formats': 'data/phone_formats.min.json', + 'qa_data': 'data/qa_data.min.json', + 'shortcuts': 'data/shortcuts.min.json', + 'tagging_preset_overrides': 'data/preset_overrides.min.json', + 'territory_languages': 'data/territory_languages.min.json', + 'wayback': 'data/wayback.min.json', + + 'mapillary_js': 'data/modules/mapillary-js/mapillary.js', // note no .min + 'mapillary_css': 'data/modules/mapillary-js/mapillary.css', // note no .min + + 'maplibre_js': 'data/modules/maplibre-gl/maplibre-gl.js', // note no .min + 'maplibre_css': 'data/modules/maplibre-gl/maplibre-gl.css', // note no .min + + 'nsi_data': 'data/modules/name-suggestion-index/nsi.min.json', + 'nsi_dissolved': 'data/modules/name-suggestion-index/dissolved.min.json', + 'nsi_features': 'data/modules/name-suggestion-index/featureCollection.min.json', + 'nsi_generics': 'data/modules/name-suggestion-index/genericWords.min.json', + 'nsi_presets': 'data/modules/name-suggestion-index/presets/nsi-id-presets.min.json', + 'nsi_replacements': 'data/modules/name-suggestion-index/replacements.min.json', + 'nsi_trees': 'data/modules/name-suggestion-index/trees.min.json', + + 'oci_defaults': 'data/modules/osm-community-index/defaults.min.json', + 'oci_features': 'data/modules/osm-community-index/featureCollection.min.json', + 'oci_resources': 'data/modules/osm-community-index/resources.min.json', + + 'pannellum_js': 'data/modules/pannellum/pannellum.js', // note no .min + 'pannellum_css': 'data/modules/pannellum/pannellum.css', // note no .min + + 'tagging_deprecated': 'data/modules/id-tagging-schema/deprecated.min.json', + 'tagging_discarded': 'data/modules/id-tagging-schema/discarded.min.json', + 'tagging_preset_categories': 'data/modules/id-tagging-schema/preset_categories.min.json', + 'tagging_preset_defaults': 'data/modules/id-tagging-schema/preset_defaults.min.json', + 'tagging_preset_fields': 'data/modules/id-tagging-schema/fields.min.json', + 'tagging_preset_presets': 'data/modules/id-tagging-schema/presets.min.json', + + 'wmf_sitematrix': 'data/modules/wmf-sitematrix/wikipedia.min.json' } }; diff --git a/package-lock.json b/package-lock.json index 147d36ff0..ce82ff18a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@mapbox/polylabel": "1.0.2", "@mapbox/sexagesimal": "1.2.0", "@mapbox/vector-tile": "^2.0.3", + "@openstreetmap/id-tagging-schema": "~6.6.0", "@pixi/display": "7.4.0", "@pixi/events": "7.4.0", "@rapid-sdk/math": "~1.0.0-pre.3", @@ -26,12 +27,18 @@ "@tmcw/togeojson": "^5.8.1", "@types/chai": "^4.3.19", "d3": "~7.9.0", + "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages", "fast-deep-equal": "~3.1.3", "fast-json-stable-stringify": "2.1.0", "lodash-es": "~4.17.21", + "mapillary-js": "^4.1.2", + "maplibre-gl": "^3.6.2", "marked": "~14.1.2", + "name-suggestion-index": "~6.0.20240909", "node-diff3": "~3.1.2", "osm-auth": "2.5.0", + "osm-community-index": "~5.8.1", + "pannellum": "^2.5.6", "pbf": "^4.0.1", "pixi-filters": "5.3.0", "pixi.js": "7.4.0", @@ -40,7 +47,8 @@ "prop-types": "^15.8.1", "rbush": "4.0.1", "which-polygon": "2.2.1", - "wkt": "^0.1.1" + "wkt": "^0.1.1", + "wmf-sitematrix": "^0.1.5" }, "devDependencies": { "@dotenvx/dotenvx": "^1.14.0", @@ -49,7 +57,6 @@ "@fortawesome/free-regular-svg-icons": "^6.6.0", "@fortawesome/free-solid-svg-icons": "^6.6.0", "@mapbox/maki": "^8.0.1", - "@openstreetmap/id-tagging-schema": "~6.6.0", "@pixi/jsdoc-template": "^2.6.0", "@playwright/test": "^1.47.0", "@rapideditor/mapillary_sprite_source": "^1.8.0", @@ -64,7 +71,6 @@ "cldr-localenames-full": "45.0.0", "cloc": "^1.98.0-cloc", "concat-files": "^0.1.1", - "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages", "esbuild": "^0.23.1", "esbuild-visualizer": "^0.6.0", "eslint": "^9.10.0", @@ -83,21 +89,15 @@ "karma-mocha": "^2.0.1", "karma-mocha-reporter": "^2.2.5", "karma-remap-istanbul": "^0.6.0", - "mapillary-js": "^4.1.2", - "maplibre-gl": "^3.6.2", "mocha": "^10.7.3", - "name-suggestion-index": "~6.0.20240909", "npm-run-all": "^4.1.5", - "osm-community-index": "~5.8.1", - "pannellum": "^2.5.6", "postcss": "^8.4.45", "postcss-selector-prepend": "^0.5.0", "shelljs": "^0.8.5", "shx": "^0.3.4", "sinon": "^18.0.1", "static-server": "^3.0.0", - "svg-sprite": "2.0.4", - "wmf-sitematrix": "^0.1.5" + "svg-sprite": "2.0.4" }, "engines": { "node": ">=18.18" @@ -912,7 +912,6 @@ }, "node_modules/@mapbox/jsonlint-lines-primitives": { "version": "2.0.2", - "dev": true, "engines": { "node": ">= 0.6" } @@ -924,7 +923,6 @@ }, "node_modules/@mapbox/point-geometry": { "version": "0.1.0", - "dev": true, "license": "ISC" }, "node_modules/@mapbox/polylabel": { @@ -946,12 +944,10 @@ }, "node_modules/@mapbox/tiny-sdf": { "version": "2.0.6", - "dev": true, "license": "BSD-2-Clause" }, "node_modules/@mapbox/unitbezier": { "version": "0.0.1", - "dev": true, "license": "BSD-2-Clause" }, "node_modules/@mapbox/vector-tile": { @@ -969,7 +965,6 @@ }, "node_modules/@mapbox/whoots-js": { "version": "3.1.0", - "dev": true, "license": "ISC", "engines": { "node": ">=6.0.0" @@ -977,7 +972,6 @@ }, "node_modules/@maplibre/maplibre-gl-style-spec": { "version": "19.3.3", - "dev": true, "license": "ISC", "dependencies": { "@mapbox/jsonlint-lines-primitives": "~2.0.2", @@ -995,7 +989,6 @@ }, "node_modules/@maplibre/maplibre-gl-style-spec/node_modules/json-stringify-pretty-compact": { "version": "3.0.0", - "dev": true, "license": "MIT" }, "node_modules/@noble/ciphers": { @@ -1065,7 +1058,6 @@ }, "node_modules/@openstreetmap/id-tagging-schema": { "version": "6.6.0", - "dev": true, "license": "ISC" }, "node_modules/@pixi/accessibility": { @@ -1897,12 +1889,10 @@ }, "node_modules/@types/mapbox__point-geometry": { "version": "0.1.4", - "dev": true, "license": "MIT" }, "node_modules/@types/mapbox__vector-tile": { "version": "1.3.4", - "dev": true, "license": "MIT", "dependencies": { "@types/geojson": "*", @@ -1920,27 +1910,22 @@ }, "node_modules/@types/pako": { "version": "1.0.7", - "dev": true, "license": "MIT" }, "node_modules/@types/pbf": { "version": "3.0.5", - "dev": true, "license": "MIT" }, "node_modules/@types/polylabel": { "version": "1.1.3", - "dev": true, "license": "MIT" }, "node_modules/@types/rbush": { "version": "3.0.3", - "dev": true, "license": "MIT" }, "node_modules/@types/supercluster": { "version": "7.1.3", - "dev": true, "license": "MIT", "dependencies": { "@types/geojson": "*" @@ -1948,7 +1933,6 @@ }, "node_modules/@types/three": { "version": "0.134.0", - "dev": true, "license": "MIT" }, "node_modules/@types/triple-beam": { @@ -1958,7 +1942,6 @@ }, "node_modules/@types/virtual-dom": { "version": "2.1.4", - "dev": true, "license": "MIT" }, "node_modules/@xmldom/xmldom": { @@ -2097,7 +2080,6 @@ }, "node_modules/arr-union": { "version": "3.1.0", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -2137,7 +2119,6 @@ }, "node_modules/assign-symbols": { "version": "1.0.0", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -2313,7 +2294,6 @@ }, "node_modules/browser-split": { "version": "0.0.1", - "dev": true, "license": "MIT" }, "node_modules/browser-stdout": { @@ -2362,7 +2342,6 @@ }, "node_modules/bytewise": { "version": "1.1.0", - "dev": true, "license": "MIT", "dependencies": { "bytewise-core": "^1.2.2", @@ -2371,7 +2350,6 @@ }, "node_modules/bytewise-core": { "version": "1.2.3", - "dev": true, "license": "MIT", "dependencies": { "typewise-core": "^1.2" @@ -2458,7 +2436,6 @@ }, "node_modules/camelize": { "version": "1.0.1", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -3352,8 +3329,7 @@ } }, "node_modules/dom-walk": { - "version": "0.1.2", - "dev": true + "version": "0.1.2" }, "node_modules/domelementtype": { "version": "2.3.0", @@ -3428,8 +3404,7 @@ }, "node_modules/editor-layer-index": { "version": "0.0.0", - "resolved": "git+ssh://git@github.com/osmlab/editor-layer-index.git#d4ed06919374e1eaae862ff524ac92f283c7025d", - "dev": true + "resolved": "git+ssh://git@github.com/osmlab/editor-layer-index.git#d4ed06919374e1eaae862ff524ac92f283c7025d" }, "node_modules/ee-first": { "version": "1.1.1", @@ -3502,7 +3477,6 @@ }, "node_modules/error": { "version": "4.4.0", - "dev": true, "dependencies": { "camelize": "^1.0.0", "string-template": "~0.2.0", @@ -3974,7 +3948,6 @@ }, "node_modules/ev-store": { "version": "7.0.0", - "dev": true, "dependencies": { "individual": "^3.0.0" } @@ -4012,7 +3985,6 @@ }, "node_modules/extend-shallow": { "version": "2.0.1", - "dev": true, "license": "MIT", "dependencies": { "is-extendable": "^0.1.0" @@ -4412,7 +4384,6 @@ }, "node_modules/geojson-vt": { "version": "3.2.1", - "dev": true, "license": "ISC" }, "node_modules/get-caller-file": { @@ -4478,7 +4449,6 @@ }, "node_modules/get-value": { "version": "2.0.6", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -4486,7 +4456,6 @@ }, "node_modules/gl-matrix": { "version": "3.4.3", - "dev": true, "license": "MIT" }, "node_modules/glob": { @@ -4548,7 +4517,6 @@ }, "node_modules/global": { "version": "4.4.0", - "dev": true, "license": "MIT", "dependencies": { "min-document": "^2.19.0", @@ -4557,7 +4525,6 @@ }, "node_modules/global-prefix": { "version": "3.0.0", - "dev": true, "license": "MIT", "dependencies": { "ini": "^1.3.5", @@ -4570,7 +4537,6 @@ }, "node_modules/global-prefix/node_modules/which": { "version": "1.3.1", - "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -4991,7 +4957,6 @@ }, "node_modules/ieee754": { "version": "1.2.1", - "dev": true, "funding": [ { "type": "github", @@ -5051,8 +5016,7 @@ } }, "node_modules/individual": { - "version": "3.0.0", - "dev": true + "version": "3.0.0" }, "node_modules/inflight": { "version": "1.0.6", @@ -5070,7 +5034,6 @@ }, "node_modules/ini": { "version": "1.3.8", - "dev": true, "license": "ISC" }, "node_modules/internal-slot": { @@ -5208,7 +5171,6 @@ }, "node_modules/is-extendable": { "version": "0.1.1", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -5287,7 +5249,6 @@ }, "node_modules/is-object": { "version": "1.0.2", - "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -5311,7 +5272,6 @@ }, "node_modules/is-plain-object": { "version": "2.0.4", - "dev": true, "license": "MIT", "dependencies": { "isobject": "^3.0.1" @@ -5464,7 +5424,6 @@ }, "node_modules/isexe": { "version": "2.0.0", - "dev": true, "license": "ISC" }, "node_modules/ismobilejs": { @@ -5473,7 +5432,6 @@ }, "node_modules/isobject": { "version": "3.0.1", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -5976,7 +5934,6 @@ }, "node_modules/kdbush": { "version": "4.0.2", - "dev": true, "license": "ISC" }, "node_modules/keyv": { @@ -5989,7 +5946,6 @@ }, "node_modules/kind-of": { "version": "6.0.3", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -6277,7 +6233,6 @@ }, "node_modules/long": { "version": "3.2.0", - "dev": true, "license": "Apache-2.0", "engines": { "node": ">=0.6" @@ -6375,7 +6330,6 @@ }, "node_modules/mapillary-js": { "version": "4.1.2", - "dev": true, "license": "MIT", "dependencies": { "@types/earcut": "^2.1.1", @@ -6400,12 +6354,10 @@ }, "node_modules/mapillary-js/node_modules/@types/node": { "version": "14.18.63", - "dev": true, "license": "MIT" }, "node_modules/mapillary-js/node_modules/pbf": { "version": "3.3.0", - "dev": true, "license": "BSD-3-Clause", "dependencies": { "ieee754": "^1.1.12", @@ -6417,7 +6369,6 @@ }, "node_modules/mapillary-js/node_modules/rbush": { "version": "3.0.1", - "dev": true, "license": "MIT", "dependencies": { "quickselect": "^2.0.0" @@ -6425,7 +6376,6 @@ }, "node_modules/maplibre-gl": { "version": "3.6.2", - "dev": true, "license": "BSD-3-Clause", "dependencies": { "@mapbox/geojson-rewind": "^0.5.2", @@ -6464,7 +6414,6 @@ }, "node_modules/maplibre-gl/node_modules/@mapbox/vector-tile": { "version": "1.3.1", - "dev": true, "license": "BSD-3-Clause", "dependencies": { "@mapbox/point-geometry": "~0.1.0" @@ -6472,7 +6421,6 @@ }, "node_modules/maplibre-gl/node_modules/pbf": { "version": "3.3.0", - "dev": true, "license": "BSD-3-Clause", "dependencies": { "ieee754": "^1.1.12", @@ -6484,7 +6432,6 @@ }, "node_modules/maplibre-gl/node_modules/tinyqueue": { "version": "2.0.3", - "dev": true, "license": "ISC" }, "node_modules/marked": { @@ -6499,7 +6446,6 @@ }, "node_modules/martinez-polygon-clipping": { "version": "0.7.3", - "dev": true, "license": "MIT", "dependencies": { "robust-predicates": "^2.0.4", @@ -6509,7 +6455,6 @@ }, "node_modules/martinez-polygon-clipping/node_modules/robust-predicates": { "version": "2.0.4", - "dev": true, "license": "Unlicense" }, "node_modules/mdn-data": { @@ -6597,7 +6542,6 @@ }, "node_modules/min-document": { "version": "2.19.0", - "dev": true, "dependencies": { "dom-walk": "^0.1.0" } @@ -6795,7 +6739,6 @@ }, "node_modules/murmurhash-js": { "version": "1.0.0", - "dev": true, "license": "MIT" }, "node_modules/mustache": { @@ -6808,7 +6751,6 @@ }, "node_modules/name-suggestion-index": { "version": "6.0.20240909", - "dev": true, "license": "BSD-3-Clause", "dependencies": { "diacritics": "^1.3.0", @@ -6839,7 +6781,6 @@ }, "node_modules/next-tick": { "version": "0.2.2", - "dev": true, "license": "MIT" }, "node_modules/nice-try": { @@ -7245,7 +7186,6 @@ }, "node_modules/osm-community-index": { "version": "5.8.1", - "dev": true, "license": "ISC", "dependencies": { "diacritics": "^1.3.0" @@ -7289,12 +7229,10 @@ }, "node_modules/pako": { "version": "2.1.0", - "dev": true, "license": "(MIT AND Zlib)" }, "node_modules/pannellum": { "version": "2.5.6", - "dev": true, "license": "MIT" }, "node_modules/parent-module": { @@ -7608,7 +7546,6 @@ }, "node_modules/polylabel": { "version": "1.1.0", - "dev": true, "license": "ISC", "dependencies": { "tinyqueue": "^2.0.3" @@ -7616,7 +7553,6 @@ }, "node_modules/polylabel/node_modules/tinyqueue": { "version": "2.0.3", - "dev": true, "license": "ISC" }, "node_modules/postcss": { @@ -7777,7 +7713,6 @@ }, "node_modules/potpack": { "version": "2.0.0", - "dev": true, "license": "ISC" }, "node_modules/prelude-ls": { @@ -7794,7 +7729,6 @@ }, "node_modules/process": { "version": "0.11.10", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.6.0" @@ -7873,7 +7807,6 @@ }, "node_modules/quickselect": { "version": "2.0.0", - "dev": true, "license": "ISC" }, "node_modules/randombytes": { @@ -8317,7 +8250,6 @@ }, "node_modules/run-s": { "version": "0.0.0", - "dev": true, "license": "MIT" }, "node_modules/rw": { @@ -8326,7 +8258,6 @@ }, "node_modules/rxjs": { "version": "7.8.1", - "dev": true, "license": "Apache-2.0", "dependencies": { "tslib": "^2.1.0" @@ -8334,7 +8265,6 @@ }, "node_modules/s2-geometry": { "version": "1.2.10", - "dev": true, "license": "(MIT or Apache-2 or ISC)", "dependencies": { "long": "^3.2.0" @@ -8402,7 +8332,6 @@ }, "node_modules/set-value": { "version": "2.0.1", - "dev": true, "license": "MIT", "dependencies": { "extend-shallow": "^2.0.1", @@ -8591,7 +8520,6 @@ }, "node_modules/sort-asc": { "version": "0.2.0", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -8599,7 +8527,6 @@ }, "node_modules/sort-desc": { "version": "0.2.0", - "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -8607,7 +8534,6 @@ }, "node_modules/sort-object": { "version": "3.0.3", - "dev": true, "license": "MIT", "dependencies": { "bytewise": "^1.1.0", @@ -8675,7 +8601,6 @@ }, "node_modules/splaytree": { "version": "0.1.4", - "dev": true, "license": "MIT" }, "node_modules/splaytree-ts": { @@ -8684,7 +8609,6 @@ }, "node_modules/split-string": { "version": "3.1.0", - "dev": true, "license": "MIT", "dependencies": { "extend-shallow": "^3.0.0" @@ -8695,7 +8619,6 @@ }, "node_modules/split-string/node_modules/extend-shallow": { "version": "3.0.2", - "dev": true, "license": "MIT", "dependencies": { "assign-symbols": "^1.0.0", @@ -8707,7 +8630,6 @@ }, "node_modules/split-string/node_modules/is-extendable": { "version": "1.0.1", - "dev": true, "license": "MIT", "dependencies": { "is-plain-object": "^2.0.4" @@ -8872,8 +8794,7 @@ "license": "MIT" }, "node_modules/string-template": { - "version": "0.2.1", - "dev": true + "version": "0.2.1" }, "node_modules/string-width": { "version": "4.2.3", @@ -9010,7 +8931,6 @@ }, "node_modules/supercluster": { "version": "8.0.1", - "dev": true, "license": "ISC", "dependencies": { "kdbush": "^4.0.2" @@ -9206,7 +9126,6 @@ }, "node_modules/three": { "version": "0.134.0", - "dev": true, "license": "MIT" }, "node_modules/through2": { @@ -9302,7 +9221,6 @@ }, "node_modules/tslib": { "version": "2.6.3", - "dev": true, "license": "0BSD" }, "node_modules/type-check": { @@ -9351,7 +9269,6 @@ }, "node_modules/typewise": { "version": "1.0.3", - "dev": true, "license": "MIT", "dependencies": { "typewise-core": "^1.2.0" @@ -9359,7 +9276,6 @@ }, "node_modules/typewise-core": { "version": "1.2.0", - "dev": true, "license": "MIT" }, "node_modules/ua-parser-js": { @@ -9418,7 +9334,6 @@ }, "node_modules/union-value": { "version": "1.0.1", - "dev": true, "license": "MIT", "dependencies": { "arr-union": "^3.1.0", @@ -9575,7 +9490,6 @@ }, "node_modules/virtual-dom": { "version": "2.1.1", - "dev": true, "license": "MIT", "dependencies": { "browser-split": "0.0.1", @@ -9598,7 +9512,6 @@ }, "node_modules/vt-pbf": { "version": "3.1.3", - "dev": true, "license": "MIT", "dependencies": { "@mapbox/point-geometry": "0.1.0", @@ -9608,7 +9521,6 @@ }, "node_modules/vt-pbf/node_modules/@mapbox/vector-tile": { "version": "1.3.1", - "dev": true, "license": "BSD-3-Clause", "dependencies": { "@mapbox/point-geometry": "~0.1.0" @@ -9616,7 +9528,6 @@ }, "node_modules/vt-pbf/node_modules/pbf": { "version": "3.3.0", - "dev": true, "license": "BSD-3-Clause", "dependencies": { "ieee754": "^1.1.12", @@ -9817,7 +9728,6 @@ }, "node_modules/wmf-sitematrix": { "version": "0.1.5", - "dev": true, "license": "BSD" }, "node_modules/word-wrap": { @@ -9957,12 +9867,10 @@ } }, "node_modules/x-is-array": { - "version": "0.1.0", - "dev": true + "version": "0.1.0" }, "node_modules/x-is-string": { - "version": "0.1.0", - "dev": true + "version": "0.1.0" }, "node_modules/xpath": { "version": "0.0.34", @@ -9974,7 +9882,6 @@ }, "node_modules/xtend": { "version": "4.0.2", - "dev": true, "license": "MIT", "engines": { "node": ">=0.4" diff --git a/package.json b/package.json index 90e0bbbc3..fb2f2ecfd 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,7 @@ "type": "module", "main": "dist/rapid.min.js", "files": [ - "dist", - "!dist/data/modules" + "dist" ], "scripts": { "all": "run-s clean build dist", @@ -61,6 +60,7 @@ "@mapbox/polylabel": "1.0.2", "@mapbox/sexagesimal": "1.2.0", "@mapbox/vector-tile": "^2.0.3", + "@openstreetmap/id-tagging-schema": "~6.6.0", "@pixi/display": "7.4.0", "@pixi/events": "7.4.0", "@rapid-sdk/math": "~1.0.0-pre.3", @@ -73,12 +73,18 @@ "@tmcw/togeojson": "^5.8.1", "@types/chai": "^4.3.19", "d3": "~7.9.0", + "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages", "fast-deep-equal": "~3.1.3", "fast-json-stable-stringify": "2.1.0", "lodash-es": "~4.17.21", + "mapillary-js": "^4.1.2", + "maplibre-gl": "^3.6.2", "marked": "~14.1.2", + "name-suggestion-index": "~6.0.20240909", "node-diff3": "~3.1.2", "osm-auth": "2.5.0", + "osm-community-index": "~5.8.1", + "pannellum": "^2.5.6", "pbf": "^4.0.1", "pixi-filters": "5.3.0", "pixi.js": "7.4.0", @@ -87,7 +93,8 @@ "prop-types": "^15.8.1", "rbush": "4.0.1", "which-polygon": "2.2.1", - "wkt": "^0.1.1" + "wkt": "^0.1.1", + "wmf-sitematrix": "^0.1.5" }, "devDependencies": { "@dotenvx/dotenvx": "^1.14.0", @@ -96,7 +103,6 @@ "@fortawesome/free-regular-svg-icons": "^6.6.0", "@fortawesome/free-solid-svg-icons": "^6.6.0", "@mapbox/maki": "^8.0.1", - "@openstreetmap/id-tagging-schema": "~6.6.0", "@pixi/jsdoc-template": "^2.6.0", "@playwright/test": "^1.47.0", "@rapideditor/mapillary_sprite_source": "^1.8.0", @@ -111,7 +117,6 @@ "cldr-localenames-full": "45.0.0", "cloc": "^1.98.0-cloc", "concat-files": "^0.1.1", - "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages", "esbuild": "^0.23.1", "esbuild-visualizer": "^0.6.0", "eslint": "^9.10.0", @@ -130,21 +135,15 @@ "karma-mocha": "^2.0.1", "karma-mocha-reporter": "^2.2.5", "karma-remap-istanbul": "^0.6.0", - "mapillary-js": "^4.1.2", - "maplibre-gl": "^3.6.2", "mocha": "^10.7.3", - "name-suggestion-index": "~6.0.20240909", "npm-run-all": "^4.1.5", - "osm-community-index": "~5.8.1", - "pannellum": "^2.5.6", "postcss": "^8.4.45", "postcss-selector-prepend": "^0.5.0", "shelljs": "^0.8.5", "shx": "^0.3.4", "sinon": "^18.0.1", "static-server": "^3.0.0", - "svg-sprite": "2.0.4", - "wmf-sitematrix": "^0.1.5" + "svg-sprite": "2.0.4" }, "engines": { "node": ">=18.18" diff --git a/scripts/build_data.js b/scripts/build_data.js index 63f968610..5ec70d019 100644 --- a/scripts/build_data.js +++ b/scripts/build_data.js @@ -85,10 +85,10 @@ function buildDataAsync() { ]); // Create target folders if necessary - if (!fs.existsSync('data/l10n')) fs.mkdirSync('data/l10n', { recursive: true }); - if (!fs.existsSync('data/modules')) fs.mkdirSync('data/modules', { recursive: true }); - if (!fs.existsSync('dist/data/l10n')) fs.mkdirSync('dist/data/l10n', { recursive: true }); - if (!fs.existsSync('dist/data/modules')) fs.mkdirSync('dist/data/modules', { recursive: true }); + shell.mkdir('-p', [ + 'data/l10n', + 'dist/data/l10n' + ]); // Gather icons from various places that we need assembled into a spritesheet. // Start with icons we want to use in the UI that aren't tied to other data. @@ -118,20 +118,17 @@ function buildDataAsync() { const languages = { languages: sortObject(CLDR.langNamesInNativeLang()) }; fs.writeFileSync('data/languages.json', stringify(languages, { maxLength: 200 }) + '\n'); - copyModuleData(); writeEnJson(); // copy `data/` files to `dist/data/` and stamp with metadata - // (skip module data, it's already copied and we don't want to modify it anyway) - for (const sourceFile of globSync('data/**/*.json', { ignore: 'data/modules/**' })) { + for (const sourceFile of globSync('data/**/*.json')) { const destinationFile = sourceFile.replace('data/', 'dist/data/'); copyToDistSync(sourceFile, destinationFile); } - for (const file of globSync('dist/data/**/*.json', { ignore: 'dist/data/modules/**' })) { + for (const file of globSync('dist/data/**/*.json')) { minifySync(file); } - }) .then(() => { console.timeEnd(END); @@ -217,70 +214,6 @@ function gatherTerritoryLanguages() { } -// copyModuleData -// Copies the data from various modules. We distribute copies of these files -// for situations where Rapid can not fetch the latest files from the CDN. -function copyModuleData() { - try { - // id-tagging-schema - for (const file of ['deprecated', 'discarded', 'fields', 'preset_categories', 'preset_defaults', 'presets']) { - const source = `node_modules/@openstreetmap/id-tagging-schema/dist/${file}.min.json`; - const destination = `data/modules/id-tagging-schema/${file}.min.json`; - fs.cpSync(source, destination, { recursive: true }); - } - - // name-suggestion-index - for (const file of ['nsi', 'dissolved', 'featureCollection', 'genericWords', 'presets/nsi-id-presets', 'replacements', 'trees']) { - const source = `node_modules/name-suggestion-index/dist/${file}.min.json`; - const destination = `data/modules/name-suggestion-index/${file}.min.json`; - fs.cpSync(source, destination, { recursive: true }); - } - - // osm-community-index - for (const file of ['defaults', 'featureCollection', 'resources']) { - const source = `node_modules/osm-community-index/dist/${file}.min.json`; - const destination = `data/modules/osm-community-index/${file}.min.json`; - fs.cpSync(source, destination, { recursive: true }); - } - - // wmf-sitematrix - for (const file of ['wikipedia']) { - const source = `node_modules/wmf-sitematrix/${file}.min.json`; - const destination = `data/modules/wmf-sitematrix/${file}.min.json`; - fs.cpSync(source, destination, { recursive: true }); - } - - // mapillary-js - { - const source = 'node_modules/mapillary-js/dist'; - const destination = 'data/modules/mapillary-js'; - fs.cpSync(source, destination, { recursive: true }); - } - - // maplibre-gl - { - const source = 'node_modules/maplibre-gl/dist'; - const destination = 'data/modules/maplibre-gl'; - fs.cpSync(source, destination, { recursive: true }); - } - - // pannellum - { - const source = 'node_modules/pannellum/build'; - const destination = 'data/modules/pannellum'; - fs.cpSync(source, destination, { recursive: true }); - } - - // copy all of these to dist/data/modules also - fs.cpSync('data/modules', 'dist/data/modules', { recursive: true }); - - } catch (err) { - console.error(chalk.red(`Error - ${err.message}`)); - process.exit(1); - } -} - - // writeEnJson // This generates the English language localication files function writeEnJson() {