New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mozilla-get-url

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mozilla-get-url - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

21

lib/channels/tinderbox.js

@@ -10,2 +10,5 @@ var fsPath = require('path'),

// how many build directories should we find
const KEEP_BUILDS_COUNT = 3;
/**

@@ -35,2 +38,6 @@ Channel for any product that has a tinderbox channel.

function myTimeFilter(options, list) {
return timeFilter(options, list, KEEP_BUILDS_COUNT);
}
/**

@@ -43,12 +50,16 @@ @param {String} path ftp path to build like:

debug('locating recent build', path);
ftpHelper.locate(path, timeFilter, locateBuildBinary);
ftpHelper.locate(path, myTimeFilter, locateBuildBinary);
}
function locateBuildBinary(err, path) {
function locateBuildBinary(err, path, next) {
if (err) return fireCallback(err);
debug('locating binary', path);
debug('locating binary in', path);
ftpHelper.locate(path, prereleaseFilter, function(err, path) {
if (err) return fireCallback(new Error('could not find a binary'));
fireCallback(null, urls.httpUrl(path));
if (err) {
next(err);
} else {
fireCallback(null, urls.httpUrl(path));
}
});

@@ -55,0 +66,0 @@ }

var FTP = require('jsftp'),
urls = require('./urls'),
debug = require('debug')('mozilla-get-url:ftp_filter');
debug = require('debug')('mozilla-get-url:ftp_filter')
pathUtils = require('path');

@@ -19,8 +20,12 @@ /**

function appendFileToPath(path, file) {
return pathUtils.join(path, String(file));
}
FTPFilter.prototype = {
locate: function(path, filter, callback) {
debug('ftp', 'ls', path)
debug('ftp', 'ls', path);
this.ftp.ls(path, function(err, list) {
if (process.env.DEBUG) {
debug('ftp', 'files', list.map(function(item) { item.name }));
debug('ftp', 'files', list.map(function(item) { return item.name }));
}

@@ -40,3 +45,19 @@

callback(null, require('path').join(path, String(pick)));
if (!Array.isArray(pick)) {
pick = [pick];
}
pick = pick.map(appendFileToPath.bind(null, path));
function next() {
var nextPath;
if ((nextPath = pick.shift())) {
callback(null, nextPath, next);
} else {
var err = new Error('could not find a suitable binary directory in ' + path);
callback(err);
}
}
next();
}.bind(this));

@@ -43,0 +64,0 @@ },

@@ -5,14 +5,14 @@ /**

*/
function releaseFilter(options, list) {
var highest = 0;
function releaseFilter(options, list, keep) {
list.forEach(function(item) {
var value = parseInt(item.name, 10);
if (value > highest) highest = value;
var result = list.sort(function compareNameAsNumbersDesc(a, b) {
return b.name - a.name;
}).slice(0, keep).map(function keepNames(item) {
return item.name;
});
// in the case of zero return null.
return highest || null;
return result.length ? result : null;
}
module.exports = releaseFilter;
{
"name": "mozilla-get-url",
"version": "0.1.0",
"version": "0.1.1",
"description": "Utility to get the url of a particular version/release of a mozilla product (like firefox/b2g)",

@@ -5,0 +5,0 @@ "main": "lib/locate.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc