From 3d8b261c8674b52a1c46f540ca4cf2c0f2f1a3f0 Mon Sep 17 00:00:00 2001 From: CJ Davis Date: Tue, 2 Feb 2016 19:41:08 -0500 Subject: [PATCH 1/3] Add node depedencies + webpack to project requirements --- Makefile | 8 +++++--- README.md | 2 ++ package.json | 26 ++++++++++++++++++++++++++ webpack.config.js | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 package.json create mode 100644 webpack.config.js diff --git a/Makefile b/Makefile index 5d545ff..90b253a 100644 --- a/Makefile +++ b/Makefile @@ -15,20 +15,22 @@ INSTALLED_FLAG := $(VENDOR_DIR)/.installed install: $(INSTALLED_FLAG) $(INSTALLED_FLAG): Gemfile Gemfile.lock Makefile bundle install --path $(VENDOR_DIR) - npm install react-tools + npm install -g webpack + npm install @ touch $(INSTALLED_FLAG) # indicate that dependencies are installed .PHONY: update update: install bundle update - npm update react-tools + npm update webpack + npm update @ touch $(INSTALLED_FLAG) # indicate that dependencies are installed # BUILD ######################################################################## .PHONY: build build: install - jsx _src/ dist/js/ --no-cache-dir + webpack bundle exec jekyll build --quiet echo ${URL} > _site/CNAME bundle exec htmlproof _site --href-ignore "#" diff --git a/README.md b/README.md index 5cc9ee8..7ce0970 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,12 @@ Based on the Code for Virginia Beach landing page (http://code4hr.org/) * Ruby 2.1.2: `$ rbenv install 2.1.2` * Bundler: `$ gem install bundler` +* Node: [Download Node](https://nodejs.org/en/) ### Running locally ``` +$ make build $ make run ``` diff --git a/package.json b/package.json new file mode 100644 index 0000000..41159cd --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "friendlycode.homepage", + "description": "front end task runner for bundling and building the FriendColde hompage ui", + "dependencies": { + "babel-preset-es2015": "^6.3.13", + "babel-preset-react": "^6.3.13", + "history": "^1.17.0", + "i": "^0.3.4", + "npm": "^3.5.3", + "react": "^0.14.6", + "react-addons-transition-group": "^0.14.6", + "react-dom": "^0.14.6" + }, + "devDependencies": { + "babel-core": "^6.4.0", + "babel-loader": "^6.2.1", + "react-hot-loader": "^1.3.0", + "style-loader": "^0.13.0", + "webpack": "^1.12.10", + "webpack-dev-server": "^1.14.0" + }, + "scripts": { + "dev-server": "webpack-dev-server --inline --hot --progress --colors --content-base dist/", + "dev": "webpack --progress --colors --watch" + } +} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..4d712f7 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,38 @@ +var webpack = require('webpack'); + +module.exports = { + entry: { + app: './_src/app.jsx', + vendors: ['react', 'react-dom', 'react-addons-transition-group'] + }, + output: { + path: './dist/js/', + publicPath: '/js/', + filename: 'app.js' + }, + module: { + loaders: [ + { + test: /\.jsx?$/, + loader: 'babel', + exclude: '/node_modules/', + query: { + cacheDirectory: true, + presets: ['react', 'es2015'] + } + } + ] + }, + resolve: { + extensions: ['', '.js', '.jsx'] + }, + devServer: { + historyApiFallback: true + }, + plugins: [ + new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'), + new webpack.optimize.UglifyJsPlugin({ + sourceMap: true, + minimize: true}) + ] +}; \ No newline at end of file From 77643e8e2050708185d1346bdaf6cc92e73cd1f5 Mon Sep 17 00:00:00 2001 From: CJ Davis Date: Tue, 2 Feb 2016 19:42:07 -0500 Subject: [PATCH 2/3] Begin restructuring React components for organization and webpack usage --- _src/app.jsx | 9 +++++++ _src/components/GithubRepositoryItem.jsx | 15 +++++++++++ .../GithubProjectList.jsx} | 27 +++++-------------- index.html | 4 +-- 4 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 _src/app.jsx create mode 100644 _src/components/GithubRepositoryItem.jsx rename _src/{github-projects.js => containers/GithubProjectList.jsx} (51%) diff --git a/_src/app.jsx b/_src/app.jsx new file mode 100644 index 0000000..8834ece --- /dev/null +++ b/_src/app.jsx @@ -0,0 +1,9 @@ +import React from 'react'; +import { render } from 'react-dom'; + +import GithubProjectList from './containers/GithubProjectList'; + +render( + , + document.getElementById('github-projects') +); \ No newline at end of file diff --git a/_src/components/GithubRepositoryItem.jsx b/_src/components/GithubRepositoryItem.jsx new file mode 100644 index 0000000..51c4b46 --- /dev/null +++ b/_src/components/GithubRepositoryItem.jsx @@ -0,0 +1,15 @@ +import React from 'react'; + +export default class GithubRepositoryItem extends React.Component { + render() { + return ( +
  • +
    +

    {this.props.repo.name}

    +

    {this.props.repo.description}

    + View on Github +
    +
  • + ); + } +}; diff --git a/_src/github-projects.js b/_src/containers/GithubProjectList.jsx similarity index 51% rename from _src/github-projects.js rename to _src/containers/GithubProjectList.jsx index 297cc5f..1ecb637 100644 --- a/_src/github-projects.js +++ b/_src/containers/GithubProjectList.jsx @@ -1,19 +1,9 @@ -var GithubRepositoryItem = React.createClass({ - render: function() { - return ( -
  • -
    -

    {this.props.repo.name}

    -

    {this.props.repo.description}

    - View on Github -
    -
  • - ); - } -}); +import React from 'react'; -var GithubRepositoryList = React.createClass({ - render: function() { +import GithubRepositoryItem from '../components/GithubRepositoryItem' + +export default class GithubProjectList extends React.Component { + render() { var repos = []; jQuery.ajax({ @@ -39,9 +29,4 @@ var GithubRepositoryList = React.createClass({ ); } -}); - -React.render( - , - document.getElementById('github-projects') -); \ No newline at end of file +} diff --git a/index.html b/index.html index af595bc..0628a1c 100644 --- a/index.html +++ b/index.html @@ -165,7 +165,7 @@ // do it LZLD.lazyLoadImages(); - - + + From 977d55b64afdec84f6d2e424b8178895929e3752 Mon Sep 17 00:00:00 2001 From: CJ Davis Date: Tue, 1 Mar 2016 18:36:50 -0500 Subject: [PATCH 3/3] Using envars in Travis for Github credentials --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d2ce02e..e77e07a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ before_cache: env: global: - NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer - - secure: "UDM1SACHM7XVf6oG8oFTe2A8Jd5Drsd8HCwMvlOkkeab02KO+0sS9myTRrDicvvEoKB8gNG1u1S74KH43mPScT58qgwYQMDkGl4IkSTyfZPnukbErQGyRoFlL8OY8G33ksjav/O0hnQyhWLtKXcFL/NL0AF0xavzmLBTP6jyi9k=" branches: except: