Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created node build which deploys to a bin folder #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

bundle.js
node_modules/
build/
.DS_Store
.idea
bin/
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ all: build

build:
npm install
npm install webpack
./node_modules/.bin/webpack
mkdir build
cp index.html bundle.js style.css ./node_modules/normalize.css/normalize.css build/
npm build.js

clean:
rm -rf build/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
A React component simulating a Texas holdem tournament game.

### Usage
Run `npm install`, `npm install -g webpack`, `webpack` to generate `bundle.js`.
Run `npm install`, `node build.js` to create bin.
23 changes: 23 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
var CleanCSS = require( 'clean-css' );
var fs = require( 'fs-extra' );
var webpackConfig = require( './webpack.config.js' );
var webpack = require( 'webpack' );
var cssFile = 'build/style.css';
var cssSource = [ 'node_modules/normalize.css/normalize.css', 'style.css' ];
var compiler = webpack( webpackConfig );

function logError( err ) {
if( err ) console.log( err );
}

fs.emptyDir( 'build', function( err ) {
logError( err );
new CleanCSS( { output : 'react-poker.css' } ).minify(
cssSource,
function( error, minified ) {
fs.outputFile( cssFile, minified.styles, logError );
fs.copySync( 'index.html', 'build/index.html' );
compiler.run( logError );
}
);
} );
3 changes: 1 addition & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Poker Simulator</title>
<link rel="stylesheet" href="./node_modules/normalize.css/normalize.css" />
<title>Ben Don't Kill My Vibe</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"babel-core": "^4.7.16",
"babel-loader": "^4.2.0",
"babel-runtime": "^5.0.0-beta1",
"clean-css": "^3.4.18",
"fs-extra": "^0.30.0",
"normalize.css": "^3.0.3",
"webpack": "^1.7.3"
},
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {

output: {
path: __dirname,
filename: 'bundle.js'
filename: 'build/bundle.js'
},

module: {
Expand Down