Skip to content
This repository has been archived by the owner on Jan 26, 2020. It is now read-only.

Commit

Permalink
added server defaults #58 and fixed upgraded pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
alidcast committed Jul 20, 2018
1 parent b0f3d67 commit 6285c13
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion packages/rogue-app/lib/server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ import appMiddleware from './appMiddleware'
type MiddlewareArgs = Function/*handler*/ | [string/*route*/, Function/*handler*/]
type Middlewares = Array<MiddlewareArgs>

const defaults = {
bundleUrl: 'bundle.js'
}

export default class App {
app: any
preMiddlewares: Middlewares
postMiddlewares: Middlewares
initialized: boolean

constructor (App: React.ComponentType<any>, { bundleUrl }) {
constructor (App: React.ComponentType<any>, { bundleUrl } = defaults) {
this.app = connect()
this.preMiddlewares = []
this.postMiddlewares = [appMiddleware(App, bundleUrl)]
Expand Down
2 changes: 1 addition & 1 deletion packages/rogue-app/lib/server/toHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function toHtml ({
</head>
<body ${helmet.bodyAttributes.toString()}>
<div id="${APP_ID}">${markup}</div>
<script src="${bundleUrl || 'bundle.js'}" defer></script>
<script src="${bundleUrl}" defer></script>
<script>window.${DATA_KEY} = ${serialize(data)};</script>
${(bodyTags || []).join('/n')}
</body>
Expand Down
2 changes: 1 addition & 1 deletion packages/rogue-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@roguejs/app",
"version": "0.6.10",
"version": "0.6.11",
"description": "A SSR experience for React that is quick and invisible",
"repository": "https://github.com/alidcastano/rogue/blob/master/packages/rogue-app",
"author": "Alid Castano",
Expand Down
2 changes: 1 addition & 1 deletion packages/rogue-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@roguejs/cli",
"version": "0.6.0",
"version": "0.6.11",
"repository": "https://github.com/alidcastano/rogue/tree/master/packages/rogue-cli",
"author": "Alid Castano",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/rogue-hocs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@roguejs/hocs",
"version": "0.6.8",
"version": "0.6.11",
"repository": "https://github.com/alidcastano/rogue/tree/master/packages/rogue-hocs",
"author": "Alid Castano",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/rogue-hocs/styled-components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const withStyles = (theme = {}) => App => {

RogueStyledProvider.getInitialProps = async function (ctx) {
const sheet = new ServerStyleSheet()
sheet.collectStyles(ctx.app.Component)
sheet.collectStyles(ctx.app.routable(App))
ctx.app.headTags.push(sheet.getStyleTags())

let props = {}
Expand Down

0 comments on commit 6285c13

Please sign in to comment.