Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add compileOnStartup Option #869

Merged
merged 9 commits into from
Mar 8, 2017

Conversation

drewpc
Copy link
Collaborator

@drewpc drewpc commented Feb 5, 2017

Addresses #868. Tests and documentation have been updated as well. Also, fixes #801 by removing references to the old compileOnly option from source code and documentation. Lastly, fixes a minor issue with the Promise chain within the cli script.

…ensure the server uses that code without recompiling it each time the server starts.
…ause it mocks the compile.run function so that it applies more uniformly to each of the JS servers. Also, fixed an issue where the run command wasn't returning a promise when starting the server, instead it was returning an object with the started promise inside it.
…Add initial documentation for compileOnStartup option.
@drewpc drewpc added the enhancement New functionality. label Feb 5, 2017
@drewpc drewpc added this to the 0.6.1 milestone Feb 5, 2017
Copy link
Member

@roblg roblg left a comment

Choose a reason for hiding this comment

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

LGTM. Short, sweet, and to the point.

cb(null, null);
};
} else {
({serverRoutes, compiler} = compileClient(options));
Copy link
Member

Choose a reason for hiding this comment

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

nit: I find the parentheses around this expression make it harder to parse visually.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Me too. Here's the issue I have: I defined serverRoutes and compiler previously using let. ES6 destructuring only works like this:

let {a, b} = stuff;
const {c, d} = stuff;
let e, f;
({e, f} = stuff);

This is a syntax error: {a, b} = stuff;. I could put a comment above that line so that it's clear?

Copy link
Contributor

Choose a reason for hiding this comment

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

Huh, TIL.

@@ -157,7 +157,8 @@ export default (server, reactServerMiddleware) => {
server.use(compression());
server.use(bodyParser.urlencoded({ extended: false }));
server.use(bodyParser.json());
server.use(session(options));
server.use(helmet());
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this adding helmet here now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I read through the documentation to update it with compileOnStartup stuff and noticed that the custom express middleware example wasn't updated previously. I can remove it if it's an issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, somehow I thought we were adding it automatically now. Makes sense. 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

well...we are because of #812, but we missed updating this example to depict the new default express middleware.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see, and users are responsible for adding it themselves if they override the default with custom middleware.

Nice catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove compileOnly option
3 participants