mirror of
https://github.com/maptiler/tileserver-gl.git
synced 2024-09-17 14:57:29 +03:00
Use chokidar instead of node-watch to poll the files (required for docker)
This commit is contained in:
parent
aa933e5154
commit
ea89d11021
@ -1,6 +1,8 @@
|
||||
FROM node:10-stretch
|
||||
|
||||
ENV NODE_ENV="production"
|
||||
ENV CHOKIDAR_USEPOLLING=1
|
||||
ENV CHOKIDAR_INTERVAL=500
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
EXPOSE 80
|
||||
|
@ -1,6 +1,8 @@
|
||||
FROM node:10-stretch
|
||||
|
||||
ENV NODE_ENV="production"
|
||||
ENV CHOKIDAR_USEPOLLING=1
|
||||
ENV CHOKIDAR_INTERVAL=500
|
||||
EXPOSE 80
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
|
@ -24,6 +24,7 @@
|
||||
"@mapbox/vector-tile": "1.3.1",
|
||||
"advanced-pool": "0.3.3",
|
||||
"canvas": "2.6.1",
|
||||
"chokidar": "3.3.1",
|
||||
"clone": "2.1.2",
|
||||
"color": "3.1.2",
|
||||
"commander": "4.0.1",
|
||||
@ -34,7 +35,6 @@
|
||||
"handlebars": "4.5.3",
|
||||
"http-shutdown": "1.2.1",
|
||||
"morgan": "1.9.1",
|
||||
"node-watch": "0.6.3",
|
||||
"pbf": "3.2.1",
|
||||
"proj4": "2.6.0",
|
||||
"request": "2.88.0",
|
||||
|
@ -7,6 +7,7 @@ process.env.UV_THREADPOOL_SIZE =
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const chokidar = require('chokidar');
|
||||
const clone = require('clone');
|
||||
const cors = require('cors');
|
||||
const enableShutdown = require('http-shutdown');
|
||||
@ -14,7 +15,6 @@ const express = require('express');
|
||||
const handlebars = require('handlebars');
|
||||
const mercator = new (require('@mapbox/sphericalmercator'))();
|
||||
const morgan = require('morgan');
|
||||
const watch = require('node-watch');
|
||||
|
||||
const packageJson = require('../package');
|
||||
const serve_font = require('./serve_font');
|
||||
@ -217,20 +217,24 @@ function start(opts) {
|
||||
}
|
||||
});
|
||||
|
||||
watch(options.paths.styles,
|
||||
{ persistent: false, filter: /\.json$/ },
|
||||
const watcher = chokidar.watch(path.join(options.paths.styles, '*.json'),
|
||||
{
|
||||
});
|
||||
watcher.on('all',
|
||||
(eventType, filename) => {
|
||||
let id = path.basename(filename, '.json');
|
||||
console.log(`Style "${id}" changed, updating...`);
|
||||
if (filename) {
|
||||
let id = path.basename(filename, '.json');
|
||||
console.log(`Style "${id}" changed, updating...`);
|
||||
|
||||
serve_style.remove(serving.styles, id);
|
||||
serve_rendered.remove(serving.rendered, id);
|
||||
serve_style.remove(serving.styles, id);
|
||||
serve_rendered.remove(serving.rendered, id);
|
||||
|
||||
if (eventType == "update") {
|
||||
let item = {
|
||||
style: filename
|
||||
};
|
||||
addStyle(id, item, false, false);
|
||||
if (eventType == "add" || eventType == "change") {
|
||||
let item = {
|
||||
style: filename
|
||||
};
|
||||
addStyle(id, item, false, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user