git ssb

3+

cel / ssb-npm-registry



Commit cb8e21540b1e387e8686f3193fe9e9d47f78e018

Use optionalDependencies

- Include optionalDependencies in link and dep linking when publishing
- Use optionalDependencies when link has it
cel committed on 9/3/2018, 2:55:22 AM
Parent: 257cfa8e8dc77dd00e22c248de7e22a51c630528

Files changed

index.jschanged
index.jsView
@@ -166,8 +166,11 @@
166166 var done = multicb()
167167 for (var name in pkg.dependencies || {}) {
168168 addPkgBySpec(name, pkg.dependencies[name], done())
169169 }
170 + for (var name in pkg.optionalDependencies || {}) {
171 + addPkgBySpec(name, pkg.optionalDependencies[name], done())
172 + }
170173 done(cb)
171174 })
172175 }
173176
@@ -1026,8 +1029,9 @@
10261029 linksByVersion[version] = link
10271030 link.version = version
10281031 link.license = pkg.license
10291032 link.dependencies = pkg.dependencies || {}
1033 + link.optionalDependencies = pkg.optionalDependencies
10301034 link.bundledDependencies = pkg.bundledDependencies || pkg.bundleDependencies
10311035 }
10321036
10331037 // associate blobs with dist-tags
@@ -1052,8 +1056,9 @@
10521056 size: link.size,
10531057 shasum: link.shasum,
10541058 license: link.license,
10551059 dependencies: link.dependencies,
1060 + optionalDependencies: link.optionalDependencies,
10561061 bundledDependencies: link.bundledDependencies,
10571062 })
10581063 }
10591064 return self.publishPkgs(mentions)
@@ -1073,17 +1078,18 @@
10731078
10741079 Req.prototype.populatePackageJson = function (obj, cb) {
10751080 var self = this
10761081 var blobId = obj.dist.tarball.replace(/.*\/blobs\/get\//, '')
1077- var deps, bundledDeps, shasum, license
1082 + var deps, optionalDeps, bundledDeps, shasum, license
10781083
10791084 // look for dependencies and other properties in links.
10801085 // then fallback to getting it from the tarball blob
10811086
10821087 pull(
10831088 self.getMentionLinks(blobId),
10841089 pull.drain(function (link) {
10851090 if (link.dependencies) deps = link.dependencies
1091 + if (link.optionalDependencies) optionalDeps = link.optionalDependencies
10861092 if (link.shasum) shasum = link.shasum
10871093 if (link.license) license = link.license
10881094 bundledDeps = link.bundledDependencies || link.bundleDependencies || bundledDeps
10891095 // how to handle multiple assignments of dependencies to a package?
@@ -1092,8 +1098,9 @@
10921098 if (deps && (shasum || !self.needShasum)) {
10931099 // assume that the dependencies in the links to the blob are
10941100 // correct.
10951101 obj.dependencies = deps
1102 + obj.optionalDependencies = optionalDeps
10961103 obj.bundledDependencies = bundledDeps
10971104 obj.license = license
10981105 if (shasum) obj.dist.shasum = obj._shasum = shasum
10991106 next(obj)

Built with git-ssb-web