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.1.0 to 0.2.0

7

dist/cli.js

@@ -12,14 +12,13 @@ #!/usr/bin/env node

.option('-V, --package-version <version>', 'which version to check')
.option('-k, --api-key <key>', 'set the API key for libraries.io (required)')
.version(version, '-v, --version')
.parse(process.argv);
if (!program.options.length || !program.apiKey || !program.package) {
if (!program.options.length || !program.package) {
program.outputHelp();
process.exit(1);
}
var cratesUpdater = new CratesUpdater_1.CratesUpdater(program.apiKey);
var cratesUpdater = new CratesUpdater_1.CratesUpdater();
if (program.package && !program.packageVersion) {
cratesUpdater
.getLatestVersion(program.package)
.then(function (version) { return console.log(version.number); })
.then(function (version) { return console.log(version.num); })
.catch(function (error) {

@@ -26,0 +25,0 @@ console.error(error);

@@ -1,9 +0,9 @@

import { ProjectVersion } from 'libraries.io';
import { Version as CrateVersion } from 'crates.io';
declare class CratesUpdater {
private readonly librariesIO;
constructor(apiKey: string);
getVersions(packageName: string): Promise<ProjectVersion[]>;
getLatestVersion(packageName: string): Promise<ProjectVersion>;
private readonly cratesIO;
constructor();
getVersions(packageName: string): Promise<CrateVersion[]>;
getLatestVersion(packageName: string): Promise<CrateVersion>;
checkForUpdate(packageName: string, version: string): Promise<string | null>;
}
export { CratesUpdater };

@@ -39,6 +39,6 @@ "use strict";

var compareVersions = require("compare-versions");
var libraries_io_1 = require("libraries.io");
var crates_io_1 = require("crates.io");
var CratesUpdater = /** @class */ (function () {
function CratesUpdater(apiKey) {
this.librariesIO = new libraries_io_1.LibrariesIO(apiKey);
function CratesUpdater() {
this.cratesIO = new crates_io_1.CratesIO();
}

@@ -50,6 +50,6 @@ CratesUpdater.prototype.getVersions = function (packageName) {

switch (_a.label) {
case 0: return [4 /*yield*/, this.librariesIO.api.project.getProject('cargo', packageName)];
case 0: return [4 /*yield*/, this.cratesIO.api.crates.getVersions(packageName)];
case 1:
result = _a.sent();
return [2 /*return*/, result.data.versions];
return [2 /*return*/, result.versions];
}

@@ -67,3 +67,3 @@ });

versions = _a.sent();
sorted = versions.sort(function (a, b) { return compareVersions(a.number, b.number); });
sorted = versions.sort(function (a, b) { return compareVersions(a.num, b.num); });
return [2 /*return*/, sorted[versions.length - 1]];

@@ -82,4 +82,4 @@ }

latestVersion = _a.sent();
if (compareVersions(latestVersion.number, version) > 0) {
return [2 /*return*/, latestVersion.number];
if (compareVersions(latestVersion.num, version) > 0) {
return [2 /*return*/, latestVersion.num];
}

@@ -86,0 +86,0 @@ return [2 /*return*/, null];

@@ -11,7 +11,7 @@ {

"compare-versions": "3.4.0",
"libraries.io": "1.2.2"
"crates.io": "0.1.0"
},
"description": "Check your Rust packages for updates.",
"devDependencies": {
"@types/node": "11.10.4",
"@types/node": "11.10.5",
"husky": "1.3.1",

@@ -36,3 +36,2 @@ "lint-staged": "8.1.5",

"typescript",
"librariesio",
"cratesio",

@@ -66,3 +65,3 @@ "rust",

},
"version": "0.1.0"
"version": "0.2.0"
}

@@ -19,3 +19,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)

-V, --package-version <version> which version to check
-k, --api-key <key> set the API key for libraries.io (required)
-v, --version output the version number

@@ -29,6 +28,6 @@ -h, --help output usage information

# returns either a newer version or nothing
crates-updater -p ripgrep -V 0.9.0 -k <api key>
crates-updater -p ripgrep -V 0.9.0
# returns the latest version
crates-updater -p ripgrep -k <api key>
crates-updater -p ripgrep
```

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