<commit_before>/* eslint-disable import/no-extraneous-dependencies */
var path = require('path');
var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');

if (process.env.NODE_ENV !== 'production'
      && process.env.NODE_ENV !== 'development') {
   throw new Error('Environment variable NODE_ENV not set, please set it to either "production or "development"')
}

let entry = {
   core: ['./src/index.js']
};

let devtool = 'source-map';

let plugins = [
   new webpack.DefinePlugin({
      'process.env': {
         NODE_ENV: process.env.NODE_ENV
      }
   }),
   new CopyWebpackPlugin([{
      from: './src/scss',
      to: 'scss'
   }])
];

// production-specific configuration
if (process.env.NODE_ENV === 'production') {
   entry = {
      'core.min': ['./src/index.js']
   }
   devtool = null;
   plugins = plugins.concat([
      new webpack.optimize.DedupePlugin(),
      new webpack.optimize.UglifyJsPlugin({
         compressor: {
            warnings: true
         }
      }),
      new webpack.optimize.OccurrenceOrderPlugin(),
      new webpack.optimize.AggressiveMergingPlugin()
   ]);
}

module.exports = {
   entry,
   devtool,
   plugins,
   module: {
      loaders: [
         {
            test: /\.svg/,
            loader: 'svg-url-loader'
         }, {
            test: /.js$/,
            exclude: /node_modules/,
            loader: 'babel-loader',
            query: {
               presets: ['es2015']
            }
         }, {
            test: /\.(jpeg|jpg|woff|woff2|eot|ttf|svg)(\?.*$|$)/,
            exclude: /node_modules/,
            loader: 'url-loader?importLoaders=1&limit=100000'
         }, {
            test: /\.ttf$|\.eot$/,
            loader: 'file',
            query: {
               name: 'font/[hash].[ext]'
            },
         }, {
            test: /\.json$/,
            loader: 'json'
         }, {
            test: /\.scss$/,
            loaders: ['css', 'sass']
         }
      ]
   },
   output: {
      path: path.resolve(__dirname, 'dist'),
      publicPath: '/dist/',
      libraryTarget: 'commonjs',
      filename: '[name].js'
   },
   resolve: {
      extensions: ['', '.js', '.json', '.scss']
   }
};
<commit_msg>replaced let statements with var in webpack config<commit_after>/* eslint-disable import/no-extraneous-dependencies */
var path = require('path');
var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');

if (process.env.NODE_ENV !== 'production'
      && process.env.NODE_ENV !== 'development') {
   throw new Error('Environment variable NODE_ENV not set, please set it to either "production or "development"')
}

var entry = {
   core: ['./src/index.js']
};

var devtool = 'source-map';

var plugins = [
   new webpack.DefinePlugin({
      'process.env': {
         NODE_ENV: process.env.NODE_ENV
      }
   }),
   new CopyWebpackPlugin([{
      from: './src/scss',
      to: 'scss'
   }])
];

// production-specific configuration
if (process.env.NODE_ENV === 'production') {
   entry = {
      'core.min': ['./src/index.js']
   }
   devtool = null;
   plugins = plugins.concat([
      new webpack.optimize.DedupePlugin(),
      new webpack.optimize.UglifyJsPlugin({
         compressor: {
            warnings: true
         }
      }),
      new webpack.optimize.OccurrenceOrderPlugin(),
      new webpack.optimize.AggressiveMergingPlugin()
   ]);
}

module.exports = {
   entry,
   devtool,
   plugins,
   module: {
      loaders: [
         {
            test: /\.svg/,
            loader: 'svg-url-loader'
         }, {
            test: /.js$/,
            exclude: /node_modules/,
            loader: 'babel-loader',
            query: {
               presets: ['es2015']
            }
         }, {
            test: /\.(jpeg|jpg|woff|woff2|eot|ttf|svg)(\?.*$|$)/,
            exclude: /node_modules/,
            loader: 'url-loader?importLoaders=1&limit=100000'
         }, {
            test: /\.ttf$|\.eot$/,
            loader: 'file',
            query: {
               name: 'font/[hash].[ext]'
            },
         }, {
            test: /\.json$/,
            loader: 'json'
         }, {
            test: /\.scss$/,
            loaders: ['css', 'sass']
         }
      ]
   },
   output: {
      path: path.resolve(__dirname, 'dist'),
      publicPath: '/dist/',
      libraryTarget: 'commonjs',
      filename: '[name].js'
   },
   resolve: {
      extensions: ['', '.js', '.json', '.scss']
   }
};
<|endoftext|>


<commit_before>var path = require('path');
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var px2rem = require('postcss-px2rem');
var env = process.env.NODE_ENV;

var config = {
  devtool: 'eval',
  entry: {
    'index': './src/js/index.js',
    'lib-flex': './src/js/lib-flex.js'
  },
  output: {
    path: path.join(__dirname, 'static'),
    filename: '[name].js',
    publicPath: '/static/'
  },
  module: {
    preLoaders: [
      {test: /\.jsx?$/, loader: 'eslint-loader', exclude: /node_modules/}
    ],
    loaders: [
      {
        test: /\.jsx?$/,
        loader: 'babel',
        exclude: /node_modules/
      },
      {
        test: /\.scss$/,
        loader: 'style!css!postcss!sass'
      },
      {
        test: /\.(jpe?g|png|gif|svg)$/i,
        loaders: [
          //'image?{bypassOnDebug: true, progressive:true, optimizationLevel: 3, pngquant:{quality: "65-80"}}',
          'url?limit=10000&name=image/[name].[hash:8].[ext]'
        ]
      },
      {
        test: /\.(woff|eot|ttf)$/i,
        loader: 'url?limit=10000&name=font/[name].[hash:8].[ext]'
      }
    ]
  },
  sassLoader: {
    includePaths: [path.resolve(__dirname, './src/sass'), path.resolve(__dirname, './node_modules')]
  },
  postcss: [autoprefixer({browsers: ['last 2 versions']}), px2rem({remUnit: 75})],
  resolve: {
    extensions: ['', '.js']
  }
};

/* production config */
if (env === 'production') {
  config.output = {
    path: './static/',
        filename: '[name].[chunkhash:8].js',
        publicPath: '/static/'
  };
  config.plugins = [
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })
  ];
} else {
  config.plugins = [
    new webpack.HotModuleReplacementPlugin()
  ];
}

module.exports = config;<commit_msg>webpack optimization<commit_after>var path = require('path');
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var px2rem = require('postcss-px2rem');
var _ = require('lodash');
var env = process.env.NODE_ENV;

var config = {
  devtool: 'inline-source-map',
  entry: {
    'index': './src/js/index.js',
    'lib-flex': './src/js/lib-flex.js'
  },
  output: {
    path: path.join(__dirname, 'static'),
    filename: '[name].js',
    publicPath: '/static/'
  },
  module: {
    preLoaders: [
      {test: /\.jsx?$/, loader: 'eslint-loader', exclude: /node_modules/}
    ],
    loaders: [
      {
        test: /\.jsx?$/,
        loader: 'babel',
        exclude: /node_modules/
      },
      {
        test: /\.scss$/,
        loader: 'style!css!postcss!sass'
      },
      {
        test: /\.(jpe?g|png|gif|svg)$/i,
        loaders: [
          //'image?{bypassOnDebug: true, progressive:true, optimizationLevel: 3, pngquant:{quality: "65-80"}}',
          'url?limit=10000&name=image/[name].[hash:8].[ext]'
        ]
      },
      {
        test: /\.(woff|eot|ttf)$/i,
        loader: 'url?limit=10000&name=font/[name].[hash:8].[ext]'
      }
    ]
  },
  sassLoader: {
    includePaths: [path.resolve(__dirname, './src/sass'), path.resolve(__dirname, './node_modules')]
  },
  postcss: [autoprefixer({browsers: ['last 2 versions']}), px2rem({remUnit: 75})],
  resolve: {
    extensions: ['', '.js']
  }
};

/* production config */
if (env === 'production') {
  config = _.extend(config, {
    devtool: '#',
    output: {
      path: './static/',
      filename: '[name].[chunkhash:8].js',
      publicPath: '/static/'
    },
    plugins: [
      new webpack.optimize.UglifyJsPlugin({
        compress: {
          warnings: false
        }
      })
    ]
  });
}

module.exports = config;<|endoftext|>


<commit_before>const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge');
const validate = require('webpack-validator');

const parts = require('./lib/parts');

