Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Flex all the things #21

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ Next, lets configure the development server. To keep things simple we can put th
var hypernova = require('hypernova/server');

hypernova({
devMode: true,

getComponent(name) {
if (name === 'MyComponent.js') {
return require('./app/assets/javascripts/MyComponent.js');
Expand Down Expand Up @@ -207,8 +205,8 @@ Options, and their defaults
bodyParser: {
limit: 1024 * 1000,
},
// disables cluster mode and reloads each component every time it is requested
devMode: false,
// disables cluster mode
enableCluster: false,
// how components will be retrieved,
getComponent: undefined,
// configure the logger
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/hypernova.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const hypernova = require('hypernova/server');

hypernova({
devMode: true,
enableCluster: false, // default
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can omit this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.


getComponent(name) {
if (name === 'MyComponent.js') {
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd really prefer not to run tests before every commit - that will slow down rebasing. can we make this pre-update, or, perhaps add it in a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular module only runs as pre-commit - http://npmjs.com/pre-commit
I can split it, although rebase doesn't run pre-commit hooks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we don't really need this, tests are run as part of CI here on github so we should be fine without it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove it if you think it makes things worst,
it's just I myself committed broken code at first :)
I think it would help to reduce number of broken PRs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken PRs are just a rebase away from being working PRs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll kill the thing. :)

My intention was to automate things, to reduce human workload. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's no more.

],
"repository": {
"type": "git",
"url": "[email protected]:airbnb/hypernova.git"
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const defaultConfig = {
bodyParser: {
limit: 1024 * 1000,
},
devMode: false,
endpoint: '/batch',
enableCluster: false,
files: [],
logger: {},
plugins: [],
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/server-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ describe('Hypernova server', () => {
});

it('starts up the hypernova server without blowing up', () => {
hypernova({ devMode: true, getComponent: () => {} });
hypernova({ getComponent: () => {} });
});
});