mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-18 09:06:11 +00:00
more changes to build scripts
- drop `build_src.js` and `build.js` - now we'll use rollup configs for all src building - add `npm run build:css` and `npm run build:data` - watcher now only watches for css file changes - src and data rebuilds are too slow to reasonably do "live" - fix `build_css.js` and `build_data.js` to either exec or export
This commit is contained in:
51
server.js
51
server.js
@@ -3,49 +3,14 @@ const colors = require('colors/safe');
|
||||
const gaze = require('gaze');
|
||||
const StaticServer = require('static-server');
|
||||
|
||||
const buildAll = require('./build');
|
||||
const buildData = require('./build_data');
|
||||
const buildSrc = require('./build_src');
|
||||
const buildCSS = require('./build_css');
|
||||
|
||||
const CSSFILES = ['css/**/*.css'];
|
||||
const SRCFILES = ['modules/**/*.js'];
|
||||
const DATAFILES = [
|
||||
'data/**/*.{js,json}',
|
||||
'data/core.yaml',
|
||||
// ignore the output files of `buildData`
|
||||
'!data/presets/categories.json',
|
||||
'!data/presets/fields.json',
|
||||
'!data/presets/presets.json',
|
||||
'!data/presets.yaml',
|
||||
'!data/taginfo.json',
|
||||
'!data/territory-languages.json',
|
||||
'!dist/locales/en.json'
|
||||
];
|
||||
const buildCSS = require('./build_css.js');
|
||||
|
||||
|
||||
buildAll()
|
||||
.then(() => startServer());
|
||||
gaze(['css/**/*.css'], (err, watcher) => {
|
||||
watcher.on('all', () => buildCSS());
|
||||
});
|
||||
|
||||
|
||||
function startServer() {
|
||||
gaze(CSSFILES, (err, watcher) => {
|
||||
watcher.on('all', () => buildCSS());
|
||||
});
|
||||
|
||||
gaze(DATAFILES, (err, watcher) => {
|
||||
watcher.on('all', () => {
|
||||
buildData()
|
||||
.then(() => buildSrc());
|
||||
});
|
||||
});
|
||||
|
||||
gaze(SRCFILES, (err, watcher) => {
|
||||
watcher.on('all', () => buildSrc());
|
||||
});
|
||||
|
||||
const server = new StaticServer({ rootPath: __dirname, port: 8080, followSymlink: true });
|
||||
server.start(() => {
|
||||
console.log(colors.yellow('Listening on ' + server.port));
|
||||
});
|
||||
}
|
||||
const server = new StaticServer({ rootPath: __dirname, port: 8080, followSymlink: true });
|
||||
server.start(() => {
|
||||
console.log(colors.yellow('Listening on ' + server.port));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user