|
@@ -18,17 +18,17 @@ function Crowi (rootdir, env)
|
|
|
|
|
|
|
|
this.version = pkg.version;
|
|
this.version = pkg.version;
|
|
|
|
|
|
|
|
- this.rootDir = rootdir;
|
|
|
|
|
- this.pluginDir = path.join(this.rootDir, 'node_modules') + sep;
|
|
|
|
|
- this.publicDir = path.join(this.rootDir, 'public') + sep;
|
|
|
|
|
- this.libDir = path.join(this.rootDir, 'lib') + sep;
|
|
|
|
|
- this.eventsDir = path.join(this.libDir, 'events') + sep;
|
|
|
|
|
- this.localeDir = path.join(this.rootDir, 'locales') + sep;
|
|
|
|
|
|
|
+ this.rootDir = rootdir;
|
|
|
|
|
+ this.pluginDir = path.join(this.rootDir, 'node_modules') + sep;
|
|
|
|
|
+ this.publicDir = path.join(this.rootDir, 'public') + sep;
|
|
|
|
|
+ this.libDir = path.join(this.rootDir, 'lib') + sep;
|
|
|
|
|
+ this.eventsDir = path.join(this.libDir, 'events') + sep;
|
|
|
|
|
+ this.localeDir = path.join(this.rootDir, 'locales') + sep;
|
|
|
this.resourceDir = path.join(this.rootDir, 'resource') + sep;
|
|
this.resourceDir = path.join(this.rootDir, 'resource') + sep;
|
|
|
- this.viewsDir = path.join(this.libDir, 'views') + sep;
|
|
|
|
|
- this.mailDir = path.join(this.viewsDir, 'mail') + sep;
|
|
|
|
|
- this.tmpDir = path.join(this.rootDir, 'tmp') + sep;
|
|
|
|
|
- this.cacheDir = path.join(this.tmpDir, 'cache');
|
|
|
|
|
|
|
+ this.viewsDir = path.join(this.libDir, 'views') + sep;
|
|
|
|
|
+ this.mailDir = path.join(this.viewsDir, 'mail') + sep;
|
|
|
|
|
+ this.tmpDir = path.join(this.rootDir, 'tmp') + sep;
|
|
|
|
|
+ this.cacheDir = path.join(this.tmpDir, 'cache');
|
|
|
|
|
|
|
|
this.config = {};
|
|
this.config = {};
|
|
|
this.searcher = null;
|
|
this.searcher = null;
|
|
@@ -287,8 +287,6 @@ Crowi.prototype.getTokens = function() {
|
|
|
Crowi.prototype.start = function() {
|
|
Crowi.prototype.start = function() {
|
|
|
var self = this
|
|
var self = this
|
|
|
, http = require('http')
|
|
, http = require('http')
|
|
|
- , reload = require('reload')
|
|
|
|
|
- , chokidar = require('chokidar')
|
|
|
|
|
, server
|
|
, server
|
|
|
, io;
|
|
, io;
|
|
|
|
|
|
|
@@ -298,17 +296,11 @@ Crowi.prototype.start = function() {
|
|
|
console.log(`[${self.node_env}] Express server listening on port ${self.port}`);
|
|
console.log(`[${self.node_env}] Express server listening on port ${self.port}`);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // reload settings
|
|
|
|
|
- // see: https://github.com/jprichardson/reload
|
|
|
|
|
|
|
+ // setup Live Reload Tools
|
|
|
if (self.node_env === 'development') {
|
|
if (self.node_env === 'development') {
|
|
|
- const reloadServer = reload(server, app);
|
|
|
|
|
- // fire reload() when html is modified
|
|
|
|
|
- const watcher = chokidar.watch(path.join(self.libDir, 'views'));
|
|
|
|
|
- watcher.on('all', (event, path) => {
|
|
|
|
|
- reloadServer.reload();
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- debug(`watching for live-reloading -> ${self.libDir}`);
|
|
|
|
|
|
|
+ const CrowiDev = require('./dev');
|
|
|
|
|
+ const crowiDev = new CrowiDev(self, server, app);
|
|
|
|
|
+ crowiDev.setupLiveReloadTools();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
io = require('socket.io')(server);
|
|
io = require('socket.io')(server);
|