const PATHS = {
  app: path.join(__dirname, 'app'),
  style: [
    path.join(__dirname, 'node_modules/purecss'),
    path.join(__dirname, 'app/main.css')
  ],
  build: path.join(__dirname, 'build')
};

const common = {
  // Entry accepts a path or an object of entries.
  // We'll be using the latter form given it's
  // convenient with more complex configurations.
  entry: {
    style: PATHS.style,
    app: PATHS.app
  },
  output: {
    path: PATHS.build,
    filename: '[name].js'
  },
  plugins: [
    new HtmlWebpackPlugin({
      title: 'Webpack demo'
    })
  ]
};

var config;

// Detect how npm is run and branch based on that
switch(process.env.npm_lifecycle_event) {
  case 'build':
  case 'stats':
    config = merge(
      common,
      {
        devtool: 'source-map',
        output: {
          path: PATHS.build,
          filename: '[name].[chunkhash].js',
          chunkFilename: '[chunkhash].js'
        }
      },
      parts.clean(PATHS.build),
      parts.setFreeVariable(
        'process.env.NODE_ENV',
        'production'
      ),
      parts.extractBundle({
        name: 'vendor',
        entries: ['react']
      }),
      parts.minify(),
      parts.extractCSS(PATHS.style),
      parts.purifyCSS([PATHS.app])
    );
    break;
  default:
    config = merge(
      common,
      {
        devtool: 'eval-source-map'
      },
      parts.setupCSS(PATHS.style),
      parts.devServer({
        // Customize host/port here if needed
        host: process.env.HOST,
        port: process.env.PORT
      })
    );
}

module.exports = validate(config);
<commit_msg>Make paths platform independent<commit_after>const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const merge = require('webpack-merge');
const validate = require('webpack-validator');

const parts = require('./lib/parts');

const PATHS = {
  app: path.join(__dirname, 'app'),
  style: [
    path.join(__dirname, 'node_modules', 'purecss'),
    path.join(__dirname, 'app', 'main.css')
  ],
  build: path.join(__dirname, 'build')
};

const common = {
  // Entry accepts a path or an object of entries.
  // We'll be using the latter form given it's
  // convenient with more complex configurations.
  entry: {
    style: PATHS.style,
    app: PATHS.app
  },
  output: {
    path: PATHS.build,
    filename: '[name].js'
  },
  plugins: [
    new HtmlWebpackPlugin({
      title: 'Webpack demo'
    })
  ]
};

var config;

// Detect how npm is run and branch based on that
switch(process.env.npm_lifecycle_event) {
  case 'build':
  case 'stats':
    config = merge(
      common,
      {
        devtool: 'source-map',
        output: {
          path: PATHS.build,
          filename: '[name].[chunkhash].js',
          chunkFilename: '[chunkhash].js'
        }
      },
      parts.clean(PATHS.build),
      parts.setFreeVariable(
        'process.env.NODE_ENV',
        'production'
      ),
      parts.extractBundle({
        name: 'vendor',
        entries: ['react']
      }),
      parts.minify(),
      parts.extractCSS(PATHS.style),
      parts.purifyCSS([PATHS.app])
    );
    break;
  default:
    config = merge(
      common,
      {
        devtool: 'eval-source-map'
      },
      parts.setupCSS(PATHS.style),
      parts.devServer({
        // Customize host/port here if needed
        host: process.env.HOST,
        port: process.env.PORT
      })
    );
}

module.exports = validate(config);
<|endoftext|>


<commit_before>module.exports = {
  entry: "./src/client/index.tsx",
  output: {
    filename: "index.js",
    path: __dirname + "/dist/client"
  },
  devtool: "source-map",
  resolve: {
    extensions: [".ts", ".tsx", ".js", ".json"]
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        loader: "awesome-typescript-loader",
        options: {
          configFileName: "tsconfig.client.json",
          useCache: true,
        }
      },
      { enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
    ]
  },
};
<commit_msg>vendor code splitting and 4ever cacheable assets<commit_after>const webpack = require("webpack");
const path = require("path");

module.exports = {
  entry: {
    main: "./src/client/index.tsx",
  },
  output: {
    filename: "[name].[hash].js",
    path: path.join(__dirname, "dist/client"),

  },
  devtool: "source-map",
  resolve: {
    extensions: [".ts", ".tsx", ".js", ".json"],
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        loader: "awesome-typescript-loader",
        options: {
          configFileName: "tsconfig.client.json",
          useCache: true,
        },
      },
      { enforce: "pre", test: /\.js$/, loader: "source-map-loader" },
    ],
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      name: "vendor",
      minChunks(module) {
        return module.context && module.context.indexOf("node_modules") !== -1;
      },
    }),
    new webpack.optimize.CommonsChunkPlugin({
      name: "manifest",
    }),
  ],
};
<|endoftext|>


<commit_before>var path = require("path");
var webpack = require("webpack");
const validate = require("webpack-validator");

var env = process.env.MIX_ENV || "dev";
var prod = env === "prod";

var plugins = [
  new webpack.NoErrorsPlugin()
];

var loaders = ["babel?cacheDirectory"];
var publicPath = "http://localhost:4001/";

var uglifyJSOptions = {
  compress: {
    warnings: false
  }
};

var definePluginOptions = {
  "NODE_ENV": JSON.stringify("production")
};

if (prod) {
  plugins.push(new webpack.DefinePlugin(definePluginOptions));
  plugins.push(new webpack.optimize.OccurrenceOrderPlugin());
  plugins.push(new webpack.optimize.DedupePlugin());
  plugins.push(new webpack.optimize.UglifyJsPlugin(uglifyJSOptions));
} else {
  plugins.push(new webpack.HotModuleReplacementPlugin());
  loaders.unshift("react-hot");
}

var entry = "./web/static/js/bundle.js";
var devEntry = {
  app: [
    "webpack-dev-server/client?" + publicPath,
     // "only", prevents reload on syntax error
    "webpack/hot/only-dev-server",
    entry
  ]
};
var prodEntry = {
  app: entry
}

var config = {
  devtool: prod ? null : "eval-source-map",
  entry: prod ? prodEntry : devEntry,
  output: {
    path: path.join(__dirname, "./priv/static/js"),
    filename: "bundle.js",
    publicPath: publicPath
  },
  plugins: plugins,
  module: {
    loaders: [
      {
        test: /\.jsx?/,
        loaders: loaders,
        exclude: /node_modules/
      },
      {
        test: /\.scss$/,
        loaders: [
          "style",
          "css?sourceMap",
          "sass?sourceMap",
          "autoprefixer?browsers=last 2 version"
        ]
      },
      {
        test: /\.(svg|jpg|png)$/,
        loader: "file-loader"
      }
    ]
  }
};

// module.exports = validate(config);
module.exports = config;
<commit_msg>try fix the define plugin config<commit_after>var path = require("path");
var webpack = require("webpack");
const validate = require("webpack-validator");

var env = process.env.MIX_ENV || "dev";
var prod = env === "prod";

var plugins = [
  new webpack.NoErrorsPlugin()
];

var loaders = ["babel?cacheDirectory"];
var publicPath = "http://localhost:4001/";

var uglifyJSOptions = {
  compress: {
    warnings: false
  }
};

var definePluginOptions = {
  "process.env.NODE_ENV": JSON.stringify("production")
};

if (prod) {
  plugins.push(new webpack.DefinePlugin(definePluginOptions));
  plugins.push(new webpack.optimize.OccurrenceOrderPlugin());
  plugins.push(new webpack.optimize.DedupePlugin());
  plugins.push(new webpack.optimize.UglifyJsPlugin(uglifyJSOptions));
} else {
  plugins.push(new webpack.HotModuleReplacementPlugin());
  loaders.unshift("react-hot");
}

var entry = "./web/static/js/bundle.js";
var devEntry = {
  app: [
    "webpack-dev-server/client?" + publicPath,
     // "only", prevents reload on syntax error
    "webpack/hot/only-dev-server",
    entry
  ]
};
var prodEntry = {
  app: entry
}

var config = {
  devtool: prod ? null : "eval-source-map",
  entry: prod ? prodEntry : devEntry,
  output: {
    path: path.join(__dirname, "./priv/static/js"),
    filename: "bundle.js",
    publicPath: publicPath
  },
  plugins: plugins,
  module: {
    loaders: [
      {
        test: /\.jsx?/,
        loaders: loaders,
        exclude: /node_modules/
      },
      {
        test: /\.scss$/,
        loaders: [
          "style",
          "css?sourceMap",
          "sass?sourceMap",
          "autoprefixer?browsers=last 2 version"
        ]
      },
      {
        test: /\.(svg|jpg|png)$/,
        loader: "file-loader"
      }
    ]
  }
};

