ffffng/app/bower_components/lodash/lib/fp/build-dist.js

57 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-05-16 13:33:49 +02:00
'use strict';
2017-05-13 13:25:33 +02:00
const _ = require('lodash');
const async = require('async');
const path = require('path');
const webpack = require('webpack');
2016-05-16 13:33:49 +02:00
2017-05-13 13:25:33 +02:00
const file = require('../common/file');
const util = require('../common/util');
2016-05-16 13:33:49 +02:00
2017-05-13 13:25:33 +02:00
const basePath = path.join(__dirname, '..', '..');
const distPath = path.join(basePath, 'dist');
const fpPath = path.join(basePath, 'fp');
const filename = 'lodash.fp.js';
2016-05-16 13:33:49 +02:00
2017-05-13 13:25:33 +02:00
const fpConfig = {
2016-05-16 13:33:49 +02:00
'entry': path.join(fpPath, '_convertBrowser.js'),
'output': {
'path': distPath,
'filename': filename,
'library': 'fp',
'libraryTarget': 'umd'
},
'plugins': [
new webpack.optimize.OccurenceOrderPlugin,
new webpack.optimize.DedupePlugin
]
};
2017-05-13 13:25:33 +02:00
const mappingConfig = {
2016-05-16 13:33:49 +02:00
'entry': path.join(fpPath, '_mapping.js'),
'output': {
'path': distPath,
'filename': 'mapping.fp.js',
'library': 'mapping',
'libraryTarget': 'umd'
}
};
/*----------------------------------------------------------------------------*/
2017-05-13 13:25:33 +02:00
/**
* Creates browser builds of the FP converter and mappings at the `target` path.
*
* @private
* @param {string} target The output directory path.
*/
2016-05-16 13:33:49 +02:00
function build() {
async.series([
_.partial(webpack, mappingConfig),
_.partial(webpack, fpConfig),
file.min(path.join(distPath, filename))
2017-05-13 13:25:33 +02:00
], util.pitch);
2016-05-16 13:33:49 +02:00
}
build();