diff --git a/Docs/Development_deployment.md b/Docs/Development_deployment.md index 30e14a4528..4dea0b8809 100644 --- a/Docs/Development_deployment.md +++ b/Docs/Development_deployment.md @@ -33,7 +33,6 @@ To develop and build MapComplete, you - You can [use asdf to manage your runtime versions](https://asdf-vm.com/). 0. Install `npm`. Linux: `sudo apt install npm` (or your favourite package manager), Windows: install nodeJS: https://nodejs.org/en/download/ -0. On iOS, install `wget` (`brew install wget`) 0. Run `npm run init` which … - runs `npm install` - generates some additional dependencies and files diff --git a/package.json b/package.json index fc157041a3..5c3fdd85f4 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,8 @@ "init": "npm ci && npm run generate && npm run generate:editor-layer-index && npm run generate:layouts && npm run clean", "add-weblate-upstream": "git remote add weblate-layers https://hosted.weblate.org/git/mapcomplete/layer-translations/ ; git remote update weblate-layers", "fix-weblate": "git remote update weblate-layers; git merge weblate-layers/master", - "generate:editor-layer-index": "cd assets/ && wget https://osmlab.github.io/editor-layer-index/imagery.geojson --output-document=editor-layer-index.json", - "generate:polygon-features": "cd assets/ && wget https://raw.githubusercontent.com/tyrasd/osm-polygon-features/master/polygon-features.json --output-document=polygon-features.json", + "generate:editor-layer-index": "ts-node scripts/downloadFile.ts https://osmlab.github.io/editor-layer-index/imagery.geojson assets/editor-layer-index.json", + "generate:polygon-features": "ts-node scripts/downloadFile.ts https://raw.githubusercontent.com/tyrasd/osm-polygon-features/master/polygon-features.json assets/polygon-features.json", "generate:images": "ts-node scripts/generateIncludedImages.ts", "generate:translations": "ts-node scripts/generateTranslations.ts", "reset:translations": "ts-node scripts/generateTranslations.ts --ignore-weblate", diff --git a/scripts/downloadFile.ts b/scripts/downloadFile.ts new file mode 100644 index 0000000000..6e191919fe --- /dev/null +++ b/scripts/downloadFile.ts @@ -0,0 +1,12 @@ +const http = require('https'); +const fs = require('fs'); + +// Could use yargs to have more validation but wanted to keep it simple +const args = process.argv.slice(2); +const FILE_URL = args[0]; +const DESTINATION = args[1]; + +console.log(`Downloading ${FILE_URL} to ${DESTINATION}`) + +const file = fs.createWriteStream(DESTINATION); +http.get(FILE_URL, response=>response.pipe(file));