// module.exports = validate(config);
module.exports = config;
<|endoftext|>


<commit_before>require("babel-polyfill");
var webpack = require('webpack');
var path = require('path');

module.exports = {
    DEV: {
        debug: true,
        devtool: '#eval-source-map',
        context: path.join(__dirname, 'app', 'assets/scripts'),
        entry: [
            'webpack/hot/dev-server',
            'webpack-hot-middleware/client',
            './main'
        ],
        output: {
            path: path.join(__dirname, 'app', 'assets/scripts'),
            publicPath: '/assets/scripts',
            filename: "bundle.js"
        },
        module: {
            loaders: [{
                test: /\.js$/,
                include: path.join(__dirname, 'app', 'assets/scripts'),
                loaders: ['babel-loader']
            }]
        },
        resolve: {
            extensions: ["", ".js", ".jsx", '.es6'],
        },
        plugins: [
            new webpack.optimize.OccurenceOrderPlugin(),
            new webpack.HotModuleReplacementPlugin(),
            new webpack.NoErrorsPlugin()
        ],
    },
    PROD: {
        cache: false,
        output: {
            filename: "bundle.js",
        },
        devtool: 'cheap-module-source-map',
        module: {
            loaders: [{
                test: /\.js$/,
                include: path.join(__dirname, 'app', 'assets/scripts'),
                loaders: ['babel-loader']
            }]
        },
        resolve: {
            extensions: ["", ".js", ".jsx", '.es6'],
        },
        plugins: [
            new webpack.DefinePlugin({
                'process.env': {
                    'NODE_ENV': JSON.stringify('production')
                }
            }),
            new webpack.optimize.UglifyJsPlugin({
                compress: {
                    warnings: false
                }
            })
        ]
    },
    TEST: {
        debug: true,
        devtool: '#eval-source-map',
        context: path.join(__dirname, 'test'),
        output: {
            path: path.join(__dirname, 'test'),
            publicPath: '/',
            filename: "bundle.js"
        },
        entry: [
            'webpack/hot/dev-server',
            'webpack-hot-middleware/client',
            './index'
        ],
        module: {
            loaders: [{
                test: /\.js$/,
                exclude: /node_modules/,
                loaders: ['babel']
            }]
        },
        resolve: {
            extensions: ["", ".js", ".jsx", '.es6'],
        },
        plugins: [
            new webpack.optimize.OccurenceOrderPlugin(),
            new webpack.HotModuleReplacementPlugin(),
            new webpack.NoErrorsPlugin()
        ],
    }
}
<commit_msg>create webpack-dev-server configuration<commit_after>var webpack = require('webpack');
var path = require('path');

module.exports = {
    DEV: {
        devtool: 'eval',
        context: path.join(__dirname, 'app', 'assets/scripts'),
        entry: [
            'webpack-dev-server/client?http://localhost:3000',
            'webpack/hot/only-dev-server',
            './main'
        ],
        output: {
            path: path.join(__dirname, 'dist', 'assets/scripts'),
            publicPath: 'http://localhost:3000/assets/scripts/',
            filename: "bundle.js"
        },
        module: {
            loaders: [{
                test: /\.js$/,
                include: path.join(__dirname, 'app', 'assets/scripts'),
                loaders: ['react-hot', 'babel'],
            }]
        },
        resolve: {
            extensions: ["", ".js", ".jsx", '.es6'],
        },
        plugins: [
            new webpack.optimize.OccurenceOrderPlugin(),
            new webpack.HotModuleReplacementPlugin(),
            new webpack.NoErrorsPlugin()
        ]
    },
    PROD: {
        cache: false,
        output: {
            filename: "bundle.js",
        },
        devtool: 'cheap-module-source-map',
        module: {
            loaders: [{
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                loaders: ['babel-loader']
            }]
        },
        resolve: {
            extensions: ["", ".js", ".jsx", '.es6'],
        },
        plugins: [
            new webpack.DefinePlugin({
                'process.env': {
                    'NODE_ENV': JSON.stringify('production')
                }
            }),
            new webpack.optimize.UglifyJsPlugin({
                compress: {
                    warnings: false
                }
            })
        ]
    },
    TEST: {
        debug: true,
        devtool: '#eval-source-map',
        context: path.join(__dirname, 'test'),
        output: {
            path: path.join(__dirname, 'test'),
            publicPath: '/',
            filename: "bundle.js"
        },
        entry: [
            'webpack/hot/dev-server',
            'webpack-hot-middleware/client',
            './index'
        ],
        module: {
            loaders: [{
                test: /\.js$/,
                exclude: /node_modules/,
                loaders: ['babel']
            }]
        },
        resolve: {
            extensions: ["", ".js", ".jsx", '.es6'],
        },
        plugins: [
            new webpack.optimize.OccurenceOrderPlugin(),
            new webpack.HotModuleReplacementPlugin(),
            new webpack.NoErrorsPlugin()
        ],
    }
}
<|endoftext|>


<commit_before>'use strict';

const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const extractCSS = new ExtractTextPlugin('bundle.css');

module.exports = {
  entry: ['./src/index.js', './style/scss/styles.scss'],
  output: {
    path: path.resolve(__dirname, "dist"),
    publicPath: '/dist/',
    filename: 'bundle.js'
  },
  module: {
    rules:[
      {
        test: /\.js$/,
        use: [{
          loader: 'babel-loader',
          options: {
            presets: ["react", "es2015", "stage-1"]
          }
        }]
      },
      {
        test: /\.scss$/,
        use: extractCSS.extract({
          use: [{
                loader: "css-loader"
              },{
                loader: "postcss-loader",
                options: {
                  plugins: (loader) => [
                    require('postcss-import')({ root: loader.resourcePath }),
                    require('postcss-cssnext')(),
                    require('cssnano')()
                  ]
                }
              },{
                loader: "sass-loader"
              }]
        })
      }
    ]
  },
  devServer: {
    historyApiFallback: true,
    contentBase: './'
  },
  plugins: [
    extractCSS,
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
      'global.host': process.env.NODE_DEV === 'production' && 'https://tic-tac-toe-socketio.herokuapp.com' || 'http://localhost:3050'
    })
  ]
};
<commit_msg>updated env variables for webpack<commit_after>'use strict';

const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const extractCSS = new ExtractTextPlugin('bundle.css');

module.exports = {
  entry: ['./src/index.js', './style/scss/styles.scss'],
  output: {
    path: path.resolve(__dirname, "dist"),
    publicPath: '/dist/',
    filename: 'bundle.js'
  },
  module: {
    rules:[
      {
        test: /\.js$/,
        use: [{
          loader: 'babel-loader',
          options: {
            presets: ["react", "es2015", "stage-1"]
          }
        }]
      },
      {
        test: /\.scss$/,
        use: extractCSS.extract({
          use: [{
                loader: "css-loader"
              },{
                loader: "postcss-loader",
                options: {
                  plugins: (loader) => [
                    require('postcss-import')({ root: loader.resourcePath }),
                    require('postcss-cssnext')(),
                    require('cssnano')()
                  ]
                }
              },{
                loader: "sass-loader"
              }]
        })
      }
    ]
  },
  devServer: {
    historyApiFallback: true,
    contentBase: './'
  },
  plugins: [
    extractCSS,
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
      'env.host': process.env.NODE_DEV === 'production' && 'https://tic-tac-toe-socketio.herokuapp.com' || 'http://localhost:3050'
    })
  ]
};
<|endoftext|>


<commit_before>/* eslint-env node */
'use strict';

module.exports = {
  context: __dirname + '/src',
  entry: './index.js',
  output: {
    path: __dirname + '/.tmp',
    filename: 'bundle.js'
  },
  resolve: {
    modulesDirectories: ['node_modules'],
    extensions: ['', '.js']
  },
  module: {
    loaders: [
      { test: /\.js$/, loader: 'babel-loader' }
    ]
  }
};
<commit_msg>Output the script as a library<commit_after>/* eslint-env node */
'use strict';

module.exports = {
  context: __dirname + '/src',
  entry: './index.js',
  output: {
    path: __dirname + '/.tmp',
    filename: 'bundle.js',
    library: 'Lib',
    libraryTarget: 'umd'
  },
  resolve: {
    modulesDirectories: ['node_modules'],
    extensions: ['', '.js']
  },
  module: {
    loaders: [
      { test: /\.js$/, loader: 'babel-loader' }
    ]
  }
};
<|endoftext|>


