From 01d530d65e2a7a20a7be97dcf6d143299608b1e3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 15 Feb 2016 16:59:43 -0800 Subject: [PATCH] Cleanup fp/build-modules. --- lib/fp/build-modules.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/fp/build-modules.js b/lib/fp/build-modules.js index 36a8a741f..1d2ce6b4c 100644 --- a/lib/fp/build-modules.js +++ b/lib/fp/build-modules.js @@ -87,6 +87,8 @@ function onComplete(error) { } function build(target) { + target = path.resolve(target); + var fpPath = path.join(target, 'fp'); // Glob existing lodash module paths. @@ -100,14 +102,14 @@ function build(target) { // Add FP alias and remapped module paths. _.each([mapping.aliasToReal, mapping.remap], function(data) { _.forOwn(data, function(realName, alias) { - if (!_.startsWith(alias, '_')) { - modulePaths.push(path.join(target, alias + '.js')); + var modulePath = path.join(target, alias + '.js'); + if (!_.startsWith(alias, '_') && + !_.includes(modulePaths, modulePath)) { + modulePaths.push(modulePath); } }); }); - modulePaths = _.uniq(modulePaths); - var actions = modulePaths.map(function(modulePath) { var moduleName = path.basename(modulePath, '.js'); return writeFile(path.join(fpPath, moduleName + '.js'), getTemplate(moduleName));