From 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 6 Oct 2019 21:37:45 +0200 Subject: build: Add some required modules for node --- node_modules/lodash/org.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 node_modules/lodash/org.js (limited to 'node_modules/lodash/org.js') diff --git a/node_modules/lodash/org.js b/node_modules/lodash/org.js new file mode 100644 index 0000000..bac9236 --- /dev/null +++ b/node_modules/lodash/org.js @@ -0,0 +1,39 @@ +'use strict'; + +var fs = require('fs-extra'), + path = require('path'); + +var _ = require('lodash'), + glob = require('glob'), + moment = require('moment'), + ncp = require('ncp').ncp; + +var cwd = process.cwd(); + +var packages = _.transform(glob.sync(path.join(cwd, 'lodash.*')), function(result, pathname) { + var stat = fs.statSync(path.join(pathname, 'index.js')); + if (!moment(stat.mtime).isSame(stat.birthtime)) { + result[path.basename(pathname)] = require(path.join(pathname, 'package.json')); + } +}, {}); + +var grouped = _.groupBy(packages, 'version'); + +_.forOwn(grouped, function(packages, version) { + var pathname = path.join(cwd, version); + if (!fs.existsSync(pathname)) { + fs.ensureDirSync(pathname); + } + _.each(packages, function(pkg) { + var source = path.join(cwd, pkg.name), + destination = path.join(pathname, pkg.name); + + ncp(source, destination, function (err) { + if (err) { + console.error(err); + return; + } + // console.log('copied ' + pkg.name + ' to ' + path.join(version, pkg.name)); + }); + }); +}); -- cgit v1.2.3