forked from MapComplete/MapComplete
Merge pull request #622 from RayBB/replace-wget
replace wget with download script
This commit is contained in:
commit
7bc01b783b
3 changed files with 14 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
"watch:translations": "cd langs && ls | entr npm run generate:translations",
|
||||
|
|
12
scripts/downloadFile.ts
Normal file
12
scripts/downloadFile.ts
Normal file
|
@ -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));
|
Loading…
Reference in a new issue