Skip to content

Commit

Permalink
chore: syncing master to canary
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinkl committed Apr 6, 2019
2 parents b9a1dbd + a94e677 commit cfe251b
Show file tree
Hide file tree
Showing 23 changed files with 191 additions and 145 deletions.
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
example
*.json
*.yml
*.md
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.1.2-canary.0](https://github.com/airyrooms/maleo.js/compare/v0.1.1...v0.1.2-canary.0) (2019-04-04)
# [0.2.0](https://github.com/airyrooms/maleo.js/compare/v0.1.1...v0.2.0) (2019-04-06)

**Note:** Version bump only for package airy-maleojs

### Bug Fixes

* **maleo-core/server:** route handler promises ([#180](https://github.com/airyrooms/maleo.js/issues/180)) ([6720332](https://github.com/airyrooms/maleo.js/commit/6720332))


### Features

* **maleo-core/render:** changed the way we render wrap ([#181](https://github.com/airyrooms/maleo.js/issues/181)) ([0e160da](https://github.com/airyrooms/maleo.js/commit/0e160da))



Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ Now you need to ignore the git revision head, since if we commit amend the git r
```bash
$ git checkout -- .
```

<!--
After doing all of the above, now you are good to push all this changes to upstream remote by running
```bash
$ git push upstream master --follow-tags #push commits, version changes, and new tags
```
``` -->

---
⚠️**NOTICE** ⚠️
Expand Down
52 changes: 41 additions & 11 deletions example/playground/custom-wrap.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { Link } from 'react-router-dom';

import Wrap from '@airy/maleo/wrap';
import pageWithStyles from '@airy/maleo-css-plugin/pageWithStyles';
Expand All @@ -9,20 +10,49 @@ import { makeStoreClient } from './store';
@pageWithStyles
@withRedux(makeStoreClient)
export default class extends Wrap {
static getInitialProps = ({ store }) => {
console.log('\nGIP wrap store', store);
};
static getInitialProps = async ({ store, ...context }) => {
// const response = await fetch('https://jsonplaceholder.typicode.com/todos/1');
// const data = await response.json();
const data = { initialData: true };
console.log('GIP wrap store', store);

constructor(props) {
super(props);
}
if (store) {
store.dispatch({ type: 'TEST', data: 'testttt' });
}

return { data, store };
};

render() {
const { Container, App, containerProps, appProps } = this.props;

return (
<div>
<h1>This is NAVBARRR</h1>
{super.render()}
</div>
<Container {...containerProps}>
<div>
<h1>This is NAVBARRR</h1>
<div>
rooms main app
<h1>rooms main app</h1>
<ul>
<li>
<Link to="/">Root</Link>
</li>
<li>
<Link to="/search">Search</Link>
</li>
<li>
<Link to="/detail">Detail</Link>
</li>
<li>
<Link to="/not-found">Not Found</Link>
</li>
</ul>
<div>
<App {...appProps} />
</div>
</div>
</div>
</Container>
);
}
}
}
8 changes: 4 additions & 4 deletions example/playground/maleo.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ module.exports = tsPlugin(
env: 'production',
staticPages: {
'/detail': {
page: './src/Detail/index.tsx'
page: './src/Detail/index.tsx',
},
'/search': {
page: './src/Search/index.tsx'
}
}
page: './src/Search/index.tsx',
},
},
}),
);
1 change: 0 additions & 1 deletion example/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@airy/maleo-css-plugin": "latest",
"@airy/maleo-typescript-plugin": "latest",
"@airy/maleo-redux-plugin": "latest",
"@airy/maleo": "latest",
"react": "latest",
"react-redux": "^5.1.1",
"redux": "^4.0.1"
Expand Down
31 changes: 13 additions & 18 deletions example/playground/routes.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
[
{
"page": "./src/MainApp",
"path": "/",
"page": "./src/Root",
"exact": true
},
{
"path": "/search",
"page": "./src/Search",
"routes": [
{
"path": "/",
"page": "./src/Search",
"exact": true
},
{
"path": "/search",
"page": "./src/Search",
"routes": [
{
"path": "/search/hello",
"page": "./src/Detail",
"exact": true
}
]
},
{
"path": "/detail",
"path": "/search/hello",
"page": "./src/Detail",
"exact": true
}
]
},
{
"path": "/detail",
"page": "./src/Detail",
"exact": true
}
]
42 changes: 0 additions & 42 deletions example/playground/src/MainApp.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions example/playground/src/Root/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

export default function() {
return <h1>Root Component</h1>;
}
16 changes: 3 additions & 13 deletions example/playground/src/Search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import * as React from 'react';
import Loadable from 'react-loadable';

const DetailComponent = Loadable({
loading: () => <div>loading getting detail...</div>,
loader: () => import('src/Detail' /* webpackChunkName:"Detail" */),
modules: ['./src/Detail'],
});
import { Link } from 'react-router-dom';

export class RoomsSearch extends React.Component<any, any> {
static displayName = 'RoomsSearch';
Expand All @@ -22,18 +16,14 @@ export class RoomsSearch extends React.Component<any, any> {
return (
<div
style={{
backgroundColor: 'blue',
backgroundColor: 'teal',
display: 'inline-block',
float: 'left',
maxWidth: '50%',
}}>
<h1>Rooms Search</h1>
<Link to="/search/hello">Hello</Link>
{this.props.children}

<br />
<br />
<br />
<DetailComponent />
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "3.13.1",
"version": "0.1.2-canary.0",
"version": "0.2.0",
"packages": [
"packages/*"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"publish:prepublish": "lerna run prepublish",
"publish:version-canary": "lerna version prerelease --preid canary --message \"chore(release): publish canary %s [skip ci]\" --yes",
"publish:canary": "lerna publish from-package --no-git-reset --canary --dist-tag canary --yes",
"publish:version-stable": "lerna version --message \"chore(release): publish stable %s\"",
"publish:version-stable": "lerna version --message \"chore(release): publish stable %s\" --git-remote upstream",
"publish:stable": "lerna publish from-package --no-git-reset --yes"
},
"husky": {
Expand Down
12 changes: 10 additions & 2 deletions packages/Maleo.js/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.1.2-canary.0](https://github.com/airyrooms/maleo.js/compare/v0.1.1...v0.1.2-canary.0) (2019-04-04)
# [0.2.0](https://github.com/airyrooms/maleo.js/compare/v0.1.1...v0.2.0) (2019-04-06)

**Note:** Version bump only for package @airy/maleo

### Bug Fixes

* **maleo-core/server:** route handler promises ([#180](https://github.com/airyrooms/maleo.js/issues/180)) ([6720332](https://github.com/airyrooms/maleo.js/commit/6720332))


### Features

* **maleo-core/render:** changed the way we render wrap ([#181](https://github.com/airyrooms/maleo.js/issues/181)) ([0e160da](https://github.com/airyrooms/maleo.js/commit/0e160da))



Expand Down
14 changes: 10 additions & 4 deletions packages/Maleo.js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ import { Wrap } from '@airy/maleo/wrap';
import { withRedux } from '@airy/maleo-redux-plugin';

// Custom Wrapper that will be rendered for the whole Application
import CustomWrapper from './component/CustomWrapper';
import Content from './component/Content';
import NavigationBar from './component/NavigationBar';

import { createStore } from './store';

Expand All @@ -368,10 +369,15 @@ export default class extends Wrap {
}

render() {
const { Container, containerProps, App, appProps } = this.props

return (
<CustomWrapper>
{super.render()}
</CustomWrapper>
<Container {...containerProps}>
<NavigationBar />
<Content>
<App {...appProps}/>
</Content>
</Container>
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/Maleo.js/__test__/server/loadInitialProps.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { matchingRoutes } from '@airy/maleo/lib/server/routeHandler';
import { matchingRoutes } from '@airy/maleo/lib/routes/matching-routes';
import { loadInitialProps, loadComponentProps } from '@airy/maleo/lib/server/loadInitialProps';
import { MimickLoadable } from '../test-utils/mimick-loadable';

Expand Down
2 changes: 1 addition & 1 deletion packages/Maleo.js/__test__/server/routeHandler.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { matchingRoutes } from '@airy/maleo/lib/server/routeHandler';
import { matchingRoutes } from '@airy/maleo/lib/routes/matching-routes';
import { MimickLoadable } from '../test-utils/mimick-loadable';

const NotMatchedComponent = MimickLoadable(() => <h1>Not Matched</h1>);
Expand Down
2 changes: 1 addition & 1 deletion packages/Maleo.js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airy/maleo",
"version": "0.1.2-canary.0",
"version": "0.2.0",
"description": "Un-opinionated Universal Rendering Javascript Framework",
"repository": {
"type": "git",
Expand Down
24 changes: 19 additions & 5 deletions packages/Maleo.js/src/client/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import Loadable from 'react-loadable';
import { loadInitialProps, loadComponentProps } from '@server/loadInitialProps';
import { InitialProps } from '@interfaces/render/IRender';
import { SERVER_INITIAL_DATA, DIV_MALEO_ID } from '@constants/index';
import { matchingRoutes } from '@server/routeHandler';
import { matchingRoutes } from '@routes/matching-routes';
import { RegisterEntry } from './registerEntry';
import { ContainerComponent } from '@render/_container';

export const init = async () => {
try {
Expand All @@ -19,12 +20,25 @@ export const init = async () => {
const { data } = await ensureReady(routes, location.pathname, {});

const wrapProps = await loadComponentProps(Wrap);
const appProps = await loadComponentProps(App);
const appInitialProps = await loadComponentProps(App);

const appProps = {
data,
routes,
location,
...appInitialProps,
...wrapProps,
};
const containerProps = {};

const RenderApp = () => (
<Wrap {...wrapProps}>
<App data={data} routes={routes} location={location} {...appProps} {...wrapProps} />
</Wrap>
<Wrap
App={App}
Container={ContainerComponent}
appProps={appProps}
containerProps={containerProps}
{...wrapProps}
/>
);

hydrate(RenderApp);
Expand Down
Loading

0 comments on commit cfe251b

Please sign in to comment.