<commit_before>/**
 * Dependencies declared
 * @type {Object}
 */
import ExtractTextPlugin from 'extract-text-webpack-plugin';
const path = require('path'),

module.exports = {
  entry: ['./client/src/Index.js', './client/src/style/Index.scss'],
  output: { path: __dirname, filename: './client/public/build/Bundle.js' },
  watch: true,
  devServer: {
    contentBase: 'client/public/'
  },
  module: {
    rules: [
      {
        test: /\.js?$/,
        exclude: /node_modules/,
        use: [
          { loader: 'babel-loader' },
          { loader: 'eslint-loader' }
        ]
      },
      {
        test: /\.css$/,
        exclude: /node_modules/,
        use: [
          { loader: 'style-loader!css-loader' }
        ]
      },
      {
        test: /\.scss$/,
        exclude: /node_modules/,
        use: [
          { loader: 'sass-loader' }
        ]
      }
    ]
  },
  resolve: {
    extensions: ['*', '.js', '.css', '.jsx']
  },
  resolveLoader: {
      modules: ["node_modules"],
      extensions: ["*", ".js"]
  }
};
<commit_msg>chore(task-runner):modify-webpack<commit_after>/**
 * Dependencies declared
 */
import path from 'path'
import Webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
const extractPlugin = new ExtractTextPlugin ({
  filename: 'Index.css'
});

export default {
  entry: ['./client/src/Index.jsx', './client/src/style/Index.scss'],
  output: {
    path: path.resolve(__dirname, 'client/public/build/'),
    filename: 'Bundle.js',
    publicPath: '/client/public/'
  },
  watch: true,
  module: {
    rules: [
      {
        test: /\.js?$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              presets: ['es2015']
            }
          },
          {
            loader: 'eslint-loader'
          }
        ]
      },
      {
        test: /\.scss$/,
        exclude: /node_modules/,
        use: extractPlugin.extract({
          use: ['css-loader', 'sass-loader']
        })
      },
      {
        test: /\.css$/,
        use: ['style-loader', 'css-loader']
      }
    ]
  },
  plugins: [
    extractPlugin,
    new Webpack.optimize.UglifyJsPlugin()
  ],
  resolve: {
    extensions: ['*', '.js', '.jsx', '.css', '.scss']
  },
  resolveLoader: {
      modules: ['node_modules'],
      extensions: ['*', '.js']
  }
};
<|endoftext|>


<commit_before>const path = require('path');
const webpack = require('webpack');

module.exports = {
    entry: {
        'awesome-validator.min': [path.resolve(__dirname, 'src/validator.ts')]
    },
    output: {
        path: path.resolve(__dirname),
        filename: '[name].js',
        libraryTarget: 'umd'
    },
    resolve: {
        extensions: ['.ts', '.tsx', '.js']
    },
    devtool: 'source-map',
    plugins: [
        new webpack.optimize.UglifyJsPlugin({
            minimize: true,
            include: /\.min\.js$/,
        })
    ],
    module: {
        loaders: [{
            test: /\.tsx?$/,
            loader: 'awesome-typescript-loader',
            exclude: /node_modules/
        }]
    }
};
<commit_msg>build(webpack): Added `fs` empty in `node`<commit_after>const path = require('path');
const webpack = require('webpack');

module.exports = {
    entry: {
        'awesome-validator.min': [path.resolve(__dirname, 'src/validator.ts')]
    },
    output: {
        path: path.resolve(__dirname),
        filename: '[name].js',
        libraryTarget: 'umd'
    },
    resolve: {
        extensions: ['.ts', '.tsx', '.js']
    },
    devtool: 'source-map',
    plugins: [
        new webpack.optimize.UglifyJsPlugin({
            minimize: true,
            include: /\.min\.js$/,
        })
    ],
    module: {
        loaders: [{
            test: /\.tsx?$/,
            loader: 'awesome-typescript-loader',
            exclude: /node_modules/
        }]
    },
    node: {
        fs: 'empty'
    }
};
<|endoftext|>


<commit_before>/*global require: false, module: false, __dirname: false */
'use strict';
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');

module.exports = {
	historyApiFallback: true,
	entry: "./js/bogorouter",
	output: {
		path: "build",
		publicPath: "/",
		filename: "[name].js"
	},
	module: {
		loaders: [
			{ test: /rx-dom/, loader: "imports?define=>false" },
			{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?optional[]=es7.objectRestSpread&optional[]=utility.inlineEnvironmentVariables&cacheDirectory=true'},
			{ test: /\.css$/, loader: "style!css" },
			{ test: /\.haml$/, loader: 'haml-loader' },
			{ test: /\.(jpe?g|png|gif|svg|eot|woff2?|ttf)$/i, loaders: ['url?limit=10000'] }
		]
	},
	plugins: [
		new HtmlWebpackPlugin({
			title: "UCSC Xena",
			filename: "index.html",
			template: "page.template"
		}),
		new webpack.OldWatchingPlugin()
	],
	resolve: {
		alias: {
			rx$: 'rx/dist/rx',
			'rx.binding$': 'rx/dist/rx.binding',
			'rx.async$': 'rx/dist/rx.async',
			'rx.experimental$': 'rx/dist/rx.experimental',
			'rx.coincidence$': 'rx/dist/rx.coincidence'
		},
		extensions: ['', '.js', '.json', '.coffee'],
		root: __dirname + "/js"
	}
};
<commit_msg>Enable babel on ucsc-xena-datapages.<commit_after>/*global require: false, module: false, __dirname: false */
'use strict';
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');

function babelTarget(path) {
	return path.indexOf('node_modules') === -1 || path.indexOf('ucsc-xena-datapages') !== -1;
}

module.exports = {
	historyApiFallback: true,
	entry: "./js/bogorouter",
	output: {
		path: "build",
		publicPath: "/",
		filename: "[name].js"
	},
	module: {
		loaders: [
			{ test: /rx-dom/, loader: "imports?define=>false" },
			{ test: /\.js$/, include: babelTarget,
				loader: 'babel-loader?optional[]=es7.objectRestSpread&optional[]=utility.inlineEnvironmentVariables&cacheDirectory=true'},
			{ test: /\.css$/, loader: "style!css" },
			{ test: /\.haml$/, loader: 'haml-loader' },
			{ test: /\.(jpe?g|png|gif|svg|eot|woff2?|ttf)$/i, loaders: ['url?limit=10000'] }
		]
	},
	plugins: [
		new HtmlWebpackPlugin({
			title: "UCSC Xena",
			filename: "index.html",
			template: "page.template"
		}),
		new webpack.OldWatchingPlugin()
	],
	resolve: {
		alias: {
			rx$: 'rx/dist/rx',
			'rx.binding$': 'rx/dist/rx.binding',
			'rx.async$': 'rx/dist/rx.async',
			'rx.experimental$': 'rx/dist/rx.experimental',
			'rx.coincidence$': 'rx/dist/rx.coincidence'
		},
		extensions: ['', '.js', '.json', '.coffee'],
		root: __dirname + "/js"
	}
};
<|endoftext|>


<commit_before>
const path = require('path')

module.exports = {
  entry: {
    app: [
      'webpack-dev-server/client?http://localhost:8080/',
      './src/app.js',
      "./src/global.js", ]
  },

  output: {
    path: path.join(__dirname, "dist"),
    filename: "bundle.js"
  },

  module: {
    preLoaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'eslint-loader'
      }
    ],
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        query: {
          presets: ['react', 'es2015']
        }
      },
      {
        test: /\.css$/,
        exclude: /node_modules/,
        loader: 'style!css'
      }
    ]
  },

  resolve: {
    extensions: ['', '.js', '.jsx', '.es6']
  }
}<commit_msg>webpack config modifyg<commit_after>
const path = require('path')

module.exports = {
  entry: {
    app: [

      './src/app.js',
      "./src/global.js", ]
  },

  output: {
    path: path.join(__dirname, "dist"),
    filename: "bundle.js"
  },

  module: {
    preLoaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'eslint-loader'
      }
    ],
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        query: {
          presets: ['react', 'es2015']
        }
      },
      {
        test: /\.css$/,
        exclude: /node_modules/,
        loader: 'style!css'
      }
    ]
  },

  resolve: {
    extensions: ['', '.js', '.jsx', '.es6']
  }
}<|endoftext|>


<commit_before>var path = require('path')
var webpack = require('webpack');

