0
我正在为Node应用程序创建构建脚本。gulp src glob:多个文件模式不匹配
我创建了一个Powershell(PSake)脚本,但现在我需要将它移植到Gulp上,因为我需要在Mac上运行它。
基本上,我将源复制到某个地方并清理它们(删除所有不必要的文件,例如自述文件&),以创建一个将安装在客户端PC上的软件包,所以我希望文件数尽可能小。
在一个地方,我PowerShell的看起来是这样的:
Get-ChildItem "$srcout\node_modules\" -Recurse | ? {
$_.FullName -match "\\\.bin\\" `
-or $_.Name -match "[\w]+\.md$" `
-or $_.Name -match "licen[c|s]e" `
-or $_.Name -match "authors" `
-or $_.Name -match "bower.json" `
-or $_.Name -match "gruntfile\.js" `
-or $_.Name -match "makefile" `
-or $_.Name -match "cakefile"
} | % {
Remove-Item "$($_.FullName)" -Force -Recurse
}
到目前为止,我已经写了这对咕嘟咕嘟:
var pump = require('pump');
var through = require('through2');
pump([
gulp.src([
'**/node_modules/**/.bin/',
'**/node_modules/**/*.md',
'**/node_modules/**/licen+(s|c)e*',
'**/node_modules/**/author*',
'**/node_modules/**/bower.json',
'**/node_modules/**/gruntfile.js',
'**/node_modules/**/makefile',
'**/node_modules/**/cakefile'
], {
cwd: srcout,
nocase: true
}),
through.obj(function(f, e, cb) {
if (fs.statSync(f.path).isFile()) {
fs.unlinkSync(f.path);
} else {
rmdir.sync(f.path);
}
cb(null, f);
})
],
done);
的/.bin/
和*.md
水珠工作正常,但其余的做没有找到任何东西...
我在想什么或做错了什么?
谢谢