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

crates-updater

Package Overview
Dependencies
Maintainers
0
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 1.7.4 to 1.7.5

17

dist/cjs/cli.js
#!/usr/bin/env node
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { program as commander } from 'commander';

@@ -30,6 +21,6 @@ import { createRequire } from 'module';

const commanderOptions = commander.opts();
void (() => __awaiter(void 0, void 0, void 0, function* () {
void (async () => {
try {
if (packageVersion) {
const version = yield CratesUpdater.checkForUpdate(packageName, packageVersion);
const version = await CratesUpdater.checkForUpdate(packageName, packageVersion);
if (commanderOptions.quiet) {

@@ -48,3 +39,3 @@ if (version) {

else {
const version = yield CratesUpdater.getLatestVersion(packageName);
const version = await CratesUpdater.getLatestVersion(packageName);
const text = commanderOptions.quiet ? version.num : `Latest ${packageName} version is ${version.num}.`;

@@ -59,2 +50,2 @@ console.info(text);

}
}))();
})();

@@ -1,33 +0,18 @@

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { compareVersions } from 'compare-versions';
import { CratesIO } from 'crates.io';
const cratesIO = new CratesIO();
export function checkForUpdate(packageName, version) {
return __awaiter(this, void 0, void 0, function* () {
const latestVersion = yield getLatestVersion(packageName);
if (compareVersions(latestVersion.num, version) > 0) {
return latestVersion.num;
}
return null;
});
export async function checkForUpdate(packageName, version) {
const latestVersion = await getLatestVersion(packageName);
if (compareVersions(latestVersion.num, version) > 0) {
return latestVersion.num;
}
return null;
}
export function getLatestVersion(packageName) {
return __awaiter(this, void 0, void 0, function* () {
const versions = yield getVersions(packageName);
return versions.sort((versionA, versionB) => compareVersions(versionA.num, versionB.num)).pop();
});
export async function getLatestVersion(packageName) {
const versions = await getVersions(packageName);
return versions.sort((versionA, versionB) => compareVersions(versionA.num, versionB.num)).pop();
}
export function getVersions(packageName) {
return __awaiter(this, void 0, void 0, function* () {
const { versions } = yield cratesIO.api.crates.getVersions(packageName);
return versions;
});
export async function getVersions(packageName) {
const { versions } = await cratesIO.api.crates.getVersions(packageName);
return versions;
}

@@ -15,3 +15,3 @@ {

"rimraf": "5.0.7",
"typescript": "5.4.5"
"typescript": "5.5.2"
},

@@ -51,4 +51,4 @@ "engines": {

"type": "module",
"version": "1.7.4",
"gitHead": "28c184f53a87d8eb082cc27c923ef7b352bbe875"
"version": "1.7.5",
"gitHead": "f7a6a79286e4eb85392b5f2d33942ab166142109"
}
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