-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from bearsunday/wip
[BC break] new ReduxModule
- Loading branch information
Showing
40 changed files
with
3,113 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
sudo: false | ||
sudo: true | ||
language: php | ||
php: | ||
- 5.5 | ||
- 5.6 | ||
- hhvm | ||
- 7 | ||
- 7.1 | ||
matrix: | ||
include: | ||
- php: 5.5 | ||
env: dependencies=lowest | ||
- php: 5.6 | ||
env: dependencies=lowest | ||
- php: hhvm | ||
env: dependencies=lowest | ||
- php: 7 | ||
env: dependencies=lowest | ||
- php: 7.1 | ||
env: dependencies=lowest | ||
before_install: | ||
|
||
before_script: | ||
- sudo add-apt-repository ppa:pinepain/libv8-5.2 -y | ||
- sudo apt-get update -q | ||
- sudo apt-get install -y libv8-5.2-dev | ||
- printf "\n" | pecl install -f v8js | ||
- phpenv config-add travis.php.ini | ||
- composer self-update | ||
- if [ -z "$dependencies" ]; then composer install; fi; | ||
- if [ "$dependencies" = "lowest" ]; then composer update --prefer-lowest; fi; | ||
script: | ||
- if [ "$TRAVIS_PHP_VERSION" != "7" ]; then phpunit; fi | ||
- if [ "$TRAVIS_PHP_VERSION" == "7" ]; then phpunit --coverage-text --coverage-clover=coverage.clover; fi | ||
- if [ "$TRAVIS_PHP_VERSION" != "7.1" ]; then phpunit; fi | ||
- if [ "$TRAVIS_PHP_VERSION" == "7.1" ]; then phpunit --coverage-text --coverage-clover=coverage.clover; fi | ||
after_script: | ||
- wget https://scrutinizer-ci.com/ocular.phar | ||
- if [ "$TRAVIS_PHP_VERSION" == "7" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi | ||
- if [ "$TRAVIS_PHP_VERSION" == "7.1" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,8 @@ | |
"autoload": { | ||
"psr-4": { | ||
"BEAR\\ReactJsModule\\": [ | ||
"src/" | ||
"src/", | ||
"src-deprecated" | ||
] | ||
} | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
<?php | ||
|
||
use BEAR\ReactJsModule\Ssr; | ||
|
||
/* @var $ssr Ssr */ | ||
list($markup, $script) = $ssr->render(['hello']); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
How to run demo | ||
|
||
``` | ||
npm install | ||
npm run build | ||
npm start | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "redux-react-min-ssr-example", | ||
"version": "0.1.0", | ||
"description": "", | ||
"scripts": { | ||
"build": "webpack --config ui/webpack.config.js", | ||
"start": "php -S 127.0.0.1:3000 -t www" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"react": "^15.0.1", | ||
"react-dom": "^15.0.1", | ||
"react-redux": "^4.4.4", | ||
"redux": "^3.4.0" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.7.6", | ||
"babel-loader": "^6.2.4", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-react": "^6.5.0", | ||
"webpack": "^1.12.15" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015", "react"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import configureStore from '../common/store/configureStore'; | ||
import App from '../common/components/App'; | ||
|
||
global.App = App; | ||
global.configureStore = configureStore; | ||
|
||
// you can add client-only code here. (CSS, etc..) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import configureStore from '../common/store/configureStore'; | ||
import App from '../common/components/App'; | ||
|
||
global.App = App; | ||
global.configureStore = configureStore; | ||
|
||
// export App and configureStore | ||
// SSR component only |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* action types | ||
*/ | ||
export const HELLO_WORLD = 'HELLO_WORLD' | ||
|
||
/* | ||
* action creators | ||
*/ | ||
export const helloWorld = () => { | ||
return { | ||
type: HELLO_WORLD | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react' | ||
import Hello from '../containers/HelloWorld' | ||
|
||
const App = () => ( | ||
<div> | ||
<Hello /> | ||
</div> | ||
) | ||
|
||
export default App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { PropTypes } from 'react' | ||
|
||
const Hello = ({ onClick, message }) => ( | ||
<div> | ||
<h1>{ message }</h1> | ||
<button onClick={onClick}>Click</button> | ||
</div> | ||
) | ||
|
||
Hello.propTypes = { | ||
onClick: PropTypes.func.isRequired, | ||
message: PropTypes.string.isRequired | ||
} | ||
|
||
export default Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { connect } from 'react-redux' | ||
import { helloWorld } from '../actions' | ||
import Hello from './../components/Hello' | ||
|
||
const mapStateToProps = (state) => { | ||
return { | ||
message: state.hello.message | ||
} | ||
} | ||
|
||
const mapDispatchToProps = (dispatch) => { | ||
return { | ||
onClick: () => { | ||
dispatch(helloWorld()) | ||
} | ||
} | ||
} | ||
|
||
const HelloWorld = connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(Hello) | ||
|
||
export default HelloWorld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { HELLO_WORLD } from '../actions' | ||
|
||
const hello = (state = { message: 'Hello CSR !' }, action) => { | ||
switch (action.type) { | ||
case HELLO_WORLD: | ||
return Object.assign({}, state, { message: 'Hello, World!' }) | ||
default: | ||
return state | ||
} | ||
} | ||
|
||
export default hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { combineReducers } from 'redux' | ||
import hello from './hello'; | ||
|
||
const rootReducer = combineReducers({ | ||
hello | ||
}) | ||
|
||
export default rootReducer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { createStore, applyMiddleware } from 'redux' | ||
import rootReducer from '../reducers' | ||
|
||
export default function configureStore(preloadedState) { | ||
const store = createStore( | ||
rootReducer, | ||
preloadedState | ||
); | ||
return store | ||
} |
Oops, something went wrong.