Switch scripts to module because of node-fetch v3
This commit is contained in:
parent
58c657e38a
commit
9c59fa10b6
4 changed files with 17 additions and 11 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
layers/josm/extract.js
|
layers/josm/extract.mjs
|
||||||
layers/collection/extract.js
|
layers/collection/extract.mjs
|
||||||
gulpfile.js
|
gulpfile.js
|
||||||
dist/brouter-web.js
|
dist/brouter-web.js
|
||||||
dist/turf.min.js
|
dist/turf.min.js
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const fs = require('fs');
|
import vm from 'vm';
|
||||||
const path = require('path');
|
|
||||||
const fetch = require('node-fetch');
|
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
const outDir = __dirname;
|
const outDir = __dirname;
|
||||||
|
|
||||||
var includeList = [
|
var includeList = [
|
||||||
|
|
@ -18,7 +22,7 @@ var includeList = [
|
||||||
];
|
];
|
||||||
|
|
||||||
function extract(constantsJs) {
|
function extract(constantsJs) {
|
||||||
eval(constantsJs);
|
const getLayerDataByID = vm.runInNewContext(constantsJs + '; getLayerDataByID');
|
||||||
|
|
||||||
for (let i = 0; i < includeList.length; i++) {
|
for (let i = 0; i < includeList.length; i++) {
|
||||||
let id = includeList[i];
|
let id = includeList[i];
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import fetch from 'node-fetch';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
const fs = require('fs');
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const path = require('path');
|
const __dirname = path.dirname(__filename);
|
||||||
const fetch = require('node-fetch');
|
|
||||||
|
|
||||||
const outDir = __dirname;
|
const outDir = __dirname;
|
||||||
|
|
||||||
const includeList = [
|
const includeList = [
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "gulp",
|
"build": "gulp",
|
||||||
"transifex-push": "gulp i18next && tx push --source",
|
"transifex-push": "gulp i18next && tx push --source",
|
||||||
"transifex-pull": "tx pull --all --minimum-perc 1 --force && (git add locales/*.json && git commit locales/*.json -m 'Update translations' || true)",
|
"transifex-pull": "tx pull --all --minimum-perc 1 --force && (git add locales/*.json && git commit locales/*.json -m 'Update translations' || true)",
|
||||||
"layers": "node layers/josm/extract.js && node layers/collection/extract.js",
|
"layers": "node layers/josm/extract.mjs && node layers/collection/extract.mjs",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"prettier": "prettier --write '**/*'",
|
"prettier": "prettier --write '**/*'",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue