Skip to content

Commit

Permalink
[changed] Use Browserify to build examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Sep 1, 2014
1 parent bb7b666 commit 0e649be
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 30 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
examples/_*
examples/build
node_modules
examples/**/*-bundle.js
8 changes: 4 additions & 4 deletions examples/animations/app.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var CSSTransitionGroup = require('react/lib/ReactCSSTransitionGroup');
var Router = require('react-router');
var Routes = Router.Routes;
var Route = Router.Route;
var Link = Router.Link;
var Transition = require('react/lib/ReactCSSTransitionGroup');

var App = React.createClass({
render: function() {
Expand All @@ -14,9 +14,9 @@ var App = React.createClass({
<li><Link to="image" params={{service: "kitten"}}>Kitten</Link></li>
<li><Link to="image" params={{service: "cage"}}>Cage</Link></li>
</ul>
<Transition transitionName="example">
<CSSTransitionGroup transitionName="example">
{this.props.activeRouteHandler()}
</Transition>
</CSSTransitionGroup>
</div>
);
}
Expand Down
3 changes: 2 additions & 1 deletion examples/animations/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Animations</h1>
<div id="example"/>
<script src="../build/animations.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>
2 changes: 1 addition & 1 deletion examples/auth-flow/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var Router = require('react-router');
var Route = Router.Route;
var Routes = Router.Routes;
var Link = Router.Link;
Expand Down
3 changes: 2 additions & 1 deletion examples/auth-flow/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Auth Flow</h1>
<div id="example"/>
<script src="../build/auth-flow.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>

2 changes: 1 addition & 1 deletion examples/data-flow/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var Router = require('react-router');
var Route = Router.Route;
var Routes = Router.Routes;
var Link = Router.Link;
Expand Down
3 changes: 2 additions & 1 deletion examples/data-flow/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Data Flow</h1>
<div id="example"/>
<script src="../build/data-flow.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>
2 changes: 1 addition & 1 deletion examples/dynamic-segments/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var Router = require('react-router');
var Route = Router.Route;
var Routes = Router.Routes;
var Redirect = Router.Redirect;
Expand Down
3 changes: 2 additions & 1 deletion examples/dynamic-segments/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Dynamic Segments</h1>
<div id="example"/>
<script src="../build/dynamic-segments.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>
2 changes: 1 addition & 1 deletion examples/master-detail/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var Router = require('react-router');
var Route = Router.Route;
var DefaultRoute = Router.DefaultRoute;
var Routes = Router.Routes;
Expand Down
3 changes: 2 additions & 1 deletion examples/master-detail/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Master Detail</h1>
<div id="example"/>
<script src="../build/master-detail.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>
2 changes: 1 addition & 1 deletion examples/partial-app-loading/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var Router = require('react-router');
var Route = Router.Route;
var Routes = Router.Routes;
var Link = Router.Link;
Expand Down
2 changes: 1 addition & 1 deletion examples/partial-app-loading/dashboard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsx React.DOM */

var React = require('react');
var ReactRouter = require('../../modules');
var ReactRouter = require('react-router');
var Link = ReactRouter.Link;

var Dashboard = React.createClass({
Expand Down
3 changes: 2 additions & 1 deletion examples/partial-app-loading/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Partial App Loading</h1>
<div id="example"/>
<script src="../build/partial-app-loading.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>
2 changes: 1 addition & 1 deletion examples/query-params/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var Router = require('react-router');
var Route = Router.Route;
var Routes = Router.Routes;
var Link = Router.Link;
Expand Down
3 changes: 2 additions & 1 deletion examples/query-params/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Query Params</h1>
<div id="example"/>
<script src="../build/query-params.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>
2 changes: 1 addition & 1 deletion examples/shared-root/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var Router = require('react-router');
var Route = Router.Route;
var Routes = Router.Routes;
var Link = Router.Link;
Expand Down
3 changes: 2 additions & 1 deletion examples/shared-root/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Shared Root</h1>
<div id="example"/>
<script src="../build/shared-root.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>
3 changes: 1 addition & 2 deletions examples/simple-master-detail/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var Router = require('react-router');
var Route = Router.Route;
var Routes = Router.Routes;
var Link = Router.Link;
Expand Down Expand Up @@ -130,4 +130,3 @@ function findStates() {
function underscore(str) {
return str.toLowerCase().replace(/ /, '_');
}

3 changes: 2 additions & 1 deletion examples/simple-master-detail/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Simple Master Detail</h1>
<div id="example"/>
<script src="../build/simple-master-detail.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>
2 changes: 1 addition & 1 deletion examples/transitions/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx React.DOM */
var React = require('react');
var Router = require('../../modules');
var Router = require('react-router');
var Route = Router.Route;
var Routes = Router.Routes;
var Link = Router.Link;
Expand Down
3 changes: 2 additions & 1 deletion examples/transitions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
<body>
<h1 class="breadcrumbs"><a href="../index.html">React Router Examples</a> / Transitions</h1>
<div id="example"/>
<script src="../build/transitions.js"></script>
<script src="../global-bundle.js"></script>
<script src="app-bundle.js"></script>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
"browserify-shim": {
"react": "global:React"
}
}
}
18 changes: 17 additions & 1 deletion scripts/build-examples
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
#!/bin/sh
webpack --devtool inline-source-map "$@"
BROWSERIFY="node_modules/.bin/browserify --debug --detect-globals false"
BUNDLE_EXAMPLE="$BROWSERIFY -t reactify -x react -x react/lib/ReactCSSTransitionGroup -x when -x react-router"

$BROWSERIFY -t envify -r react -r react/lib/ReactCSSTransitionGroup -r when -r ./modules:react-router > examples/global-bundle.js

$BUNDLE_EXAMPLE examples/animations/app.js > examples/animations/app-bundle.js
$BUNDLE_EXAMPLE examples/auth-flow/app.js > examples/auth-flow/app-bundle.js
$BUNDLE_EXAMPLE examples/data-flow/app.js > examples/data-flow/app-bundle.js
$BUNDLE_EXAMPLE examples/dynamic-segments/app.js > examples/dynamic-segments/app-bundle.js
$BUNDLE_EXAMPLE examples/master-detail/app.js > examples/master-detail/app-bundle.js
# $BUNDLE_EXAMPLE examples/partial-app-loading/app.js > examples/partial-app-loading/app-bundle.js
# $BUNDLE_EXAMPLE examples/partial-app-loading/dashboard.js > examples/partial-app-loading/dashboard-bundle.js
# $BUNDLE_EXAMPLE examples/partial-app-loading/inbox.js > examples/partial-app-loading/inbox-bundle.js
$BUNDLE_EXAMPLE examples/query-params/app.js > examples/query-params/app-bundle.js
$BUNDLE_EXAMPLE examples/shared-root/app.js > examples/shared-root/app-bundle.js
$BUNDLE_EXAMPLE examples/simple-master-detail/app.js > examples/simple-master-detail/app-bundle.js
$BUNDLE_EXAMPLE examples/transitions/app.js > examples/transitions/app-bundle.js

0 comments on commit 0e649be

Please sign in to comment.