Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's mean of npm scripts two dahses?

These scripts have two dashes expression. (e.g. server:dev -- --inline --hot)

"server:dev:hmr": "npm run server:dev -- --inline --hot",
"server:dev": "npm run webpack-dev-server -- --config config/webpack.dev.js --open --progress --profile --watch --content-base src/",
"server:prod": "http-server dist -c-1 --cors",
"server:prod:ci": "http-server dist -p 3000 -c-1 --cors",
"server": "npm run server:dev",
"start:hmr": "npm run server:dev:hmr",
"start": "concurrently \"npm run server:dev\" \"nodemon --watch server server-start.js\" ",

What is the meaning of these two dashes? And what's the name of this expression?

like image 220
한건호 Avatar asked Jun 25 '17 05:06

한건호


People also ask

What are 2 uses of npm?

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently. It is extremely configurable to support a wide variety of use cases. Most commonly, it is used to publish, discover, install, and develop node programs.

What are scripts in npm?

An npm script is a convenient way to bundle common shell commands for your project. They are typically commands, or a string of commands, which would normally be entered at the command line in order to do something with your application. Scripts are stored in a project's package.


1 Answers

It's a way to pass arguments to npm-run-script.

npm run <command> [-- <args>]

From the docs:

As of [email protected], you can use custom arguments when executing scripts. The special option -- is used by getopt to delimit the end of the options. npm will pass all the arguments after the -- directly to your script:

npm run test -- --grep="pattern"
like image 112
Saugat Avatar answered Oct 21 '22 03:10

Saugat