Bahodir
Bahodir

Reputation: 539

How to extract version information of the dependencies

I was wondering is there a way to extract and print version information of all dependencies? For example I am using following dependencies:

"dependencies": {
    "angular2": "2.0.0-beta.15",
    "bu-controls": "^0.0.34",
    "es6-shim": "^0.35.0",
    "jquery": "^2.2.0",
    "moment": "2.14.1",
    "ms-signalr-client": "2.2.5",
    "ng2-translate": "^1.11.1",
    "numeral": "1.5.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.2",
    "systemjs": "~0.19.18",
    "underscore": "1.8.3",
    "zone.js": "0.6.10"
  }

So my task is to display version information on the browser for the clients. Thank you very much, in advance, for your help.

Upvotes: 1

Views: 10438

Answers (1)

Scrambo
Scrambo

Reputation: 629

Since you're using npm, you can redirect the output of the command npm list --depth=0 to a file, and then parse the file and display the contents on your webpage in the browser.

Here's an example of what npm list --depth=0 looks like in a project of mine.

+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected] invalid
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

Upvotes: 10

Related Questions