module.exports = {
  entry: './src/full.js',
  // devtool: 'source-map',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'vue-echarts.js',
    library: undefined,
    libraryTarget: 'umd'
    // umdNamedDefine: true
  },
  externals: {
    vue: {
      root: 'Vue',
      commonjs2: 'vue',
      commonjs: 'vue',
      amd: 'vue',
    },
    echarts: {
      root: 'echarts',
      commonjs2: 'echarts',
      commonjs: 'echarts',
      amd: 'echarts',
    }
  },
  plugins: [
    // new webpack.optimize.ModuleConcatenationPlugin(),
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify('production')
      }
    }),
    new webpack.SourceMapDevToolPlugin({
      filename: '[file].map'
    }),
    new webpack.optimize.UglifyJsPlugin({
      sourceMap: true,
      compress: {
        warnings: false
      }
    }),
    new webpack.LoaderOptionsPlugin({
      minimize: true
    })
  ],
  resolve: {
    // extensions: ['.js', '.vue']
    alias: {
      'vue$': 'vue/dist/vue.esm.js'
    }
  },
  performance: {
    hints: false
  },
  module: {
    rules: [{
      test: /\.jsx?$/,
      exclude: /node_modules/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: [
            ['env', {
              targets: {
                browsers: ['last 2 versions', 'ie >= 7']
              },
              modules: false
              // useBuiltIns: true
            }]
          ],
          comments: false
          // plugins: ['transform-vue-jsx']
        }
      }
    }]
  },
};
<commit_msg>chore(build): upgrade echarts<commit_after>var path = require('path')
var webpack = require('webpack');

module.exports = {
  entry: './src/full.js',
  // devtool: 'source-map',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'vue-echarts.js',
    library: undefined,
    libraryTarget: 'umd'
    // umdNamedDefine: true
  },
  externals: {
    vue: {
      root: 'Vue',
      commonjs2: 'vue',
      commonjs: 'vue',
      amd: 'vue',
    },
    echarts: {
      root: 'echarts',
      commonjs2: 'echarts',
      commonjs: 'echarts',
      amd: 'echarts',
    }
  },
  plugins: [
    // new webpack.optimize.ModuleConcatenationPlugin(),
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify('production')
      }
    }),
    new webpack.SourceMapDevToolPlugin({
      filename: '[file].map'
    }),
    new webpack.optimize.UglifyJsPlugin({
      sourceMap: true,
      compress: {
        warnings: false
      }
    }),
    new webpack.LoaderOptionsPlugin({
      minimize: true
    })
  ],
  performance: {
    hints: false
  },
  module: {
    rules: [{
      test: /\.jsx?$/,
      exclude: /node_modules/,
      use: {
        loader: 'babel-loader',
        options: {
          presets: [
            ['env', {
              targets: {
                browsers: ['last 2 versions', 'ie >= 7']
              },
              modules: false
              // useBuiltIns: true
            }]
          ],
          comments: false
          // plugins: ['transform-vue-jsx']
        }
      }
    }]
  },
};
<|endoftext|>


<commit_before>var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
  entry: {
    'dime.content': './src/chrome/dime.content.js',
    'dime.logger': './src/chrome/dime.logger.js',
    'dime.background': './src/chrome/dime.background.js',
    'dime.options': './src/chrome/dime.options.js',
  },
  output: {
    path: __dirname + '/build/chrome',
    filename: '[name].js',
  },
  node: {
    net: "empty",
    tls: "empty",
    fs: "empty",
  },
  devtool: 'eval-cheap-module-source-map',
  module: {
    loaders: [
      {
        test: /\.json$/,
        loader: "json-loader"
      },
      {
        test: /\.js?$/,
        exclude: /node_modules/,
        loader: 'babel'
      },
      {
        test: /\.md$/,
        loader: "html!markdown"
      }
    ]
  },
  resolve: {
    extensions: ['', '.js', '.jsx', '.json']
  },
  plugins: [
    new CopyWebpackPlugin([
      {
        from: './src/chrome/manifest.json',
        to: 'manifest.json' //+output.path
      },
      {
        from: './src/chrome/dime.options.html',
        to: 'dime.options.html' //+output.path
      },
      {
        from: 'src/icons'
      }
    ], {
      ignore: [],
      copyUnmodified: true
    })
  ]
};
<commit_msg>new configuration for css files<commit_after>var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
  entry: {
    'dime.content': './src/chrome/dime.content.js',
    'dime.logger': './src/chrome/dime.logger.js',
    'dime.background': './src/chrome/dime.background.js',
    'dime.options': './src/chrome/dime.options.js',
  },
  output: {
    path: __dirname + '/build/chrome',
    filename: '[name].js',
  },
  node: {
    net: "empty",
    tls: "empty",
    fs: "empty",
    child_process: 'empty',
    dns: 'empty'
  },
  devtool: 'eval-cheap-module-source-map',
  module: {
    loaders: [
      {
        test: /\.json$/,
        loader: "json-loader"
      },
      {
        test: /\.js?$/,
        exclude: /node_modules/,
        loader: 'babel'
      },
      //{
      //  test: /\.md$/,
      //  loader: "html!markdown"
      //},
      {
        test: /\.css$/,
        loader: 'style-loader!css-loader'
      },
      {
        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
        loader: "file"
      },
      {
        test: /\.(woff|woff2)$/,
        loader:"url?prefix=font/&limit=5000"
      },
      {
        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
        loader: "url?limit=10000&mimetype=application/octet-stream"
      },
      {
        test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
        loader: "url?limit=10000&mimetype=image/svg+xml"
      }
    ]
  },
  resolve: {
    extensions: ['', '.js', '.jsx', '.json']
  },
  plugins: [
    new CopyWebpackPlugin([
      {
        from: './src/chrome/manifest.json',
        to: 'manifest.json' //+output.path
      },
      {
        from: './src/chrome/dime.options.html',
        to: 'dime.options.html' //+output.path
      },
      {
        from: 'src/icons'
      }
    ], {
      ignore: [],
      copyUnmodified: true
    })
  ]
};
<|endoftext|>


<commit_before>import React from "react";
import Departure from "../components/Departure";
import {
    StyleSheet,
    Button,
    ScrollView,
    RefreshControl,
    TouchableHighlight,
    View,
    Modal,
    Text,
} from "react-native";
import { connect } from "react-redux";
import Checkpoints from "../checkpoints/Checkpoints";
import SwipeList from "react-native-smooth-swipe-list";

const generateRandomParts = () => {
    const numParts = Math.floor(Math.random() * 6) + 4;

    const items = [];
    for (var i = 0; i < numParts; i++) {
        const exp = Math.random();
        // Occupationlevels 1-3
        items.push(Math.floor(exp * exp * 3));
    }

    return items;
};

const departureRowData = (setSelectedDeparture, departure) => {
    const occupations = generateRandomParts();
    const { to, category, number, departureTimestamp } = departure;

    return {
        id: `${category}_${number}_${departureTimestamp}`,
        leftSubViewOptions: {
            fullWidth: true,
        },
        leftSubView: (
            <View style={styles.warnView}>
                {occupations.map((occupation, idx, parts) => {
                    const partStyles = [styles.part];
                    switch (occupation) {
                        case 1:
                            partStyles.push(styles.partWarnOccupied);
                            break;
                        case 2:
                            partStyles.push(styles.partOccupied);
                            break;
                    }

                    if (idx === 0) partStyles.push(styles.partLeft);
                    if (idx === parts.length - 1)
                        partStyles.push(styles.partRight);

                    return <View key={idx} style={partStyles} />;
                })}
            </View>
        ),
        rowView: (
            <Departure
                key={`${to}_${category}_${number}_${departureTimestamp}`}
                to={to}
                category={category}
                number={number}
                departureTime={departureTimestamp}
                onPress={() => setSelectedDeparture(departure)}
                occupation={Math.round(
                    occupations.reduce((a, b) => a + b, 0) /
                        (occupations.length || 1),
                )}
            />
        ),
        style: styles.white,
    };
};

