Glob wildcards in windows npm

℡╲_俬逩灬. 提交于 2019-12-03 07:16:21
Jon Coombs

I don't think you're doing anything wrong; this is basically a limitation of the Windows shell/console/command prompt, although browserify could be 'improved' to sidestep that and use glob / node-glob instead. I'm not sure about browserify, but jshint is similar.

Some ideas:

Just guessing, but there might also be a way to

  • use PowerShell (which comes with recent versions of Windows--see the Get-ChildItem command)

  • or Hamilton C shell (uses ... instead of **, I think), or something else, as your shell.

  • use a loop with /r for recursing into subfolders. I'm not recommending this--Windows-specific, not very chainable--but the 'wint' command set up below does 'work' (invoke with npm run wint) if I include the following in my package.json file.

loop for Windows (Note: redirecting the output below to a file isn't a simple > because ...do jshint %f > chk.txt will overwrite itself and ...do jshint %f > %f.chk.txt may generate many chk.txt files sprinkled around):

"scripts": {
  "lint": "jshint **.js",
  "wint": "for /r %f in (*.js) do jshint %f",
},

But the commands above would generally not be usable cross-platform. Also, using an alternative shell, you don't benefit by default from being able to shift+right-click on a folder and "Open command window here".

Related:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!