Tag: minimatch

什么是glob模式匹配不以下划线开头的所有文件忽略那些以下划线开头的目录?

鉴于目录结构: a/ b/ _private/ notes.txt c/ _3.txt 1.txt 2.txt d/ 4.txt 5.txt 我怎么能写一个glob模式(与npm模块glob兼容),select以下path? a/b/c/1.txt a/b/c/2.txt a/b/d/4.txt a/b/5.txt 这是我所尝试的: // Find matching file paths inside "a/b/"… glob("a/b/[!_]**/[!_]*", (err, paths) => { console.log(paths); }); 但是这只会发出: a/b/c/1.txt a/b/c/2.txt a/b/d/4.txt

npm WARN弃用minimatch@2.0.10,但我有一个更新的版本

npm WARN弃用minimatch@2.0.10:请更新至minimatch 3.0.2或更高版本以避免RegExp DoS问题 我在Windows 10试图安装Cordova。 我知道这个问题被问了很多,如果我仔细看看每一个潜在的困惑,我可能会发现一个愚蠢的。 但是,在你closures我的问题之前,我只想让你知道我看过其中的一些,而且我做了npm update -g minimatch C:\Users\user\npm ls minimatch C:\Users\user `– cordova@6.3.1 +– cordova-common@1.4.1 | `– minimatch@3.0.3 `– cordova-lib@6.3.1 +– cordova-js@4.1.4 | `– browserify@10.1.3 | `– glob@4.5.3 | `– minimatch@2.0.10 `– npm@2.15.11 `– minimatch@3.0.3 正如你所看到的,cordova的一个图书馆仍然坚持着这个古老的迷你游戏,如何摆脱它?

什么是最简单的方法前缀在JavaScript中的所有string与“!”(感叹号)?

当我想要包含或排除系统文件时,我使用了两个variables(使用minimatch glob语法,其中!表示排除)。 var systemFiles = ['node_modules/**/*', '.git/**/*']; var ignoredSystemFiles = ['!node_modules/**/*', '!.git/**/*']; 但是这感觉有点多余。 有没有一种简单的方法来将ignoredSystemFiles数组转换为ignoredSystemFiles数组(即:用!在ignoredSystemFiles所有项前缀)? 我知道!systemFiles不起作用,但是像这样紧凑的东西会很棒,因为它可以让我消除ignoredSystemFilesvariables。

包含所有的.d.ts,但是在gulp.src的glob上排除.ts

背景 在我的Angular2项目上编译我的Typescript文件之后,我将拥有以下目录结构(简化): ├── app │ └── app.module.d.ts │ └── app.module.js │ └── app.module.ts │ └── index.d.ts │ └── index.js │ └── index.ts │ └── sample.component.d.ts │ └── sample.component.js │ └── sample.component.ts │ └── sample.component.html │ └── sample.component.css 问题 使用gulp@3.9.1和gulp.src() ,我怎样才能创build一个glob数组,其中包括app文件夹下的所有文件,但忽略与.d.ts文件对应的.ts文件?

Globs&NPM Minimatch:除特定目录外,recursion匹配所有文件和目录

鉴于目录结构: /Users/doge/very/amaze.js /usr/local/bin/wow /node_modules/ /css/ /css/somefile.css /lib/ /somelib/ /anotherlib/somedir/finallib.js /index.html /somefile.test /somelib/file.html /firstdir/seconddir/file.css /node_modules.txt 我将如何仅使用extglob排除node_modules目录? /!(node_modules) 以上内容匹配除了node_modules目录和文本文件(我们希望包含的文件)之外的所有内容。 它也不会遵循recursion匹配的目录。 /!(node_modules)/** 这个更接近,但是它也排除了根目录中的所有文件。 即使它包含在根级别的文件,我猜它会排除node_modules.txt文件。 PS这是用于使用grunt-ssh和minimatch节点模块进行文件匹配。

如何用Grunt指定文件顺序?

我刚开始使用Grunt ,并试图获取concat任务,以特定的顺序连接我的文件。 这是我得到的: module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), concat: { options: { separator: ';' }, dist: { src: ['www/js/*.js','www/js/main.js','!**/*.{min,pack}.js','!<%= concat.dist.dest %>','!<%= uglify.dist %>'], dest: 'www/js/<%= pkg.name %>.js' } }, 我希望通过把www/js/main.js第二位,它会把文件移到列表的底部,但是看起来并不是这样。 我怎样才能在它匹配的文件列表上施加一些命令?

npm警告NOTsup SKIPPING可选依赖:不支持的平台fsevents@1.0.14

我试图运行这个项目https://github.com/Soundnode/soundnode-app更新我的minimatch版本3.10.9后,即时通讯这个错误 npm WARN可选SKIPPING可选依赖:fsevents@^1.0.0(node_modules \ webpack \ node_modules \ watchpack \ node_modules \ chokidar \ node_modules \ fsevents):npm WARN notsup SKIPPING可选依赖:fsevents@1.0.14不受支持的平台:wanted { os“:”darwin“,”arch“:”any“}(当前:{”os“:”win32“,”arch“:”ia32“}) 我的configuration是节点v – 4.4.2 npm v – 3.10.9即时通讯工作在32位的Windows操作系统

Glob / minimatch:如何gulp.src()的一切,然后排除文件夹,但保留一个文件

我有这样一个项目: root |-incl1 |-incl2 |- … |-excl1 |-excl2 |- .gitignore <– keep this one |- (other files) <– exclude them 我需要编写gulp.src() ,它将包含除excl1和excl2之外的所有文件夹, 但保留.gitignore文件。 这是我的代码不起作用: gulp.src([ baseDir + '/**', '!' + baseDir + '/{excl1, excl1/**}' '!' + baseDir + '/excl2/{**, !.gitignore}' // <– doesn't work ], {dot: true})