Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Attach readme contents to packages in more situations

  • Loading branch information...
commit d80d665c8568df7a9d92bd5f5ed041e6512ce49a 1 parent 1395630
@isaacs isaacs authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/utils/npm-registry-client/publish.js
View
11 lib/utils/npm-registry-client/publish.js
@@ -13,7 +13,7 @@ var request = require("./request.js")
, url = require("url")
function publish (data, prebuilt, readme, cb) {
- if (typeof readme === "function") cb = readme, readme = null
+ if (typeof readme === "function") cb = readme, readme = ""
if (typeof prebuilt === "function") cb = prebuilt, prebuilt = null
// add the dist-url to the data, pointing at the tarball.
// if the {name} isn't there, then create it.
@@ -23,13 +23,15 @@ function publish (data, prebuilt, readme, cb) {
var registry = reg()
if (registry instanceof Error) return cb(registry)
+ readme = readme ? "" + readme : ""
+
var fullData =
{ _id : data.name
, name : data.name
, description : data.description
, "dist-tags" : {}
, versions : {}
- , readme: readme ? "" + readme : null
+ , readme: readme
, maintainers :
[ { name : npm.config.get("username")
, email : npm.config.get("email")
@@ -103,6 +105,11 @@ function publish (data, prebuilt, readme, cb) {
})
}
+ // this way, it'll also get attached to packages that were previously
+ // published with a version of npm that lacked this feature.
+ if (!fullData.readme) {
+ data.readme = readme
+ }
PUT(dataURI, data, function (er) {
if (er) {
if (er.message.indexOf("conflict Document update conflict.") === 0) {
Please sign in to comment.
Something went wrong with that request. Please try again.