Permalink
Browse files

Closes GH-575 Add the --pre flag

This allows publishing pre-release versions of a package,
by telling the registry to suppress the auto-tagging
feature.
  • Loading branch information...
1 parent 9cc1363 commit d82850982cd9f3f35e2627c026a8cf6e372e39cf @isaacs isaacs committed Feb 19, 2011
Showing with 3 additions and 0 deletions.
  1. +1 −0 lib/utils/default-config.js
  2. +1 −0 lib/utils/parse-args.js
  3. +1 −0 lib/utils/registry/publish.js
@@ -37,6 +37,7 @@ module.exports =
, "node-version" : process.version
, "onload-script" : false
, outfd : stdio.stdoutFD
+ , pre: false
, proxy : process.env.HTTP_PROXY || process.env.http_proxy || null
, prune : undefined // if set to boolean false, then that means "never"
, "rebuild-bundle" : true
View
@@ -38,6 +38,7 @@ exports.types =
, "node-version" : String
, "onload-script" : [false, String]
, outfd : [Number, Stream]
+ , pre: Boolean
, proxy : url
, prune : Boolean
, "rebuild-bundle" : Boolean
@@ -59,6 +59,7 @@ function publish (data, cb) {
return log.er(cb, "Failed PUT response "+(response && response.statusCode))(er)
}
var dataURI = encodeURIComponent(data.name)+"/"+encodeURIComponent(data.version)
+ if (npm.config.get("pre")) dataURI += "/-pre/true"
PUT(dataURI, data, function (er) {
if (er) {
if (er.message.indexOf("conflict Document update conflict.") === 0) {

8 comments on commit d828509

Contributor

tj replied Feb 19, 2011

wahoo! what was the auto-tagging feature? can people add dependencies on pre-released stuff?

Owner

isaacs replied Feb 19, 2011

The server-side portion of this change is here: npm/npm-registry-couchapp@2fdb128

Stuff published with --pre will still be public, it just won't get the "latest" tag. So, yeah, it's out there, you can depend on it, instal it, etc. It's just not the default.

Owner

isaacs replied Feb 19, 2011

Also: I don't love this config name, because it's a bit vague. That's why it's still undocumented. Let's play with it for a bit, and see how it goes. I'm thinking it might make sense to change it so that the auto-tag is set to the value of the tag config param, and then you could do --no-tag to suppress tagging altogether.

Then, a bunch of people could do npm config set tag learnboost, and everything you publish will be tagged with learnboost and doing npm install foo would be like doing npm install foo@learnboost, just making that the magic instead of latest.

Contributor

tj replied Feb 21, 2011

cool thanks man, I will try it out soon

Contributor

tj replied Feb 21, 2011

when I publish with "version": "2.0.0-pre" it still gets pulled as the latest

Owner

isaacs replied Feb 21, 2011

Do npm publish --pre. It doesn't sniff for magic on the version number itself.

Contributor

tj replied Feb 21, 2011

oh :p would be cool if it did. I dont want to update npm yet since I cant use the new one to publish stuff for 0.2.x

Contributor

tj replied Feb 21, 2011

or even "pre": true in the package.json

Please sign in to comment.