Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

crates-updater

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crates-updater - npm Package Compare versions

Comparing version 0.4.0 to 1.0.0

10

CHANGELOG.md

@@ -0,1 +1,11 @@

# [1.0.0](https://github.com/ffflorian/crates-updater/compare/v0.4.0...v1.0.0) (2019-07-17)
### Features
- Set ES6 as target and require Node >= 10.9 ([#105](https://github.com/ffflorian/crates-updater/issues/105)) ([1c1b214](https://github.com/ffflorian/crates-updater/commit/1c1b214))
### BREAKING CHANGES
- Node.js >= 10.9 is required.
# [0.4.0](https://github.com/ffflorian/crates-updater/compare/v0.3.0...v0.4.0) (2019-05-27)

@@ -2,0 +12,0 @@

20

dist/cli.js
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var program = require("commander");
var CratesUpdater_1 = require("./CratesUpdater");
var _a = require('../package.json'), name = _a.name, version = _a.version, description = _a.description;
const program = require("commander");
const CratesUpdater_1 = require("./CratesUpdater");
const { name, version, description } = require('../package.json');
program

@@ -18,15 +18,15 @@ .name(name)

}
var cratesUpdater = new CratesUpdater_1.CratesUpdater();
const cratesUpdater = new CratesUpdater_1.CratesUpdater();
if (program.package && program.packageVersion) {
cratesUpdater
.checkForUpdate(program.package, program.packageVersion)
.then(function (version) {
.then(version => {
if (version) {
console.log("An update for " + program.package + " is available: " + version + ".");
console.log(`An update for ${program.package} is available: ${version}.`);
}
else {
console.log("No update for " + program.package + " available.");
console.log(`No update for ${program.package} available.`);
}
})
.catch(function (error) {
.catch(error => {
console.error(error);

@@ -39,4 +39,4 @@ process.exit(1);

.getLatestVersion(program.package)
.then(function (version) { return console.log(version.num); })
.catch(function (error) {
.then(version => console.log(version.num))
.catch(error => {
console.error(error);

@@ -43,0 +43,0 @@ process.exit(1);

@@ -10,81 +10,32 @@ "use strict";

};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var compareVersions = require("compare-versions");
var crates_io_1 = require("crates.io");
var CratesUpdater = /** @class */ (function () {
function CratesUpdater() {
const compareVersions = require("compare-versions");
const crates_io_1 = require("crates.io");
class CratesUpdater {
constructor() {
this.cratesIO = new crates_io_1.CratesIO();
}
CratesUpdater.prototype.getVersions = function (packageName) {
return __awaiter(this, void 0, void 0, function () {
var versions;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.cratesIO.api.crates.getVersions(packageName)];
case 1:
versions = (_a.sent()).versions;
return [2 /*return*/, versions];
}
});
getVersions(packageName) {
return __awaiter(this, void 0, void 0, function* () {
const { versions } = yield this.cratesIO.api.crates.getVersions(packageName);
return versions;
});
};
CratesUpdater.prototype.getLatestVersion = function (packageName) {
return __awaiter(this, void 0, void 0, function () {
var versions;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getVersions(packageName)];
case 1:
versions = _a.sent();
return [2 /*return*/, versions.sort(function (a, b) { return compareVersions(a.num, b.num); }).pop()];
}
});
}
getLatestVersion(packageName) {
return __awaiter(this, void 0, void 0, function* () {
const versions = yield this.getVersions(packageName);
return versions.sort((a, b) => compareVersions(a.num, b.num)).pop();
});
};
CratesUpdater.prototype.checkForUpdate = function (packageName, version) {
return __awaiter(this, void 0, void 0, function () {
var latestVersion;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getLatestVersion(packageName)];
case 1:
latestVersion = _a.sent();
if (compareVersions(latestVersion.num, version) > 0) {
return [2 /*return*/, latestVersion.num];
}
return [2 /*return*/, null];
}
});
}
checkForUpdate(packageName, version) {
return __awaiter(this, void 0, void 0, function* () {
const latestVersion = yield this.getLatestVersion(packageName);
if (compareVersions(latestVersion.num, version) > 0) {
return latestVersion.num;
}
return null;
});
};
return CratesUpdater;
}());
}
}
exports.CratesUpdater = CratesUpdater;
//# sourceMappingURL=CratesUpdater.js.map

@@ -9,22 +9,25 @@ {

"commander": "2.20.0",
"compare-versions": "3.4.0",
"crates.io": "0.3.12"
"compare-versions": "3.5.0",
"crates.io": "0.4.1"
},
"description": "Check your Rust packages for updates.",
"devDependencies": {
"@ffflorian/prettier-config": "0.0.4",
"@ffflorian/tslint-config": "0.2.1",
"@semantic-release/changelog": "3.0.2",
"@semantic-release/git": "7.0.8",
"@ffflorian/prettier-config": "0.0.5",
"@ffflorian/tslint-config": "0.4.0",
"@semantic-release/changelog": "3.0.4",
"@semantic-release/git": "7.0.16",
"@types/node": "~12",
"husky": "2.3.0",
"lint-staged": "8.1.7",
"prettier": "1.17.1",
"husky": "3.0.0",
"lint-staged": "9.2.0",
"prettier": "1.18.2",
"rimraf": "2.6.3",
"semantic-release": "15.13.12",
"tslint": "5.16.0",
"semantic-release": "15.13.18",
"tslint": "5.18.0",
"tslint-config-prettier": "1.18.0",
"tslint-plugin-prettier": "2.0.1",
"typescript": "3.4.5"
"typescript": "3.5.3"
},
"engines": {
"node": ">= 10.9"
},
"files": [

@@ -73,3 +76,3 @@ "dist"

},
"version": "0.4.0"
"version": "1.0.0"
}

@@ -1,2 +0,2 @@

# crates-updater [![npm version](https://img.shields.io/npm/v/crates-updater.svg?style=flat)](https://www.npmjs.com/package/crates-updater) [![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=ffflorian/crates-updater)](https://dependabot.com)
# crates-updater [![Build Status](https://action-badges.now.sh/ffflorian/crates-updater)](https://github.com/ffflorian/crates-updater/actions/) [![npm version](https://img.shields.io/npm/v/crates-updater.svg?style=flat)](https://www.npmjs.com/package/crates-updater) [![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=ffflorian/crates-updater)](https://dependabot.com)

@@ -3,0 +3,0 @@ Check your [Rust packages](https://crates.io) for updates.

Sorry, the diff of this file is not supported yet

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