Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Commit

Permalink
add glob support for output, close #848
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Jun 30, 2014
1 parent 436307e commit 350e5ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var fs = require('fs');
var path = require('path');
var extname = path.extname;
var glob = require('glob');
var log = require('./utils/log');
var install = require('./install');
var umi = require('umi');
Expand Down Expand Up @@ -81,8 +82,14 @@ function getFiles(pkg) {
files.push(pkg.main);
}

if (Array.isArray(pkg.output) && pkg.output.length) {
pkg.output.forEach(function (outputGlob) {
var items = glob.sync(outputGlob, {cwd: pkg.dest});
files = files.concat(items);
});
}

return files
.concat(pkg.output)
.filter(function(item, index, arr) {
return index === arr.indexOf(item);
});
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,23 @@
"form-data": "~0.1.2",
"fstream": "~0.1.25",
"fstream-ignore": "~0.0.7",
"glob": "^4.0.3",
"grunt": "~0.4.2",
"grunt-init": "~0.3.2",
"gulp": "~3.6.2",
"gulp-clean": "~0.3.0",
"gulp-cssmin": "~0.1.4",
"gulp-gunzip": "0.0.2",
"gulp-if": "~1.1.0",
"gulp-jsbeautify": "~0.1.1",
"gulp-uglify": "~0.2.1",
"gulp-untar2": "0.0.5",
"gulp-zip": "~0.3.4",
"inherits": "~1.0.0",
"jscoverage": "~0.3.8",
"lodash": "~2.4.1",
"mocha-browser-for-spm": "~0.2.3",
"multipipe": "~0.1.1",
"gulp-gunzip": "0.0.2",
"gulp-untar2": "0.0.5",
"nico": "~0.5.1",
"request": "~2.36.0",
"requires": "~1.0.1",
Expand Down

0 comments on commit 350e5ee

Please sign in to comment.