Glob keys in npm windows

I am trying to get npm to build a browser in a script folder. The problem is that I am in the windows and making the / * folder. Js doesn't seem to work. I tried to install glob globally, but whenever I run the build command, an error appears: "I can not find the module" c: \ www \ project \ static \ js \ components * .js'.

Here is my .json package:

{ "name": "TEST", "description": "ITS ME MARIO", "author": "JJ", "version": "0.0.1", "dependencies": { "connect": "1.8.5", "express": "2.5.2", "jade": "0.20.0", "mongoose": "3.8.x", "socket.io": "0.8.7" }, "devDependencies": { "vows": "0.5.x", "mocha": "*", "should": "*", "jshint": "latest", "browserify": "latest", "rimraf": "latest", "hashmark": "latest", "stylus": "latest", "glob": "latest" }, "scripts": { "clean": "rimraf dist", "test": "mocha test/", "build:components-js": "browserify static/js/components/*.js > static/dist/components.js", "build:app-js": "browserify static/js/script > static/dist/app.js", "build:css": "stylus static/css/style.styl > static/dist/main.css", "build": "npm run build:css && npm run build:components-js && npm run build:app-js" }, "engine": "node >= 0.6.6" } 

Does anyone know what I'm doing wrong?

+6
source share
1 answer

I do not think that you are doing something wrong; this is basically a limitation of the windows shell / console / command line, although the browser can be "improved" to get around this and use glob / node-global. I'm not sure about the browser, but jshint is similar.

Some ideas:

Just guessing, but maybe a way

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

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

  • use a loop with /r to recurse into subfolders. I do not recommend this - Windows-specific, not very complete, but the wint command installed below "works" (called 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 is not easy > because ...do jshint %f > chk.txt will overwrite itself, but ...do jshint %f > %f.chk.txt can generate many chk.txt files that sprinkle):

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

But the above commands usually cannot be used cross-platform. In addition, using an alternative shell, by default you cannot use shift+right-click in the folder and "Open the command window here."

on this topic:

+8
source

Source: https://habr.com/ru/post/980012/


All Articles