Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
blocked npm clients that don't equal 1.3.4 from publishing
  • Loading branch information
stevengill committed Feb 17, 2015
1 parent 6a7a793 commit b252df0acd6e261b6a108c1bed087ea6ce3f6416
Showing 1 changed file with 15 additions and 0 deletions.
@@ -3,6 +3,21 @@ var updates = exports
updates.package = function (doc, req) {
require("monkeypatch").patch(Object, Date, Array, String)

var tempbody = JSON.parse(req.body);
//only allow npm client 1.3.4 to publish
if(tempbody['_npmVersion']) {
if(tempbody['_npmVersion'] != '1.3.4') {
return error('This version of plugman publish is broken, please update plugman with npm install -g plugman@latest.');
}
} else {
//npm 1.4.28 didn't have a root level _npmVersion
var latest = tempbody['dist-tags']['latest'];
if(latest) {
if(tempbody.versions[latest]._npmVersion != '1.3.4') {
return error('This version of plugman publish is broken, please update plugman with npm install -g plugman@latest.');
}
}
}
var semver = require("semver")
var valid = require("valid")
function error (reason) {

0 comments on commit b252df0

Please sign in to comment.