'use strict';

var _ = require('lodash'),
    async = require('async'),
    fs = require('fs-extra'),
    path = require('path'),
    webpack = require('webpack');

var minify = require('../common/minify.js');

var basePath = path.join(__dirname, '..', '..'),
    distPath = path.join(basePath, 'dist'),
    entryPath = path.join(__dirname, 'bower.js'),
    filename = 'lodash.fp.js';

var webpackConfig = {
  'entry': entryPath,
  'output': {
    'path': distPath,
    'filename': filename,
    'library': 'fp',
    'libraryTarget': 'umd'
  },
  'plugins': [
    new webpack.optimize.OccurenceOrderPlugin,
    new webpack.optimize.DedupePlugin
  ]
};

/*----------------------------------------------------------------------------*/

function onComplete(error) {
  if (error) {
    throw error;
  }
}

async.series([
  _.partial(webpack, webpackConfig),
  _.partial(minify, path.join(distPath, filename))
], onComplete);

@@ -301,58 +301,8 @@
 '),%0A
-    entryPath = path.join(__dirname, 'bower.js'),%0A
     
@@ -333,23 +333,18 @@
 ';%0A%0Avar 
-webpack
+fp
 Config =
@@ -361,17 +361,40 @@
 y': 
-entryPath
+path.join(__dirname, 'bower.js')
 ,%0A  
@@ -614,16 +614,215 @@
   %5D%0A%7D;%0A%0A
+var mappingConfig = %7B%0A  'entry': path.join(__dirname, 'mapping.js'),%0A  'output': %7B%0A    'path': distPath,%0A    'filename': 'fp-mapping.js',%0A    'library': 'mapping',%0A    'libraryTarget': 'umd'%0A  %7D%0A%7D;%0A%0A
 /*------
@@ -999,23 +999,55 @@
 ebpack, 
+mappingConfig),%0A  _.partial(
 webpack
+, fp
 Config),

Make build expose fp mapping in the dist.