Skip to content

Commit

Permalink
Random optimizations (aka bad commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
margaretjoanmiller committed Mar 10, 2016
1 parent ca3c908 commit 285ad2f
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 66 deletions.
1 change: 0 additions & 1 deletion client/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-unused-vars: 0 */
'use-strict';

import { configureStore } from '../shared/redux/store/configureStore';
Expand Down
32 changes: 15 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"name": "prk-starter",
"version": "0.0.1",
"license": "MIT",
"repository" : {
"type" : "git",
"url" : "https://github.com/npm/npm.git"
},
"scripts": {
"test": "npm run test:shared && npm run test:server",
"test:shared": "tape -r babel-register shared/tests/*.spec.js | tap-diff",
"test:server": "echo 'Coming soon!'",
"start:dev": "cross-env NODE_ENV=development node index.js",
"start": "cross-env NODE_ENV=production node index.js",
"bs": "npm run clean && npm run build && npm run start:prod",
"css": "lessc static/styles/app.less --clean-css='--s1 --advanced --compatibility=ie8' static/styles/app.min.css",
"build": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js && npm run css",
"build": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js",
"clean": "rimraf static/dist",
"slate": "rimraf node_modules && npm install",
"lint": "eslint client server shared"
Expand All @@ -19,55 +23,49 @@
"babel-core": "^6.6.5",
"babel-plugin-react-transform": "^2.0.0",
"babel-polyfill": "^6.6.1",
"babel-preset-async-to-bluebird": "^1.0.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"bluebird": "^3.3.3",
"body-parser": "^1.14.2",
"compression": "^1.6.1",
"cross-env": "^1.0.7",
"css-modules-require-hook": "^4.0.0",
"cuid": "^1.3.8",
"express": "^4.13.4",
"history": "^2.0.0",
"isomorphic-fetch": "^2.2.1",
"knex": "^0.10.0",
"moment": "^2.11.2",
"objection": "^0.4.0",
"pg": "^4.5.1",
"radium": "^0.16.6",
"react": "^0.14.7",
"react-bootstrap": "^0.28.3",
"react-dom": "^0.14.7",
"react-redux": "^4.1.2",
"react-router": "^2.0.0-rc5",
"react-time": "^4.0.0",
"react-timeago": "^2.2.1",
"redux": "^3.1.5",
"redux-thunk": "^1.0.3",
"redux-thunk": "^2.0.1",
"sanitize-html": "^1.11.3",
"slug": "^0.9.1",
"tap-diff": "^0.1.1",
"tape": "^4.4.0"
},
"devDependencies": {
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-es2015-webpack": "^6.3.15",
"babel-preset-react": "^6.5.0",
"babel-preset-react-hmre": "^1.1.0",
"babel-preset-stage-2": "^6.5.0",
"bootstrap": "^3.3.6",
"clean-css": "^3.4.9",
"css-loader": "^0.23.1",
"css-modules-require-hook": "^3.0.0",
"deep-freeze": "0.0.1",
"extend-tape": "^1.2.0",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.5",
"less": "^2.6.0",
"less-plugin-clean-css": "^1.5.1",
"react-addons-test-utils": "^0.14.7",
"react-transform-hmr": "^1.0.2",
"rimraf": "^2.5.1",
"style-loader": "^0.13.0",
"supertest": "^1.1.0",
"tape-jsx-equals": "^1.0.0",
"url-loader": "^0.5.7",
"webpack": "^2.1.0-beta.4",
"webpack-dev-middleware": "^1.5.1",
"webpack-hot-middleware": "^2.6.4"
Expand Down Expand Up @@ -100,7 +98,7 @@
"presets": [
"react",
"es2015",
"stage-2",
"stage-0",
"async-to-bluebird"
]
}
Expand Down
5 changes: 2 additions & 3 deletions server/server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint max-len:0 */
import Express from 'express';
import bodyParser from 'body-parser';
import path from 'path';
Expand Down Expand Up @@ -50,11 +51,9 @@ const renderFullPage = (html, initialState) => {
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="app.css">
<title>PERN Starter - Blog App</title>
<link rel="stylesheet" href='/styles/app.min.css' />
<link href='https://fonts.googleapis.com/css?family=Lato:400,300,700' rel='stylesheet' type='text/css'/>
</head>
<body>
<div id="root">${html}</div>
<script>
window.__INITIAL_STATE__ = ${JSON.stringify(initialState)};
Expand Down
7 changes: 3 additions & 4 deletions shared/components/Header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
/* eslint no-unused-vars: 0 */
/* eslint-disable prefer-template*/
import React, { PropTypes, Component } from 'react';
import { Navbar, Nav, NavItem } from 'react-bootstrap';
import { Link } from 'react-router';

function Header(props, context) {
return (
<div className="header">
<div className="header-content">
<h1 className="site-title">
<Link to="/" onClick={props.handleLogoClick}>PERN Starter Blog</Link>
<Link to="/" onClick={props.handleLogoClick}>MERN Starter Blog</Link>
</h1>
{
context.router.isActive('/', true)
? <a className="add-post-button" href="#" onClick={props.onClick}>Add Post</a>
: null
: null
}
</div>
</div>
Expand Down
24 changes: 12 additions & 12 deletions shared/components/PostCreateView/PostCreateView.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-unused-vars*/
/* eslint-disable prefer-template*/
import React, { Component, PropTypes } from 'react';
import { Modal, Button } from 'react-bootstrap';

class PostCreateView extends Component {
constructor(props, context) {
Expand All @@ -19,18 +19,18 @@ class PostCreateView extends Component {
}

render() {
const cls = 'form ' + (this.props.showAddPost ? 'appear' : '');
const cls = `form ${(this.props.showAddPost ? 'appear' : '')}`;
return (
<div className={cls}>
<div className="form-content">
<h2 className="form-title">Create new post</h2>
<input placeholder="Author's Name" className="form-field" ref="name" />
<input placeholder="Post Title" className="form-field" ref="title" />
<textarea placeholder="Post Content" className="form-field" ref="content"></textarea>
<a className="post-submit-button align-right" href="#" onClick={this.addPost}>Submit</a>
</div>
</div>
);
<div className={cls}>
<div className="form-content">
<h2 className="form-title">Create new post</h2>
<input placeholder="Author's Name" className="form-field" ref="name" />
<input placeholder="Post Title" className="form-field" ref="title" />
<textarea placeholder="Post Content" className="form-field" ref="content"></textarea>
<a className="post-submit-button align-right" href="#" onClick={this.addPost}>Submit</a>
</div>
</div>
);
}
}

Expand Down
1 change: 0 additions & 1 deletion shared/container/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-unused-vars: 0 */
import React, { Component, PropTypes } from 'react';
import PostListView from '../container/PostListView/PostListView';
import PostCreateView from '../components/PostCreateView/PostCreateView';
Expand Down
4 changes: 2 additions & 2 deletions shared/container/PostDetailView/PostDetailView.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import TimeAgo from 'react-timeago';
import * as Actions from '../../redux/actions/actions';
import Time from 'react-time';
import Header from '../../components/Header/Header';
import Footer from '../../components/Footer/Footer';

Expand Down Expand Up @@ -31,7 +31,7 @@ class PostDetailView extends Component {
<div className="single-post post-detail">
<h3 className="post-title">{this.props.post.title}</h3>
<p className="author-name">By {this.props.post.name}</p>
<Time value={this.props.post.dateadded} titleFormat="YYYY/MM/DD HH:mm" relative />
<TimeAgo date={this.props.post.dateadded} />
<p className="post-desc">{this.props.post.content}</p>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions shared/routes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint no-unused-vars:0 */
import { Route, IndexRoute } from 'react-router';
import React from 'react';
import App from './container/App';
Expand All @@ -8,7 +7,7 @@ import PostDetailView from './container/PostDetailView/PostDetailView';
const routes = (
<Route path="/" component={App} >
<IndexRoute component={PostContainer} />
<Route path="/post/:slug" component={PostDetailView}/>
<Route path="/post/:slug" component={PostDetailView} />
</Route>
);

Expand Down
2 changes: 0 additions & 2 deletions static/styles/app.less → static/app.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../../node_modules/bootstrap/less/bootstrap';

*{
margin: 0;
padding: 0;
Expand Down
36 changes: 21 additions & 15 deletions static/dist/bundle.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions static/styles/app.min.css

This file was deleted.

2 changes: 1 addition & 1 deletion webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
loader: 'babel',
query: {
babelrc: false,
presets: ['react-hmre', 'react', 'es2015-webpack', 'stage-2', 'async-to-bluebird'],
presets: ['react-hmre', 'react', 'es2015-webpack', 'stage-0', 'async-to-bluebird'],
cacheDirectory: true,
},
}],
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
loader: 'babel',
query: {
babelrc: false,
presets: ['react', 'es2015-webpack', 'stage-2', 'async-to-bluebird'],
presets: ['react', 'es2015-webpack', 'stage-0', 'async-to-bluebird'],
cacheDirectory: true,
},
}],
Expand Down

0 comments on commit 285ad2f

Please sign in to comment.