Skip to content

Commit

Permalink
add publish functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
yofreke committed Sep 17, 2016
1 parent 01b2864 commit a4cae2d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 13 deletions.
3 changes: 0 additions & 3 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
name="viewport"
content="user-scalable=no,initial-scale=1, maximum-scale=1"
/>
<!-- <link rel="stylesheet" href="./dist/faceDecoratorUi.css"> -->
</head>
<body>
<div id="main"></div>
<script src="../dist/examples.js"></script>
<!-- <script src="./dist/faceDecoratorUi.js"></script> -->
</body>
</html>
9 changes: 3 additions & 6 deletions examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ import reducers from './reducers';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';


const DEV_MODE = location.host.indexOf('localhost') === 0;


let store;
if (DEV_MODE) {
store = createStore(reducers, applyMiddleware(createLogger()));
} else {
if (process.env.NODE_ENV === 'production') {
store = createStore(reducers);
} else {
store = createStore(reducers, applyMiddleware(createLogger()));
}


Expand Down
2 changes: 1 addition & 1 deletion examples/reducers/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const setExample = (example) => {

// The reducers
const DEFAULT_STATE = {
activeExample: EXAMPLES[4].id
activeExample: EXAMPLES[0].id
};

export default function (state = DEFAULT_STATE, action) {
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"version": "0.0.1",
"description": "Javascript library for precise tracking of facial features via Constrained Local Models",
"scripts": {
"build": "webpack --optimize-minimize --optimize-dedupe",
"build": "NODE_ENV=production webpack --optimize-minimize --optimize-dedupe",
"watch": "webpack --debug --devtool inline-source-map --output-pathinfo --progress --colors --watch",
"serve": "webpack-dev-server --debug --devtool inline-source-map --output-pathinfo --inline --hot --host localhost",
"clean": "rm -rf dist",
"postinstall": "npm run build"
"postinstall": "npm run build",
"publish": "./publish.sh"
},
"main": "dist/clmtracker.js",
"repository": {
Expand All @@ -20,8 +21,11 @@
"babel-preset-es2015": "^6.14.0",
"blob.js": "andyinabox/Blob.js",
"exdat": "^0.6.2",
"file-loader": "^0.9.0",
"filesaver.js": "andyinabox/FileSaver.js",
"getusermedia": "^1.3.5",
"gh-pages": "^0.11.0",
"html-webpack-plugin": "^2.22.0",
"json-loader": "^0.5.4",
"raf": "^3.1.0",
"stylus": "^0.54.5",
Expand Down
9 changes: 9 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e
# Remove existing dist
npm run clean
# Run build
npm run build

# Publish using gh-pages tool
gh-pages -d dist
20 changes: 19 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict';
const path = require('path');
const nib = require('nib');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const NODE_ENV = process.env.NODE_ENV || 'development';

const config = {
entry: {
Expand All @@ -10,7 +14,7 @@ const config = {
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist/',
publicPath: '/',
libraryTarget: 'umd',
library: 'clm'
},
Expand Down Expand Up @@ -38,9 +42,23 @@ const config = {
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.wav$|\.mp3$|\.ogv$|\.mp4$|\.webm$/,
loader: 'file'
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'Clmtrackr Examples',
template: path.resolve(__dirname, 'examples', 'index.html'),
chunks: ['examples']
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(NODE_ENV)
})
],
stylus: {
use: [nib()],
import: ['~nib/lib/nib/index.styl'],
Expand Down

0 comments on commit a4cae2d

Please sign in to comment.