export default connect((state, { stationId }) => {
    const station = state.stations.data[stationId];
    const stationboard = state.stationboards[stationId];
    if (!station || !stationboard) {
        return { ready: false };
    }
    return {
        ready: true,
        name: station.name,
        distance: station.distance,
        pending: stationboard.pending,
        departures: stationboard.data,
    };
})(
    class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                selectedDeparture: null,
            };
        }
        setSelectedDeparture = departure => {
            this.setState({ selectedDeparture: departure });
        };
        hideModal = () => {
            this.setState({ selectedDeparture: null });
        };
        render() {
            const { ready, name, pending, departures } = this.props;
            if (!ready) {
                return null;
            }
            return (
                <View>
                    <Modal
                        animationType="slide"
                        transparent={false}
                        visible={!!this.state.selectedDeparture}
                    >
                        <View style={styles.modal}>
                            <Checkpoints
                                checkpoints={
                                    this.state.selectedDeparture &&
                                    this.state.selectedDeparture.checkpoints
                                }
                            />
                            <Button
                                onPress={this.hideModal}
                                style={styles.modalButton}
                                title="Dismiss"
                            />
                        </View>
                    </Modal>

                    <SwipeList
                        rowData={departures.map(departure =>
                            departureRowData(
                                this.setSelectedDeparture,
                                departure,
                            ),
                        )}
                    />
                </View>
            );
        }
    },
);

const styles = StyleSheet.create({
    white: {
        backgroundColor: "white",
    },
    lightgold: {
        backgroundColor: "lightgoldenrodyellow",
    },
    warnView: {
        flex: 1,
        flexDirection: "row",
        justifyContent: "center",
        alignItems: "center",
        backgroundColor: "white",
        borderBottomWidth: 1,
        borderBottomColor: "#ccc",
    },
    part: {
        width: 35,
        height: 20,
        backgroundColor: "white",
        borderWidth: 1,
        borderColor: "black",
        marginRight: 5,
    },
    partLeft: {
        borderTopLeftRadius: 8,
    },
    partRight: {
        borderTopRightRadius: 8,
        marginRight: 0,
    },
    partWarnOccupied: {
        backgroundColor: "#ffcc80",
    },
    partOccupied: {
        backgroundColor: "#ef9a9a",
    },
    modal: {
        flex: 1,
        marginTop: 20,
    },
    modalButton: {
        flex: -1,
        justifyContent: "center",
        alignItems: "center",
        margin: 16,
        padding: 16,
        borderWidth: 1,
        borderRadius: 4,
        borderColor: "#aaa",
        color: "blue",
    },
});
<commit_msg>Add class number to train parts<commit_after>import React from "react";
import Departure from "../components/Departure";
import {
    StyleSheet,
    Button,
    ScrollView,
    RefreshControl,
    TouchableHighlight,
    View,
    Modal,
    Text,
} from "react-native";
import { connect } from "react-redux";
import Checkpoints from "../checkpoints/Checkpoints";
import SwipeList from "react-native-smooth-swipe-list";

const generateRandomParts = () => {
    const numParts = Math.floor(Math.random() * 6) + 4;

    const items = [];
    for (var i = 0; i < numParts; i++) {
        const exp = Math.random();
        // Occupationlevels 1-3
        items.push(Math.floor(exp * exp * 3));
    }

    return items;
};

const departureRowData = (setSelectedDeparture, departure) => {
    const occupations = generateRandomParts();
    const { to, category, number, departureTimestamp } = departure;

    return {
        id: `${category}_${number}_${departureTimestamp}`,
        leftSubViewOptions: {
            fullWidth: true,
        },
        leftSubView: (
            <View style={styles.warnView}>
                <View style={styles.partsWrapper}>
                    {occupations.map((occupation, idx, parts) => {
                        const partStyles = [styles.part];
                        switch (occupation) {
                            case 1:
                                partStyles.push(styles.partWarnOccupied);
                                break;
                            case 2:
                                partStyles.push(styles.partOccupied);
                                break;
                        }

                        if (idx === 0) partStyles.push(styles.partLeft);
                        if (idx === parts.length - 1)
                            partStyles.push(styles.partRight);

                        return (
                            <View key={idx} style={partStyles}>
                                <View style={styles.partClass}>
                                    <Text style={styles.partNumber}>
                                        {Math.round(Math.random())}
                                    </Text>
                                </View>
                            </View>
                        );
                    })}
                </View>
            </View>
        ),
        rowView: (
            <Departure
                key={`${to}_${category}_${number}_${departureTimestamp}`}
                to={to}
                category={category}
                number={number}
                departureTime={departureTimestamp}
                onPress={() => setSelectedDeparture(departure)}
                occupation={Math.round(
                    occupations.reduce((a, b) => a + b, 0) /
                        (occupations.length || 1),
                )}
            />
        ),
        style: styles.white,
    };
};

export default connect((state, { stationId }) => {
    const station = state.stations.data[stationId];
    const stationboard = state.stationboards[stationId];
    if (!station || !stationboard) {
        return { ready: false };
    }
    return {
        ready: true,
        name: station.name,
        distance: station.distance,
        pending: stationboard.pending,
        departures: stationboard.data,
    };
})(
    class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                selectedDeparture: null,
            };
        }
        setSelectedDeparture = departure => {
            this.setState({ selectedDeparture: departure });
        };
        hideModal = () => {
            this.setState({ selectedDeparture: null });
        };
        render() {
            const { ready, name, pending, departures } = this.props;
            if (!ready) {
                return null;
            }
            return (
                <View>
                    <Modal
                        animationType="slide"
                        transparent={false}
                        visible={!!this.state.selectedDeparture}
                    >
                        <View style={styles.modal}>
                            <Checkpoints
                                checkpoints={
                                    this.state.selectedDeparture &&
                                    this.state.selectedDeparture.checkpoints
                                }
                            />
                            <Button
                                onPress={this.hideModal}
                                style={styles.modalButton}
                                title="Dismiss"
                            />
                        </View>
                    </Modal>

                    <SwipeList
                        rowData={departures.map(departure =>
                            departureRowData(
                                this.setSelectedDeparture,
                                departure,
                            ),
                        )}
                    />
                </View>
            );
        }
    },
);

const styles = StyleSheet.create({
    white: {
        backgroundColor: "white",
    },
    lightgold: {
        backgroundColor: "lightgoldenrodyellow",
    },
    warnView: {
        flex: 1,
        alignItems: "center",
        borderBottomWidth: 1,
        borderBottomColor: "#ccc",
    },
    partsWrapper: {
        flex: 1,
        flexDirection: "row",
        alignItems: "center",
        justifyContent: "center",
        width: "90%",
    },
    part: {
        flex: 1,
        alignItems: "center",
        width: 35,
        height: 20,
        backgroundColor: "white",
        borderWidth: 1,
        borderColor: "black",
        marginTop: "-5%",
        marginRight: 5,
    },
    partLeft: {
        borderTopLeftRadius: 8,
    },
    partRight: {
        borderTopRightRadius: 8,
        marginRight: 0,
    },
    partWarnOccupied: {
        backgroundColor: "#ffcc80",
    },
    partOccupied: {
        backgroundColor: "#ef9a9a",
    },
    modal: {
        flex: 1,
        marginTop: 20,
    },
    modalButton: {
        flex: -1,
        justifyContent: "center",
        alignItems: "center",
        margin: 16,
        padding: 16,
        borderWidth: 1,
        borderRadius: 4,
        borderColor: "#aaa",
        color: "blue",
    },
    partClass: {
        marginTop: 25,
        paddingLeft: 4,
        paddingRight: 4,
        paddingTop: 0,
        paddingBottom: 0,
        borderRadius: 4,
        borderWidth: 1,
        borderColor: "#01579b",
        backgroundColor: "#039be5",
    },
    partNumber: {
        color: "white",
    },
});
<|endoftext|>


<commit_before>'use strict';

// Modules
const path = require('path');
const webpack = require('webpack');

const DefinePlugin = require('webpack/lib/DefinePlugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');

let ENV = process.env.npm_lifecycle_event;
let isTest = ENV === 'test' || ENV === 'test-watch';
let isProd = ENV === 'build';

