Commit cb8e21540b1e387e8686f3193fe9e9d47f78e018
Use optionalDependencies
- Include optionalDependencies in link and dep linking when publishing - Use optionalDependencies when link has itcel committed on 9/3/2018, 2:55:22 AM
Parent: 257cfa8e8dc77dd00e22c248de7e22a51c630528
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -166,8 +166,11 @@ | |||
166 | 166 … | var done = multicb() | |
167 | 167 … | for (var name in pkg.dependencies || {}) { | |
168 | 168 … | addPkgBySpec(name, pkg.dependencies[name], done()) | |
169 | 169 … | } | |
170 … | + for (var name in pkg.optionalDependencies || {}) { | ||
171 … | + addPkgBySpec(name, pkg.optionalDependencies[name], done()) | ||
172 … | + } | ||
170 | 173 … | done(cb) | |
171 | 174 … | }) | |
172 | 175 … | } | |
173 | 176 … | ||
@@ -1026,8 +1029,9 @@ | |||
1026 | 1029 … | linksByVersion[version] = link | |
1027 | 1030 … | link.version = version | |
1028 | 1031 … | link.license = pkg.license | |
1029 | 1032 … | link.dependencies = pkg.dependencies || {} | |
1033 … | + link.optionalDependencies = pkg.optionalDependencies | ||
1030 | 1034 … | link.bundledDependencies = pkg.bundledDependencies || pkg.bundleDependencies | |
1031 | 1035 … | } | |
1032 | 1036 … | ||
1033 | 1037 … | // associate blobs with dist-tags | |
@@ -1052,8 +1056,9 @@ | |||
1052 | 1056 … | size: link.size, | |
1053 | 1057 … | shasum: link.shasum, | |
1054 | 1058 … | license: link.license, | |
1055 | 1059 … | dependencies: link.dependencies, | |
1060 … | + optionalDependencies: link.optionalDependencies, | ||
1056 | 1061 … | bundledDependencies: link.bundledDependencies, | |
1057 | 1062 … | }) | |
1058 | 1063 … | } | |
1059 | 1064 … | return self.publishPkgs(mentions) | |
@@ -1073,17 +1078,18 @@ | |||
1073 | 1078 … | ||
1074 | 1079 … | Req.prototype.populatePackageJson = function (obj, cb) { | |
1075 | 1080 … | var self = this | |
1076 | 1081 … | var blobId = obj.dist.tarball.replace(/.*\/blobs\/get\//, '') | |
1077 | - var deps, bundledDeps, shasum, license | ||
1082 … | + var deps, optionalDeps, bundledDeps, shasum, license | ||
1078 | 1083 … | ||
1079 | 1084 … | // look for dependencies and other properties in links. | |
1080 | 1085 … | // then fallback to getting it from the tarball blob | |
1081 | 1086 … | ||
1082 | 1087 … | pull( | |
1083 | 1088 … | self.getMentionLinks(blobId), | |
1084 | 1089 … | pull.drain(function (link) { | |
1085 | 1090 … | if (link.dependencies) deps = link.dependencies | |
1091 … | + if (link.optionalDependencies) optionalDeps = link.optionalDependencies | ||
1086 | 1092 … | if (link.shasum) shasum = link.shasum | |
1087 | 1093 … | if (link.license) license = link.license | |
1088 | 1094 … | bundledDeps = link.bundledDependencies || link.bundleDependencies || bundledDeps | |
1089 | 1095 … | // how to handle multiple assignments of dependencies to a package? | |
@@ -1092,8 +1098,9 @@ | |||
1092 | 1098 … | if (deps && (shasum || !self.needShasum)) { | |
1093 | 1099 … | // assume that the dependencies in the links to the blob are | |
1094 | 1100 … | // correct. | |
1095 | 1101 … | obj.dependencies = deps | |
1102 … | + obj.optionalDependencies = optionalDeps | ||
1096 | 1103 … | obj.bundledDependencies = bundledDeps | |
1097 | 1104 … | obj.license = license | |
1098 | 1105 … | if (shasum) obj.dist.shasum = obj._shasum = shasum | |
1099 | 1106 … | next(obj) |
Built with git-ssb-web