release-it
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -69,3 +69,3 @@ var util = require('util'), | ||
).catch(function() { | ||
throw new Error('Unable to tag. Does tag "' + version + '" already exist? Use --force to re-tag.'); | ||
throw new Error('Unable to tag. Does tag "' + version + '" already exist? Use --force to move a tag.'); | ||
}); | ||
@@ -72,0 +72,0 @@ } |
@@ -17,5 +17,7 @@ var fs = require('fs'), | ||
* - `globcp('** /*.txt', targetDir);` | ||
* - `globcp(['** /*.js', '** /*.json'], {cmd: baseDir}, targetDir);` | ||
* - `globcp(['** /*.js', '** /*.json'], {cwd: baseDir}, targetDir);` | ||
* - `globcp({'dist/': ['** /*.js'], './': ['** /bower.json']], null, targetDir);` | ||
* | ||
* @param {String|Array} patterns Single or array of patterns to glob | ||
* @param {String|Array|Object} patterns Pattern or array of patterns to glob, or object of patterns (with keys | ||
* as `cwd` for the (array of) pattern(s) it holds), see example. | ||
* @param {Object} options Options object passed as-is to glob | ||
@@ -28,6 +30,16 @@ * @param {String} target Target dir to copy matched dirs and files to | ||
patterns = typeof patterns === 'string' ? [patterns] : patterns; | ||
if(!target) { | ||
target = options; | ||
} | ||
var dirCache = {}; | ||
var dirCache = {}, | ||
patternObj = {}, | ||
patternBaseDefault = './'; | ||
if(typeof patterns === 'string' || Array.isArray(patterns)) { | ||
patternObj[options.cwd || patternBaseDefault] = typeof patterns === 'string' ? [patterns] : patterns; | ||
} else { | ||
patternObj = patterns; | ||
} | ||
function mkdirAsync(path) { | ||
@@ -53,13 +65,15 @@ return dirCache[path] || (dirCache[path] = fn.call(mkdirp, path)); | ||
return when.map(patterns, function(pattern) { | ||
return fn.call(glob, pattern, options).then(function(matches) { | ||
return when.map(matches, function(match) { | ||
var src = path.resolve(options.cwd, match); | ||
return fn.call(fs.stat, src).then(function(stat) { | ||
var dst = path.resolve(target, match); | ||
if (stat.isDirectory()) { | ||
return mkdirAsync(dst); | ||
} else { | ||
return copyAsync(src, dst); | ||
} | ||
return when.map(Object.keys(patternObj), function(patternBase) { | ||
return when.map(patternObj[patternBase], function(pattern) { | ||
return fn.call(glob, pattern, {cwd: patternBase}).then(function(matches) { | ||
return when.map(matches, function(match) { | ||
var src = path.resolve(patternBase, match); | ||
return fn.call(fs.stat, src).then(function(stat) { | ||
var dst = path.resolve(target, match); | ||
if (stat.isDirectory()) { | ||
return mkdirAsync(dst); | ||
} else { | ||
return copyAsync(src, dst); | ||
} | ||
}); | ||
}); | ||
@@ -66,0 +80,0 @@ }); |
@@ -71,3 +71,3 @@ var path = require('path'), | ||
return command ? run(command) : noop.then(function() { | ||
log.verbose('No build command was provided.') | ||
log.verbose('No build command was provided.'); | ||
}); | ||
@@ -96,4 +96,5 @@ } | ||
return fn.call(fs.writeFile, file, JSON.stringify(data, null, 2)); | ||
}).catch(function() { | ||
}).catch(function(err) { | ||
log.warn('There was a problem bumping the version in ' + file); | ||
log.debug(err); | ||
}); | ||
@@ -100,0 +101,0 @@ }) |
{ | ||
"name": "release-it", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Interactive release tool for Git repositories. Supports to build and release to a distribution/component repository. Publish to npm.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
1863151
685