crates-updater
Advanced tools
Comparing version 1.2.0 to 1.2.1
67
cli.js
#!/usr/bin/env node | ||
"use strict"; | ||
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()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const program = require("commander"); | ||
const commander_1 = require("commander"); | ||
const fs = require("fs"); | ||
@@ -13,3 +22,3 @@ const path = require("path"); | ||
const { bin, description, version } = require(packageJsonPath); | ||
program | ||
commander_1.program | ||
.name(Object.keys(bin)[0]) | ||
@@ -22,38 +31,36 @@ .description(description) | ||
.parse(process.argv); | ||
if (!program.args.length) { | ||
program.outputHelp(); | ||
if (!commander_1.program.args.length) { | ||
commander_1.program.outputHelp(); | ||
process.exit(1); | ||
} | ||
const [packageName, packageVersion] = program.args; | ||
if (packageVersion) { | ||
CratesUpdater.checkForUpdate(packageName, packageVersion) | ||
.then(version => { | ||
if (program.quiet) { | ||
if (version) { | ||
console.log(version); | ||
const [packageName, packageVersion] = commander_1.program.args; | ||
const commanderOptions = commander_1.program.opts(); | ||
void (() => __awaiter(void 0, void 0, void 0, function* () { | ||
try { | ||
if (packageVersion) { | ||
const version = yield CratesUpdater.checkForUpdate(packageName, packageVersion); | ||
if (commanderOptions.quiet) { | ||
if (version) { | ||
console.info(version); | ||
} | ||
} | ||
else { | ||
const text = version | ||
? `An update for ${packageName} is available: ${version}.` | ||
: `No update for ${packageName} available.`; | ||
console.info(text); | ||
} | ||
} | ||
else { | ||
const text = version | ||
? `An update for ${packageName} is available: ${version}.` | ||
: `No update for ${packageName} available.`; | ||
console.log(text); | ||
const version = yield CratesUpdater.getLatestVersion(packageName); | ||
const text = commanderOptions.quiet ? version.num : `Latest ${packageName} version is ${version.num}.`; | ||
console.info(text); | ||
} | ||
}) | ||
.catch(error => { | ||
process.exit(); | ||
} | ||
catch (error) { | ||
console.error(error.message); | ||
process.exit(1); | ||
}); | ||
} | ||
else { | ||
CratesUpdater.getLatestVersion(packageName) | ||
.then(version => { | ||
const text = program.quiet ? version.num : `Latest ${packageName} version is ${version.num}.`; | ||
console.log(text); | ||
}) | ||
.catch(error => { | ||
console.error(error.message); | ||
process.exit(1); | ||
}); | ||
} | ||
} | ||
}))(); | ||
//# sourceMappingURL=cli.js.map |
@@ -12,3 +12,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const compareVersions = require("compare-versions"); | ||
exports.getVersions = exports.getLatestVersion = exports.checkForUpdate = void 0; | ||
const compare_versions_1 = require("compare-versions"); | ||
const crates_io_1 = require("crates.io"); | ||
@@ -19,3 +20,3 @@ const cratesIO = new crates_io_1.CratesIO(); | ||
const latestVersion = yield getLatestVersion(packageName); | ||
if (compareVersions(latestVersion.num, version) > 0) { | ||
if ((0, compare_versions_1.compareVersions)(latestVersion.num, version) > 0) { | ||
return latestVersion.num; | ||
@@ -30,3 +31,3 @@ } | ||
const versions = yield getVersions(packageName); | ||
return versions.sort((a, b) => compareVersions(a.num, b.num)).pop(); | ||
return versions.sort((versionA, versionB) => (0, compare_versions_1.compareVersions)(versionA.num, versionB.num)).pop(); | ||
}); | ||
@@ -33,0 +34,0 @@ } |
19
index.js
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./CratesUpdater")); | ||
__exportStar(require("./CratesUpdater"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"author": "Florian Keller <github@floriankeller.de>", | ||
"author": "Florian Imdahl <git@ffflorian.de>", | ||
"bin": { | ||
@@ -8,25 +8,10 @@ "crates-updater": "cli.js", | ||
"dependencies": { | ||
"commander": "4.0.1", | ||
"compare-versions": "3.5.1", | ||
"crates.io": "1.1.2" | ||
"commander": "10.0.0", | ||
"compare-versions": "5.0.3", | ||
"crates.io": "2.2.2" | ||
}, | ||
"description": "Check your Rust packages for updates.", | ||
"devDependencies": { | ||
"@ffflorian/prettier-config": "0.0.5", | ||
"@ffflorian/semantic-release-config": "0.1.4", | ||
"@ffflorian/tslint-config": "0.7.0", | ||
"@semantic-release/changelog": "3.0.6", | ||
"@semantic-release/git": "7.0.18", | ||
"@types/node": "~12", | ||
"husky": "3.1.0", | ||
"lint-staged": "9.5.0", | ||
"prettier": "1.19.1", | ||
"publish-flat": "1.3.4", | ||
"rimraf": "3.0.0", | ||
"semantic-release": "15.14.0", | ||
"ts-node": "8.5.4", | ||
"tslint": "5.20.1", | ||
"tslint-config-prettier": "1.18.0", | ||
"tslint-plugin-prettier": "2.1.0", | ||
"typescript": "3.7.4" | ||
"rimraf": "4.1.2", | ||
"typescript": "4.9.5" | ||
}, | ||
@@ -47,7 +32,2 @@ "engines": { | ||
], | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"keywords": [ | ||
@@ -60,19 +40,8 @@ "typescript", | ||
"license": "GPL-3.0", | ||
"lint-staged": { | ||
"*.ts": [ | ||
"tslint --project tsconfig.json --fix", | ||
"git add" | ||
], | ||
"*.{json,md}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
"main": "index.js", | ||
"name": "crates-updater", | ||
"prettier": "@ffflorian/prettier-config", | ||
"release": { | ||
"extends": "@ffflorian/semantic-release-config" | ||
"publishConfig": { | ||
"directory": "flattened" | ||
}, | ||
"repository": "https://github.com/ffflorian/crates-updater", | ||
"repository": "https://github.com/ffflorian/tree/node-packages/crates-updater", | ||
"scripts": { | ||
@@ -82,16 +51,7 @@ "build": "tsc", | ||
"dist": "yarn clean && yarn build", | ||
"fix": "yarn fix:other && yarn fix:ts", | ||
"fix:other": "yarn prettier --write", | ||
"fix:ts": "yarn lint:ts --fix", | ||
"flatten": "publish-flat -o flattened", | ||
"lint": "yarn lint:ts && yarn lint:other", | ||
"lint:other": "yarn prettier --list-different", | ||
"lint:ts": "tslint --project tsconfig.json", | ||
"postversion": "node ../node_modules/publish-flat/cli-copy.js -i package.json -o ../package.json version", | ||
"prettier": "prettier \"*.{json,md}\"", | ||
"release": "semantic-release", | ||
"start": "ts-node src/cli.ts", | ||
"test": "exit 0" | ||
"flatten": "node ../publish-flat/dist/cli.js -o flattened", | ||
"postversion": "node ../publish-flat/dist/cli-copy.js -o flattened/package.json version", | ||
"start": "ts-node src/cli.ts" | ||
}, | ||
"version": "1.2.0" | ||
"version": "1.2.1" | ||
} |
@@ -1,2 +0,2 @@ | ||
# 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) | ||
# crates-updater [![npm version](https://img.shields.io/npm/v/crates-updater.svg?style=flat)](https://www.npmjs.com/package/crates-updater) | ||
@@ -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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
2
126
0
45851
12
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@0.27.2(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcommander@10.0.0(transitive)
+ Addedcompare-versions@5.0.3(transitive)
+ Addedcrates.io@2.2.2(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
- Removedaxios@0.19.0(transitive)
- Removedcommander@4.0.1(transitive)
- Removedcompare-versions@3.5.1(transitive)
- Removedcrates.io@1.1.2(transitive)
- Removedfollow-redirects@1.5.10(transitive)
- Removedis-buffer@2.0.5(transitive)
Updatedcommander@10.0.0
Updatedcompare-versions@5.0.3
Updatedcrates.io@2.2.2