简体   繁体   中英

Get package.json of package using HTTP from public repositories

Maybe this question has already been asked but after a bit of googling I haven't found anything reasonable.

The main goal I'm trying to achieve is to obtain a dependency tree of a specific npmjs library of specific version eg obtain dependency tree of library angular of version 1.5.3

Now, I would like to use HTTP requests for this as much as possible instead of launching npm on server-side or using some js library code for that.

What I've found out is:

  1. From http://registry.npmjs.org/package-name one could get all metadata for the specific package as well as list of available versions eg http://registry.npmjs.org/angular
  2. From http://registry.npmjs.org/package-name/package-version I could get all metadata for the specific package of specific version eg http://registry.npmjs.org/angular/1.5.3

Now, what I'm struggling to find is how to obtain package.json of specific library and specific version because http://registry.npmjs.org/angular/1.5.3/package.json doesn't contain anything

Thanks a lot in advance for any hints!

Ok, it turns that list of dependencies is actually present in file with metadata for the whole package ( located in http://registry.npmjs.org/package-name ).

It's located in versions -> [version-id] -> dependencies , devDependencies and optionalDependencies properties.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM