diff --git a/packages/strapi-plugin-settings-manager/package.json b/packages/strapi-plugin-settings-manager/package.json index 57106028b7..e4864dab45 100644 --- a/packages/strapi-plugin-settings-manager/package.json +++ b/packages/strapi-plugin-settings-manager/package.json @@ -48,7 +48,7 @@ "plop": "^1.5.0", "prettier": "^1.5.3", "rimraf": "^2.5.4", - "strapi-helper-plugin": "file:../strapi-helper-plugin", + "strapi-helper-plugin": "3.0.0-alpha.5.5", "webpack": "^2.1.0-beta.25" }, "author": { @@ -68,4 +68,4 @@ "npm": ">= 3.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-utils/package.json b/packages/strapi-utils/package.json index 32ce37facc..207856befb 100644 --- a/packages/strapi-utils/package.json +++ b/packages/strapi-utils/package.json @@ -45,4 +45,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi/bin/strapi-start.js b/packages/strapi/bin/strapi-start.js index 49159394ea..66bf899252 100644 --- a/packages/strapi/bin/strapi-start.js +++ b/packages/strapi/bin/strapi-start.js @@ -74,21 +74,22 @@ module.exports = function() { if (cluster.isMaster) { cluster.on('message', (worker, message) => { - if (message !== 'reload') return; + switch (message) { + case 'reload': + strapi.log.info('The server is restarting\n'); - strapi.log.info('The server is restarting\n'); + _.forEach(cluster.workers, worker => worker.kill()); - _.forEach(cluster.workers, worker => worker.kill()); + cluster.fork(); + break; + case 'stop': + _.forEach(cluster.workers, worker => worker.kill()); - cluster.fork(); - }); - - cluster.on('message', (worker, message) => { - if (message !== 'stop') return; - - _.forEach(cluster.workers, worker => worker.kill()); - - process.exit(0); + process.exit(0);ter.fork(); + break; + default: + return; + } }); cluster.fork(); diff --git a/packages/strapi/lib/Strapi.js b/packages/strapi/lib/Strapi.js index 9f07725def..e21229fd6c 100644 --- a/packages/strapi/lib/Strapi.js +++ b/packages/strapi/lib/Strapi.js @@ -6,7 +6,7 @@ const utils = require('./utils'); const http = require('http'); const path = require('path'); const cluster = require('cluster'); -const { includes } = require('lodash'); +const { includes, get } = require('lodash'); const { logger } = require('strapi-utils'); const { nestedConfigurations, appConfigurations, apis, middlewares, hooks } = require('./core'); const initializeMiddlewares = require('./middlewares'); @@ -138,7 +138,7 @@ class Strapi extends EventEmitter { // Destroy server and available connections. this.server.destroy(); - if (cluster.isWorker && process.env.NODE_ENV === 'development' && this.config.currentEnvironment.server.autoReload === true) process.send('stop'); + if (cluster.isWorker && process.env.NODE_ENV === 'development' && get(this.config, 'currentEnvironment.server.autoReload') === true) process.send('stop'); // Kill process. process.exit(0); @@ -173,7 +173,7 @@ class Strapi extends EventEmitter { reload() { const reload = function() { - if (cluster.isWorker && process.env.NODE_ENV === 'development' && this.config.currentEnvironment.server.autoReload === true) process.send('reload'); + if (cluster.isWorker && process.env.NODE_ENV === 'development' && get(this.config, 'currentEnvironment.server.autoReload') === true) process.send('reload'); }; reload.isReloading = false; diff --git a/packages/strapi/lib/reload.js b/packages/strapi/lib/reload.js index 646624d5ab..85c9e57d98 100644 --- a/packages/strapi/lib/reload.js +++ b/packages/strapi/lib/reload.js @@ -20,7 +20,7 @@ module.exports = function reload() { try { const reload = function() { - if (cluster.isWorker && process.env.NODE_ENV === 'development' && this.config.environments[this.config.environment].server.reload === true) process.send('reload'); + if (cluster.isWorker && process.env.NODE_ENV === 'development' && get(this.config, 'currentEnvironment.server.autoReload') === true) process.send('reload'); }; reload.isReloading = false;