From 311296a23b6170637a3f30496a6c3bc9ffb80754 Mon Sep 17 00:00:00 2001 From: Alex Indigo Date: Fri, 24 Jun 2016 14:21:56 -0700 Subject: [PATCH 1/5] Renamed `devMode` to `clustering` to reduce confusion and make it less opionated. --- README.md | 4 ++-- examples/simple/hypernova.js | 2 +- src/server.js | 8 ++++---- test/server-test.js | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c0a72eb..074f80e 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Next, lets configure the development server. To keep things simple we can put th var hypernova = require('hypernova/server'); hypernova({ - devMode: true, + clustering: false, getComponent(name) { if (name === 'MyComponent.js') { @@ -208,7 +208,7 @@ Options, and their defaults limit: 1024 * 1000, }, // disables cluster mode and reloads each component every time it is requested - devMode: false, + clustering: true, // how components will be retrieved, getComponent: undefined, // configure the logger diff --git a/examples/simple/hypernova.js b/examples/simple/hypernova.js index 525481a..1e2e2bf 100644 --- a/examples/simple/hypernova.js +++ b/examples/simple/hypernova.js @@ -1,7 +1,7 @@ const hypernova = require('hypernova/server'); hypernova({ - devMode: true, + clustering: false, getComponent(name) { if (name === 'MyComponent.js') { diff --git a/src/server.js b/src/server.js index 5fac449..8ebc6cf 100644 --- a/src/server.js +++ b/src/server.js @@ -15,8 +15,8 @@ const defaultConfig = { bodyParser: { limit: 1024 * 1000, }, - devMode: false, endpoint: '/batch', + enableCluster: false, files: [], logger: {}, plugins: [], @@ -34,14 +34,14 @@ export default function hypernova(userConfig, onServer) { const app = express(); - if (config.devMode) { - worker(app, config, onServer); - } else { + if (config.enableCluster) { if (cluster.isMaster) { coordinator(); } else { worker(app, config, onServer, cluster.worker.id); } + } else { + worker(app, config, onServer); } return app; diff --git a/test/server-test.js b/test/server-test.js index f267025..2313f47 100644 --- a/test/server-test.js +++ b/test/server-test.js @@ -7,6 +7,6 @@ describe('Hypernova server', () => { }); it('starts up the hypernova server without blowing up', () => { - hypernova({ devMode: true, getComponent: () => {} }); + hypernova({ clustering: false, getComponent: () => {} }); }); }); From bf0766660475fd047e65092c3a0b4e0ae80627d9 Mon Sep 17 00:00:00 2001 From: Alex Indigo Date: Mon, 27 Jun 2016 21:46:29 -0700 Subject: [PATCH 2/5] Cleaned up things. Added pre-commit --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index 1c01a1f..b83df73 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "cover:check": "istanbul check-coverage && echo code coverage thresholds met, achievement unlocked!", "test:quick": "babel-node node_modules/.bin/_mocha -R tap test/init.js test/*-test.js" }, + "pre-commit": [ + "test" + ], "repository": { "type": "git", "url": "git@github.com:airbnb/hypernova.git" @@ -63,6 +66,7 @@ "istanbul": "^1.0.0-alpha.2", "mocha": "^2.5.3", "mocha-wrap": "^2.0.4", + "pre-commit": "^1.1.3", "rimraf": "^2.5.2", "sinon": "^1.17.4", "sinon-sandbox": "^1.0.2" From e45a76ccb62e2282dace3434f87a55bd54d7708f Mon Sep 17 00:00:00 2001 From: Alex Indigo Date: Tue, 19 Jul 2016 00:30:32 -0700 Subject: [PATCH 3/5] Cleaned up examples --- README.md | 6 ++---- examples/simple/hypernova.js | 2 +- test/server-test.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 074f80e..61e2bc5 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,6 @@ Next, lets configure the development server. To keep things simple we can put th var hypernova = require('hypernova/server'); hypernova({ - clustering: false, - getComponent(name) { if (name === 'MyComponent.js') { return require('./app/assets/javascripts/MyComponent.js'); @@ -207,8 +205,8 @@ Options, and their defaults bodyParser: { limit: 1024 * 1000, }, - // disables cluster mode and reloads each component every time it is requested - clustering: true, + // disables cluster mode + enableCluster: false, // how components will be retrieved, getComponent: undefined, // configure the logger diff --git a/examples/simple/hypernova.js b/examples/simple/hypernova.js index 1e2e2bf..31e97af 100644 --- a/examples/simple/hypernova.js +++ b/examples/simple/hypernova.js @@ -1,7 +1,7 @@ const hypernova = require('hypernova/server'); hypernova({ - clustering: false, + enableCluster: false, // default getComponent(name) { if (name === 'MyComponent.js') { diff --git a/test/server-test.js b/test/server-test.js index 2313f47..4b5fd8f 100644 --- a/test/server-test.js +++ b/test/server-test.js @@ -7,6 +7,6 @@ describe('Hypernova server', () => { }); it('starts up the hypernova server without blowing up', () => { - hypernova({ clustering: false, getComponent: () => {} }); + hypernova({ getComponent: () => {} }); }); }); From 063d3532e2914b248c30cd49e6ba663cb91b5b75 Mon Sep 17 00:00:00 2001 From: Alex Indigo Date: Tue, 19 Jul 2016 18:27:34 -0700 Subject: [PATCH 4/5] Removed default property from the example. --- examples/simple/hypernova.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/simple/hypernova.js b/examples/simple/hypernova.js index 31e97af..dcf0fc6 100644 --- a/examples/simple/hypernova.js +++ b/examples/simple/hypernova.js @@ -1,8 +1,6 @@ const hypernova = require('hypernova/server'); hypernova({ - enableCluster: false, // default - getComponent(name) { if (name === 'MyComponent.js') { return require('./app/assets/javascripts/MyComponent.js'); From 5f078fc6b8c4679dd58cfa8bd4ac0475a6644909 Mon Sep 17 00:00:00 2001 From: Alex Indigo Date: Tue, 19 Jul 2016 23:53:55 -0700 Subject: [PATCH 5/5] Removed pre-commit --- package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package.json b/package.json index b83df73..1c01a1f 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,6 @@ "cover:check": "istanbul check-coverage && echo code coverage thresholds met, achievement unlocked!", "test:quick": "babel-node node_modules/.bin/_mocha -R tap test/init.js test/*-test.js" }, - "pre-commit": [ - "test" - ], "repository": { "type": "git", "url": "git@github.com:airbnb/hypernova.git" @@ -66,7 +63,6 @@ "istanbul": "^1.0.0-alpha.2", "mocha": "^2.5.3", "mocha-wrap": "^2.0.4", - "pre-commit": "^1.1.3", "rimraf": "^2.5.2", "sinon": "^1.17.4", "sinon-sandbox": "^1.0.2"