Add Hash util and split out file helper.

This commit is contained in:
John-David Dalton
2016-04-06 23:22:22 -07:00
parent 58afd8c364
commit 0588dcb3e9
9 changed files with 94 additions and 50 deletions

View File

@@ -5,7 +5,7 @@ var _ = require('lodash'),
path = require('path'),
webpack = require('webpack');
var util = require('../common/util');
var file = require('../common/file');
var basePath = path.join(__dirname, '..', '..'),
distPath = path.join(basePath, 'dist'),
@@ -48,7 +48,7 @@ function build() {
async.series([
_.partial(webpack, mappingConfig),
_.partial(webpack, fpConfig),
util.minFile(path.join(distPath, filename))
file.min(path.join(distPath, filename))
], onComplete);
}

View File

@@ -2,12 +2,13 @@
var _ = require('lodash'),
fs = require('fs-extra'),
path = require('path'),
util = require('../common/util');
path = require('path');
var mapping = require('../../fp/_mapping'),
templatePath = path.join(__dirname, 'template/doc'),
template = util.globTemplate(path.join(templatePath, '*.jst'));
var file = require('../common/file'),
mapping = require('../common/mapping');
var templatePath = path.join(__dirname, 'template/doc'),
template = file.globTemplate(path.join(templatePath, '*.jst'));
var argNames = ['a', 'b', 'c', 'd'];

View File

@@ -5,11 +5,11 @@ var _ = require('lodash'),
glob = require('glob'),
path = require('path');
var util = require('../common/util');
var file = require('../common/file'),
mapping = require('../common/mapping');
var mapping = require('../../fp/_mapping'),
templatePath = path.join(__dirname, 'template/modules'),
template = util.globTemplate(path.join(templatePath, '*.jst'));
var templatePath = path.join(__dirname, 'template/modules'),
template = file.globTemplate(path.join(templatePath, '*.jst'));
var aryMethods = _.union(
mapping.aryMethod[1],
@@ -105,14 +105,14 @@ function build(target) {
var actions = modulePaths.map(function(modulePath) {
var moduleName = path.basename(modulePath, '.js');
return util.writeFile(path.join(fpPath, moduleName + '.js'), getTemplate(moduleName));
return file.write(path.join(fpPath, moduleName + '.js'), getTemplate(moduleName));
});
actions.unshift(util.copyFile(path.join(__dirname, '../../fp'), fpPath));
actions.push(util.writeFile(path.join(fpPath, '_falseOptions.js'), template._falseOptions()));
actions.push(util.writeFile(path.join(fpPath, '_util.js'), template._util()));
actions.push(util.writeFile(path.join(target, 'fp.js'), template.fp()));
actions.push(util.writeFile(path.join(fpPath, 'convert.js'), template.convert()));
actions.unshift(file.copy(path.join(__dirname, '../../fp'), fpPath));
actions.push(file.write(path.join(fpPath, '_falseOptions.js'), template._falseOptions()));
actions.push(file.write(path.join(fpPath, '_util.js'), template._util()));
actions.push(file.write(path.join(target, 'fp.js'), template.fp()));
actions.push(file.write(path.join(fpPath, 'convert.js'), template.convert()));
async.series(actions, onComplete);
}