Tuesday, 1 March 2016

node.js - How to interpret the syntax for npm install?

From this answer I learned the importance of creating the file packages.json and putting in requirements for its dependencies. I do understand what the following two commands do and I've seen the effect of them in the file.



npm install require-dir --save-dev  
npm install lodash --save


I'm uncertain of a thing and it's the require-dir part. Is that a reserved word or something like that? Or are we free to use anything in order to create the entries in the packages.json file? Or am I reading it wrong and it's not "require-dir" but rather "require" and "dir" (or "-dir" maybe)?



And that leads me to the second part. I'm confused by the number of dashes in the syntax. Usually I see a single dash everywhere to indicate that something is a flag. E.g. npm install typescript -global. How should I interpret the double dash? Is it an empty flag in front of another flag (like -null-save) but compressed? Is it some kind of escape character?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...