Commit 257cfa8e8dc77dd00e22c248de7e22a51c630528
Handle license property in package link
cel committed on 9/3/2018, 2:13:37 AMParent: 1d78bcde8d9f2130394a1832348d805fe9b77467
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -1073,18 +1073,19 @@ | ||
1073 | 1073 … | |
1074 | 1074 … | Req.prototype.populatePackageJson = function (obj, cb) { |
1075 | 1075 … | var self = this |
1076 | 1076 … | var blobId = obj.dist.tarball.replace(/.*\/blobs\/get\//, '') |
1077 | - var deps, bundledDeps, shasum | |
1077 … | + var deps, bundledDeps, shasum, license | |
1078 | 1078 … | |
1079 | - // look for dependencies in links. | |
1079 … | + // look for dependencies and other properties in links. | |
1080 | 1080 … | // then fallback to getting it from the tarball blob |
1081 | 1081 … | |
1082 | 1082 … | pull( |
1083 | 1083 … | self.getMentionLinks(blobId), |
1084 | 1084 … | pull.drain(function (link) { |
1085 | 1085 … | if (link.dependencies) deps = link.dependencies |
1086 | 1086 … | if (link.shasum) shasum = link.shasum |
1087 … | + if (link.license) license = link.license | |
1087 | 1088 … | bundledDeps = link.bundledDependencies || link.bundleDependencies || bundledDeps |
1088 | 1089 … | // how to handle multiple assignments of dependencies to a package? |
1089 | 1090 … | }, function (err) { |
1090 | 1091 … | if (err) return cb(new Error(err.stack || err)) |
@@ -1092,8 +1093,9 @@ | ||
1092 | 1093 … | // assume that the dependencies in the links to the blob are |
1093 | 1094 … | // correct. |
1094 | 1095 … | obj.dependencies = deps |
1095 | 1096 … | obj.bundledDependencies = bundledDeps |
1097 … | + obj.license = license | |
1096 | 1098 … | if (shasum) obj.dist.shasum = obj._shasum = shasum |
1097 | 1099 … | next(obj) |
1098 | 1100 … | } else { |
1099 | 1101 … | // get dependencies from the tarball |
Built with git-ssb-web