module.exports = function makeWebpackConfig() {

    let config = {};

    config.entry = isTest ? {} : {
        app: './src/app/app.js',
        vendor: './src/app/vendor.js'
    };

    config.resolve = {
        modulesDirectories: ['web_modules', 'node_modules', 'bower_components']
    };

    config.output = isTest ? {} : {
        path: __dirname + '/dist',
        publicPath: isProd ? './' : 'http://localhost:8080/',
        filename: isProd ? '[name].[hash].js' : '[name].bundle.js',
        chunkFilename: isProd ? '[id].[hash].js' : '[id].bundle.js'
    };

    if (isTest) {
        config.devtool = 'inline-source-map';
    } else if (isProd) {
        config.devtool = 'source-map';
    } else {
        config.devtool = 'eval-source-map';
    }

    config.module = {
        preLoaders: [],
        loaders: [{
            test: /\.js$/,
            loaders: ['babel'],
            exclude: /(node_modules|bower_components)/
        }, {
            test: /\.css$/,
            loader: isTest ? 'null' : ExtractTextPlugin.extract('style-loader', 'css-loader?sourceMap!postcss-loader')
        }, {
            test: /\.scss$/,
            loaders: ['style', 'css', 'postcss', 'sass'],
            include: /bootstrap/
        }, {
            test: /\.scss$/,
            loaders: ['style', 'css?modules&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss', 'sass'],
            exclude: /bootstrap/
        }, {
            test: /\.woff$/,
            loader: 'url-loader?limit=10000&mimetype=application/font-woff&name=/assets/font/[hash].[ext]'
        }, {
            test: /\.woff2$/,
            loader: 'url-loader?limit=10000&mimetype=application/font-woff2&name=/assets/font/[hash].[ext]'
        }, {
            test: /\.(eot|ttf)$/,
            loader: 'url-loader?limit=10000&name=/assets/font/[hash].[ext]'
        }, {
            test: /\.(svg|gif|png|jpe?g)$/,
            loader: 'url-loader?limit=1024&name=/assets/images/[hash].[ext]'
        }, {
            test: /\.html$/,
            loader: 'html'
        }]
    };

    if (isTest) {
        config.module.preLoaders.push({
            test: /\.js$/,
            exclude: [
                /node_modules/,
                /__tests__/,
                /test.webpack.js$/
            ],
            loader: 'isparta'
        })
    } else {
        config.module.preLoaders.push({
            test: /\.js$/,
            loader: 'eslint',
            exclude: /(node_modules|bower_components|__tests__)/
        });
    }

    config.postcss = [
        require('autoprefixer')({
            browsers: ['last 3 version']
        })
    ];
    let CONFIG;
    try {
        CONFIG = JSON.stringify(require('./config.js'))
    } catch (error) {
        CONFIG = process.env;
    }
    config.plugins = [
        new ProvidePlugin({
            $: 'jquery',
            jQuery: 'jquery',
            'window.jQuery': 'jquery',
            'root.jQuery': 'jquery'
        }),
        new webpack.ResolverPlugin(
            new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('.bower.json', ['main'])
        ),
        new DefinePlugin({
            ENV: CONFIG
        })
    ];

    if (!isTest) {
        config.plugins.push(
            new HtmlWebpackPlugin({
                template: './src/public/index.html',
                inject: 'body'
            }),
            new ExtractTextPlugin('[name].[hash].css', {
                disable: !isProd
            })
        )
    }

    if (!isProd) {
        config.plugins.push(
            new webpack.HotModuleReplacementPlugin()
        )
    }

    if (isProd) {
        config.plugins.push(
            new webpack.DefinePlugin({
                'process.env': {
                    NODE_ENV: JSON.stringify('production')
                }
            }),
            new webpack.NoErrorsPlugin(),
            new webpack.optimize.DedupePlugin(),
            new webpack.optimize.UglifyJsPlugin(),
            new CopyWebpackPlugin([{
                from: __dirname + '/src/public'
            }])
        )
    }

    config.devServer = {
        contentBase: './src/public',
        hot: true,
        colors: true,
        inline: true,
        compress: true,
        proxy: {
            '/oauth': {
                target: 'http://localhost:' + (process.env.PORT || 3000) + '/'
            }
        },
        stats: 'minimal'
    };
    return config;
}();
<commit_msg>fix env<commit_after>'use strict';

// Modules
const path = require('path');
const webpack = require('webpack');

const DefinePlugin = require('webpack/lib/DefinePlugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');

let ENV = process.env.npm_lifecycle_event;
let isTest = ENV === 'test' || ENV === 'test-watch';
let isProd = ENV === 'build';

module.exports = function makeWebpackConfig() {

    let config = {};

    config.entry = isTest ? {} : {
        app: './src/app/app.js',
        vendor: './src/app/vendor.js'
    };

    config.resolve = {
        modulesDirectories: ['web_modules', 'node_modules', 'bower_components']
    };

    config.output = isTest ? {} : {
        path: __dirname + '/dist',
        publicPath: isProd ? './' : 'http://localhost:8080/',
        filename: isProd ? '[name].[hash].js' : '[name].bundle.js',
        chunkFilename: isProd ? '[id].[hash].js' : '[id].bundle.js'
    };

    if (isTest) {
        config.devtool = 'inline-source-map';
    } else if (isProd) {
        config.devtool = 'source-map';
    } else {
        config.devtool = 'eval-source-map';
    }

    config.module = {
        preLoaders: [],
        loaders: [{
            test: /\.js$/,
            loaders: ['babel'],
            exclude: /(node_modules|bower_components)/
        }, {
            test: /\.css$/,
            loader: isTest ? 'null' : ExtractTextPlugin.extract('style-loader', 'css-loader?sourceMap!postcss-loader')
        }, {
            test: /\.scss$/,
            loaders: ['style', 'css', 'postcss', 'sass'],
            include: /bootstrap/
        }, {
            test: /\.scss$/,
            loaders: ['style', 'css?modules&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss', 'sass'],
            exclude: /bootstrap/
        }, {
            test: /\.woff$/,
            loader: 'url-loader?limit=10000&mimetype=application/font-woff&name=/assets/font/[hash].[ext]'
        }, {
            test: /\.woff2$/,
            loader: 'url-loader?limit=10000&mimetype=application/font-woff2&name=/assets/font/[hash].[ext]'
        }, {
            test: /\.(eot|ttf)$/,
            loader: 'url-loader?limit=10000&name=/assets/font/[hash].[ext]'
        }, {
            test: /\.(svg|gif|png|jpe?g)$/,
            loader: 'url-loader?limit=1024&name=/assets/images/[hash].[ext]'
        }, {
            test: /\.html$/,
            loader: 'html'
        }]
    };

    if (isTest) {
        config.module.preLoaders.push({
            test: /\.js$/,
            exclude: [
                /node_modules/,
                /__tests__/,
                /test.webpack.js$/
            ],
            loader: 'isparta'
        })
    } else {
        config.module.preLoaders.push({
            test: /\.js$/,
            loader: 'eslint',
            exclude: /(node_modules|bower_components|__tests__)/
        });
    }

    config.postcss = [
        require('autoprefixer')({
            browsers: ['last 3 version']
        })
    ];
    let CONFIG;
    try {
        CONFIG = require('./config.js')
    } catch (error) {
        CONFIG = process.env;
    }
    config.plugins = [
        new ProvidePlugin({
            $: 'jquery',
            jQuery: 'jquery',
            'window.jQuery': 'jquery',
            'root.jQuery': 'jquery'
        }),
        new webpack.ResolverPlugin(
            new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('.bower.json', ['main'])
        ),
        new DefinePlugin({
            ENV: JSON.stringify(CONFIG)
        })
    ];

    if (!isTest) {
        config.plugins.push(
            new HtmlWebpackPlugin({
                template: './src/public/index.html',
                inject: 'body'
            }),
            new ExtractTextPlugin('[name].[hash].css', {
                disable: !isProd
            })
        )
    }

    if (!isProd) {
        config.plugins.push(
            new webpack.HotModuleReplacementPlugin()
        )
    }

    if (isProd) {
        config.plugins.push(
            new webpack.DefinePlugin({
                'process.env': {
                    NODE_ENV: JSON.stringify('production')
                }
            }),
            new webpack.NoErrorsPlugin(),
            new webpack.optimize.DedupePlugin(),
            new webpack.optimize.UglifyJsPlugin(),
            new CopyWebpackPlugin([{
                from: __dirname + '/src/public'
            }])
        )
    }

    config.devServer = {
        contentBase: './src/public',
        hot: true,
        colors: true,
        inline: true,
        compress: true,
        proxy: {
            '/oauth': {
                target: 'http://localhost:' + (process.env.PORT || 3000) + '/'
            }
        },
        stats: 'minimal'
    };
    return config;
}();
<|endoftext|>


<commit_before>var mysql = require('mysql');

var connection;
var db_config = {
  host: 'localhost',
  user: 'root',
  database: 'uncovery'
};

handleDisconnect();
exports.connection = connection;

function handleDisconnect() {
  connection = mysql.createConnection(db_config);

  connection.connect(function(err) {
    if(err) {
      console.log('error when connecting to db:', err);
      setTimeout(handleDisconnect, 2000);
    }
  });

  connection.on('error', function(err) {
    console.log('db error', err);
    if(err.code === 'PROTOCOL_CONNECTION_LOST') {
      handleDisconnect();
    } else {
      throw err;
    }
  });
}
<commit_msg>fix/ update connection variable upon db reconnect<commit_after>var mysql = require('mysql');

