|
@@ -1,4 +1,5 @@
|
|
|
const debug = require('debug')('crowi:crowi:dev');
|
|
const debug = require('debug')('crowi:crowi:dev');
|
|
|
|
|
+const fs = require('fs');
|
|
|
const path = require('path');
|
|
const path = require('path');
|
|
|
const webpack = require('webpack');
|
|
const webpack = require('webpack');
|
|
|
const helpers = require('./helpers');
|
|
const helpers = require('./helpers');
|
|
@@ -20,6 +21,8 @@ class CrowiDev {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
init() {
|
|
init() {
|
|
|
|
|
+ this.requireForLiveReload();
|
|
|
|
|
+
|
|
|
this.initPromiseRejectionWarningHandler();
|
|
this.initPromiseRejectionWarningHandler();
|
|
|
this.initSwig();
|
|
this.initSwig();
|
|
|
this.hackLRWebSocketServer();
|
|
this.hackLRWebSocketServer();
|
|
@@ -34,6 +37,19 @@ class CrowiDev {
|
|
|
swig.setDefaults({ cache: false });
|
|
swig.setDefaults({ cache: false });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * require files for live reloading
|
|
|
|
|
+ */
|
|
|
|
|
+ requireForLiveReload() {
|
|
|
|
|
+ // environment file
|
|
|
|
|
+ require(path.join(this.crowi.rootDir, 'config', 'env.dev.js'));
|
|
|
|
|
+
|
|
|
|
|
+ // load all json files for live reloading
|
|
|
|
|
+ fs.readdirSync(this.crowi.localeDir).map((dirname) => {
|
|
|
|
|
+ require(path.join(this.crowi.localeDir, dirname, 'translation.json'));
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* prevent to crash socket with:
|
|
* prevent to crash socket with:
|
|
|
* -------------------------------------------------
|
|
* -------------------------------------------------
|