Skip to content

Commit

Permalink
Open demo on 'npm start'
Browse files Browse the repository at this point in the history
  • Loading branch information
moroshko committed Oct 8, 2016
1 parent fadd9dc commit 3dbf3f3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
14 changes: 12 additions & 2 deletions demo/src/components/App/components/Example10/Example10.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ const exampleId = '10';
const file = `demo/src/components/App/components/Example${exampleId}/Example${exampleId}.js`;

function CustomInput(props) {
const style = {
border: '0 solid green',
borderBottomWidth: '1px',
borderRadius: 0
};

return (
<input style={{ border: '0 solid green', borderBottomWidth: '1px', borderRadius: 0 }} {...props} />
<input style={style} {...props} />
);
}

Expand All @@ -29,7 +35,11 @@ function mapDispatchToProps(dispatch) {

function Example(props) {
const { value, onChange } = props;
const inputProps = { value, onChange };
const inputProps = {
placeholder: 'Custom input',
value,
onChange
};

return (
<div>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"less": "^2.7.1",
"less-loader": "^2.2.3",
"mocha": "^3.1.0",
"openurl": "^1.1.1",
"postcss-loader": "^0.13.0",
"react": "^15.3.2",
"react-addons-test-utils": "^15.3.2",
Expand Down
15 changes: 12 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var openUrl = require('openurl');

var config = require('./webpack.dev.config');
var host = process.env.NODE_HOST || 'localhost';
var port = process.env.NODE_PORT || 3000;

new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true
}).listen(3000, 'localhost', function(error) {
}).listen(port, host, function(error) {
if (error) {
console.error(error); // eslint-disable-line no-console
} else {
console.log('Demo is ready at http://localhost:3000/demo/dist/index.html'); // eslint-disable-line no-console
process.exit(1);
}

var url = `http://${host}:${port}/demo/dist/index.html`;

console.log(`Demo is ready at ${url}`); // eslint-disable-line no-console

openUrl.open(url);
});

0 comments on commit 3dbf3f3

Please sign in to comment.