var db_config = {
  host: 'localhost',
  user: 'root',
  database: 'uncovery'
};

handleDisconnect();

function handleDisconnect() {
  exports.connection = mysql.createConnection(db_config);

  exports.connection.connect(function(err) {
    if(err) {
      console.log('error when connecting to db:', err);
      setTimeout(handleDisconnect, 2000);
    }
  });

  exports.connection.on('error', function(err) {
    console.log('db error', err);
    if(err.code === 'PROTOCOL_CONNECTION_LOST') {
      handleDisconnect();
    } else {
      throw err;
    }
  });
}
<|endoftext|>


<commit_before>var webpack = require('webpack');
var UglifyJsPlugin = require('uglifyjs-webpack-plugin');

var pkg = require('./package.json');
var year = new Date().getFullYear();
var banner = '\
\n\
 SIP version ' + pkg.version + '\n\
 Copyright (c) 2014-' + year + ' Junction Networks, Inc <http://www.onsip.com>\n\
 Homepage: https://sipjs.com\n\
 License: https://sipjs.com/license/\n\
\n\
\n\
 ~~~SIP.js contains substantial portions of JsSIP under the following license~~~\n\
 Homepage: http://jssip.net\n\
 Copyright (c) 2012-2013 José Luis Millán - Versatica <http://www.versatica.com>\n\
\n\
 Permission is hereby granted, free of charge, to any person obtaining\n\
 a copy of this software and associated documentation files (the\n\
 "Software"), to deal in the Software without restriction, including\n\
 without limitation the rights to use, copy, modify, merge, publish,\n\
 distribute, sublicense, and/or sell copies of the Software, and to\n\
 permit persons to whom the Software is furnished to do so, subject to\n\
 the following conditions:\n\
\n\
 The above copyright notice and this permission notice shall be\n\
 included in all copies or substantial portions of the Software.\n\
\n\
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\n\
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n\
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n\
 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n\
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n\
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\
\n\
 ~~~ end JsSIP license ~~~\n\
\n\n\n';

module.exports = function (env) {
  var mode = env.buildType === 'prod' ? 'production' : 'development';

  var entry = {};
  entry['sip' + (env.buildType === 'prod' ? '.min' : '')] = __dirname + '/src/index.js';

  return {
    mode: mode,
    entry: entry,
    output: {
      path: __dirname + '/dist',
      filename: '[name].js',
      library: 'SIP',
      libraryTarget: 'umd'
    },
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          loader: "babel-loader",
          options: {
            presets: ['env']
          }
        },
        {
          test: /\.pegjs$/,
          loader: 'pegjs-loader',
          options: {
            'optimize': 'size',
            'allowedStartRules':
            [
              "Contact",
              "Name_Addr_Header",
              "Record_Route",
              "Request_Response",
              "SIP_URI",
              "Subscription_State",
              "Supported",
              "Require",
              "Via",
              "absoluteURI",
              "Call_ID",
              "Content_Disposition",
              "Content_Length",
              "Content_Type",
              "CSeq",
              "displayName",
              "Event",
              "From",
              "host",
              "Max_Forwards",
              "Min_SE",
              "Proxy_Authenticate",
              "quoted_string",
              "Refer_To",
              "Replaces",
              "Session_Expires",
              "stun_URI",
              "To",
              "turn_URI",
              "uuid",
              "WWW_Authenticate",
              "challenge",
              "sipfrag",
              "Referred_By"
            ]
          }
        }
      ]
    },
    optimization: {
      minimizer: [
        new UglifyJsPlugin({
          uglifyOptions: {
            output: {
              ascii_only: true
            }
          }
        })
      ]
    },
    plugins: [
      new webpack.BannerPlugin({
        banner: banner
      })
    ]
  };
}
<commit_msg>update webpack config to include globalobject: 'this'<commit_after>var webpack = require('webpack');
var UglifyJsPlugin = require('uglifyjs-webpack-plugin');

var pkg = require('./package.json');
var year = new Date().getFullYear();
var banner = '\
\n\
 SIP version ' + pkg.version + '\n\
 Copyright (c) 2014-' + year + ' Junction Networks, Inc <http://www.onsip.com>\n\
 Homepage: https://sipjs.com\n\
 License: https://sipjs.com/license/\n\
\n\
\n\
 ~~~SIP.js contains substantial portions of JsSIP under the following license~~~\n\
 Homepage: http://jssip.net\n\
 Copyright (c) 2012-2013 José Luis Millán - Versatica <http://www.versatica.com>\n\
\n\
 Permission is hereby granted, free of charge, to any person obtaining\n\
 a copy of this software and associated documentation files (the\n\
 "Software"), to deal in the Software without restriction, including\n\
 without limitation the rights to use, copy, modify, merge, publish,\n\
 distribute, sublicense, and/or sell copies of the Software, and to\n\
 permit persons to whom the Software is furnished to do so, subject to\n\
 the following conditions:\n\
\n\
 The above copyright notice and this permission notice shall be\n\
 included in all copies or substantial portions of the Software.\n\
\n\
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\n\
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n\
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n\
 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n\
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n\
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\
\n\
 ~~~ end JsSIP license ~~~\n\
\n\n\n';

module.exports = function (env) {
  var mode = env.buildType === 'prod' ? 'production' : 'development';

  var entry = {};
  entry['sip' + (env.buildType === 'prod' ? '.min' : '')] = __dirname + '/src/index.js';

  return {
    mode: mode,
    entry: entry,
    output: {
      path: __dirname + '/dist',
      filename: '[name].js',
      library: 'SIP',
      libraryTarget: 'umd',
      globalObject: 'this'
    },
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          loader: "babel-loader",
          options: {
            presets: ['env']
          }
        },
        {
          test: /\.pegjs$/,
          loader: 'pegjs-loader',
          options: {
            'optimize': 'size',
            'allowedStartRules':
            [
              "Contact",
              "Name_Addr_Header",
              "Record_Route",
              "Request_Response",
              "SIP_URI",
              "Subscription_State",
              "Supported",
              "Require",
              "Via",
              "absoluteURI",
              "Call_ID",
              "Content_Disposition",
              "Content_Length",
              "Content_Type",
              "CSeq",
              "displayName",
              "Event",
              "From",
              "host",
              "Max_Forwards",
              "Min_SE",
              "Proxy_Authenticate",
              "quoted_string",
              "Refer_To",
              "Replaces",
              "Session_Expires",
              "stun_URI",
              "To",
              "turn_URI",
              "uuid",
              "WWW_Authenticate",
              "challenge",
              "sipfrag",
              "Referred_By"
            ]
          }
        }
      ]
    },
    optimization: {
      minimizer: [
        new UglifyJsPlugin({
          uglifyOptions: {
            output: {
              ascii_only: true
            }
          }
        })
      ]
    },
    plugins: [
      new webpack.BannerPlugin({
        banner: banner
      })
    ]
  };
}
<|endoftext|>


<commit_before>// Implement selection sort function on a given array

// Complexity of Selection Sort: O(N²)
<commit_msg>add solution with description<commit_after>// Implement selection sort function on a given array

// Complexity of Selection Sort: O(N²)

function selectionSort(items) {
      var length = items.length;

      for (var i = 0; i < length-1; i++) { //Number of passes
        var min = i; //min holds the current minimum number position for each pass; i holds the Initial min number
        for (var j = i+1; j < length; j++) { //Note that j = i + 1 as we only need to go through unsorted array
          if(items[j] < items[min]) { //Compare the numbers
            min = j; //Change the current min number position if a smaller num is found
          }
        }
        if(min != i) { //After each pass, if the current min num != initial min num, exchange the position.
          //Swap the numbers
          var tmp = items[i];
          items[i] = items[min];
          items[min] = tmp;
        }
      }
    }
<|endoftext|>


<commit_before>module.exports = {
    "env": {
        "node": true
    },
    "extends": "eslint:recommended",
    "rules": {
        "indent": [
            "error",
            4
        ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "double"
        ],
        "semi": [
            "error",
            "always"
        ]
    }
};<commit_msg>Tabs to spaces<commit_after>module.exports = {
    "env": {
        "node": true
    },
    "extends": "eslint:recommended",
    "rules": {
        "indent": [
            "error",
            2
        ],
        "linebreak-style": [
            "error",
            "unix"
        ],
        "quotes": [
            "error",
            "double"
        ],
        "semi": [
            "error",
            "always"
        ]
    }
};
<|endoftext|>