node.js - npm script parameters
伊谢尔伦
伊谢尔伦 2017-06-08 11:02:34
0
1
786
{
    "scripts": {
        "lint": "eslint src tools && jscs src tools --verbose",
        "csslint": "csscomb src/components --lint --verbose",
}

The above code is just an example. What I want to ask is what does the parameter passed later mean relative to the script? Are the parameter names customized? Is the way to pass parameters through CLI the writing format of npm run lint -- --verbose?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
黄舟

cli is missing a run, right?
You can refer to this article by Ruan Yifeng

http://www.ruanyifeng.com/blo...

Add the usage of passing parameters: I have never used lint. Let me talk about my local experiment. First of all, the basic usage I want to use is to use the command line

$ qls init
$ qls run

Then I switched to package.json:

{
  "name": "d",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "run": "qls"
  },
  "author": "",
  "license": "ISC"
}

If I just npm run run actually only execute the qls method in the end, but as I said earlier, my command line needs to take other sub-commands or parameters, then I can pass them in through --, as follows:

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template