crates-updater 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CratesUpdater.js +4 -3
- package/CratesUpdater.js.map +1 -1
- package/README.md +1 -1
- package/cli.js +37 -30
- package/cli.js.map +1 -1
- package/index.js +15 -4
- package/index.js.map +1 -1
- package/package.json +13 -53
- package/CHANGELOG.md +0 -27
package/CratesUpdater.js
CHANGED
|
@@ -9,13 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
|
|
12
|
+
exports.getVersions = exports.getLatestVersion = exports.checkForUpdate = void 0;
|
|
13
|
+
const compare_versions_1 = require("compare-versions");
|
|
13
14
|
const crates_io_1 = require("crates.io");
|
|
14
15
|
const cratesIO = new crates_io_1.CratesIO();
|
|
15
16
|
function checkForUpdate(packageName, version) {
|
|
16
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
18
|
const latestVersion = yield getLatestVersion(packageName);
|
|
18
|
-
if (compareVersions(latestVersion.num, version) > 0) {
|
|
19
|
+
if ((0, compare_versions_1.compareVersions)(latestVersion.num, version) > 0) {
|
|
19
20
|
return latestVersion.num;
|
|
20
21
|
}
|
|
21
22
|
return null;
|
|
@@ -25,7 +26,7 @@ exports.checkForUpdate = checkForUpdate;
|
|
|
25
26
|
function getLatestVersion(packageName) {
|
|
26
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
28
|
const versions = yield getVersions(packageName);
|
|
28
|
-
return versions.sort((
|
|
29
|
+
return versions.sort((versionA, versionB) => (0, compare_versions_1.compareVersions)(versionA.num, versionB.num)).pop();
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
exports.getLatestVersion = getLatestVersion;
|
package/CratesUpdater.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CratesUpdater.js","sourceRoot":"","sources":["../src/CratesUpdater.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CratesUpdater.js","sourceRoot":"","sources":["../src/CratesUpdater.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAiD;AACjD,yCAA4D;AAE5D,MAAM,QAAQ,GAAG,IAAI,oBAAQ,EAAE,CAAC;AAEhC,SAAsB,cAAc,CAAC,WAAmB,EAAE,OAAe;;QACvE,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAC1D,IAAI,IAAA,kCAAe,EAAC,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE;YACnD,OAAO,aAAa,CAAC,GAAG,CAAC;SAC1B;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAPD,wCAOC;AAED,SAAsB,gBAAgB,CAAC,WAAmB;;QACxD,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;QAChD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAA,kCAAe,EAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAG,CAAC;IACnG,CAAC;CAAA;AAHD,4CAGC;AAED,SAAsB,WAAW,CAAC,WAAmB;;QACnD,MAAM,EAAC,QAAQ,EAAC,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AAHD,kCAGC"}
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# crates-updater [](https://www.npmjs.com/package/crates-updater)
|
|
2
2
|
|
|
3
3
|
Check your [Rust packages](https://crates.io) for updates.
|
|
4
4
|
|
package/cli.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
3
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const
|
|
13
|
+
const commander_1 = require("commander");
|
|
5
14
|
const fs = require("fs");
|
|
6
15
|
const path = require("path");
|
|
7
16
|
const CratesUpdater = require("./CratesUpdater");
|
|
@@ -10,7 +19,7 @@ const packageJsonPath = fs.existsSync(defaultPackageJsonPath)
|
|
|
10
19
|
? defaultPackageJsonPath
|
|
11
20
|
: path.join(__dirname, '../package.json');
|
|
12
21
|
const { bin, description, version } = require(packageJsonPath);
|
|
13
|
-
program
|
|
22
|
+
commander_1.program
|
|
14
23
|
.name(Object.keys(bin)[0])
|
|
15
24
|
.description(description)
|
|
16
25
|
.arguments('<package>')
|
|
@@ -18,40 +27,38 @@ program
|
|
|
18
27
|
.option('-q, --quiet', 'quiet mode. Display newer version or nothing')
|
|
19
28
|
.version(version, '-v, --version')
|
|
20
29
|
.parse(process.argv);
|
|
21
|
-
if (!program.args.length) {
|
|
22
|
-
program.outputHelp();
|
|
30
|
+
if (!commander_1.program.args.length) {
|
|
31
|
+
commander_1.program.outputHelp();
|
|
23
32
|
process.exit(1);
|
|
24
33
|
}
|
|
25
|
-
const [packageName, packageVersion] = program.args;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
const [packageName, packageVersion] = commander_1.program.args;
|
|
35
|
+
const commanderOptions = commander_1.program.opts();
|
|
36
|
+
void (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
try {
|
|
38
|
+
if (packageVersion) {
|
|
39
|
+
const version = yield CratesUpdater.checkForUpdate(packageName, packageVersion);
|
|
40
|
+
if (commanderOptions.quiet) {
|
|
41
|
+
if (version) {
|
|
42
|
+
console.info(version);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const text = version
|
|
47
|
+
? `An update for ${packageName} is available: ${version}.`
|
|
48
|
+
: `No update for ${packageName} available.`;
|
|
49
|
+
console.info(text);
|
|
32
50
|
}
|
|
33
51
|
}
|
|
34
52
|
else {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
console.log(text);
|
|
53
|
+
const version = yield CratesUpdater.getLatestVersion(packageName);
|
|
54
|
+
const text = commanderOptions.quiet ? version.num : `Latest ${packageName} version is ${version.num}.`;
|
|
55
|
+
console.info(text);
|
|
39
56
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
process.exit(1);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
CratesUpdater.getLatestVersion(packageName)
|
|
48
|
-
.then(version => {
|
|
49
|
-
const text = program.quiet ? version.num : `Latest ${packageName} version is ${version.num}.`;
|
|
50
|
-
console.log(text);
|
|
51
|
-
})
|
|
52
|
-
.catch(error => {
|
|
57
|
+
process.exit();
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
53
60
|
console.error(error.message);
|
|
54
61
|
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
62
|
+
}
|
|
63
|
+
}))();
|
|
57
64
|
//# sourceMappingURL=cli.js.map
|
package/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,yCAA+C;AAC/C,yBAAyB;AACzB,6BAA6B;AAC7B,iDAAiD;AAEjD,MAAM,sBAAsB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AACpE,MAAM,eAAe,GAAG,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC;IAC3D,CAAC,CAAC,sBAAsB;IACxB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAE5C,MAAM,EAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAE7D,mBAAS;KACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;KACzB,WAAW,CAAC,WAAW,CAAC;KACxB,SAAS,CAAC,WAAW,CAAC;KACtB,SAAS,CAAC,kBAAkB,CAAC;KAC7B,MAAM,CAAC,aAAa,EAAE,8CAA8C,CAAC;KACrE,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC;KACjC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,IAAI,CAAC,mBAAS,CAAC,IAAI,CAAC,MAAM,EAAE;IAC1B,mBAAS,CAAC,UAAU,EAAE,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,mBAAS,CAAC,IAAI,CAAC;AACrD,MAAM,gBAAgB,GAAG,mBAAS,CAAC,IAAI,EAAE,CAAC;AAE1C,KAAK,CAAC,GAAS,EAAE;IACf,IAAI;QACF,IAAI,cAAc,EAAE;YAClB,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YAChF,IAAI,gBAAgB,CAAC,KAAK,EAAE;gBAC1B,IAAI,OAAO,EAAE;oBACX,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;iBACvB;aACF;iBAAM;gBACL,MAAM,IAAI,GAAG,OAAO;oBAClB,CAAC,CAAC,iBAAiB,WAAW,kBAAkB,OAAO,GAAG;oBAC1D,CAAC,CAAC,iBAAiB,WAAW,aAAa,CAAC;gBAC9C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACpB;SACF;aAAM;YACL,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;YAClE,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,WAAW,eAAe,OAAO,CAAC,GAAG,GAAG,CAAC;YACvG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpB;QACD,OAAO,CAAC,IAAI,EAAE,CAAC;KAChB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAA,CAAC,EAAE,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
17
|
+
__exportStar(require("./CratesUpdater"), exports);
|
|
7
18
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"}
|
package/package.json
CHANGED
|
@@ -1,33 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"author": "Florian
|
|
2
|
+
"author": "Florian Imdahl <git@ffflorian.de>",
|
|
3
3
|
"bin": {
|
|
4
4
|
"crates-updater": "cli.js",
|
|
5
5
|
"update-crates": "cli.js"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"commander": "
|
|
9
|
-
"compare-versions": "
|
|
10
|
-
"crates.io": "
|
|
8
|
+
"commander": "10.0.0",
|
|
9
|
+
"compare-versions": "5.0.3",
|
|
10
|
+
"crates.io": "2.2.2"
|
|
11
11
|
},
|
|
12
12
|
"description": "Check your Rust packages for updates.",
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"@ffflorian/tslint-config": "0.7.0",
|
|
17
|
-
"@semantic-release/changelog": "3.0.6",
|
|
18
|
-
"@semantic-release/git": "7.0.18",
|
|
19
|
-
"@types/node": "~12",
|
|
20
|
-
"husky": "3.1.0",
|
|
21
|
-
"lint-staged": "9.5.0",
|
|
22
|
-
"prettier": "1.19.1",
|
|
23
|
-
"publish-flat": "1.3.4",
|
|
24
|
-
"rimraf": "3.0.0",
|
|
25
|
-
"semantic-release": "15.14.0",
|
|
26
|
-
"ts-node": "8.5.4",
|
|
27
|
-
"tslint": "5.20.1",
|
|
28
|
-
"tslint-config-prettier": "1.18.0",
|
|
29
|
-
"tslint-plugin-prettier": "2.1.0",
|
|
30
|
-
"typescript": "3.7.4"
|
|
14
|
+
"rimraf": "4.1.2",
|
|
15
|
+
"typescript": "4.9.5"
|
|
31
16
|
},
|
|
32
17
|
"engines": {
|
|
33
18
|
"node": ">= 10.9"
|
|
@@ -43,11 +28,6 @@
|
|
|
43
28
|
"index.js",
|
|
44
29
|
"index.js.map"
|
|
45
30
|
],
|
|
46
|
-
"husky": {
|
|
47
|
-
"hooks": {
|
|
48
|
-
"pre-commit": "lint-staged"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
31
|
"keywords": [
|
|
52
32
|
"typescript",
|
|
53
33
|
"cratesio",
|
|
@@ -55,39 +35,19 @@
|
|
|
55
35
|
"cli"
|
|
56
36
|
],
|
|
57
37
|
"license": "GPL-3.0",
|
|
58
|
-
"lint-staged": {
|
|
59
|
-
"*.ts": [
|
|
60
|
-
"tslint --project tsconfig.json --fix",
|
|
61
|
-
"git add"
|
|
62
|
-
],
|
|
63
|
-
"*.{json,md}": [
|
|
64
|
-
"prettier --write",
|
|
65
|
-
"git add"
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
38
|
"main": "index.js",
|
|
69
39
|
"name": "crates-updater",
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
"extends": "@ffflorian/semantic-release-config"
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"directory": "flattened"
|
|
73
42
|
},
|
|
74
|
-
"repository": "https://github.com/ffflorian/crates-updater",
|
|
43
|
+
"repository": "https://github.com/ffflorian/tree/node-packages/crates-updater",
|
|
75
44
|
"scripts": {
|
|
76
45
|
"build": "tsc",
|
|
77
46
|
"clean": "rimraf dist",
|
|
78
47
|
"dist": "yarn clean && yarn build",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"flatten": "publish-flat -o flattened",
|
|
83
|
-
"lint": "yarn lint:ts && yarn lint:other",
|
|
84
|
-
"lint:other": "yarn prettier --list-different",
|
|
85
|
-
"lint:ts": "tslint --project tsconfig.json",
|
|
86
|
-
"postversion": "node ../node_modules/publish-flat/cli-copy.js -i package.json -o ../package.json version",
|
|
87
|
-
"prettier": "prettier \"*.{json,md}\"",
|
|
88
|
-
"release": "semantic-release",
|
|
89
|
-
"start": "ts-node src/cli.ts",
|
|
90
|
-
"test": "exit 0"
|
|
48
|
+
"flatten": "node ../publish-flat/dist/cli.js -o flattened",
|
|
49
|
+
"postversion": "node ../publish-flat/dist/cli-copy.js -o flattened/package.json version",
|
|
50
|
+
"start": "ts-node src/cli.ts"
|
|
91
51
|
},
|
|
92
|
-
"version": "1.2.
|
|
52
|
+
"version": "1.2.1"
|
|
93
53
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# [1.1.0](https://github.com/ffflorian/crates-updater/compare/v1.0.0...v1.1.0) (2019-08-17)
|
|
2
|
-
|
|
3
|
-
### Features
|
|
4
|
-
|
|
5
|
-
- Quiet mode, simple functions ([#123](https://github.com/ffflorian/crates-updater/issues/123)) ([9e075d8](https://github.com/ffflorian/crates-updater/commit/9e075d8))
|
|
6
|
-
|
|
7
|
-
# [1.0.0](https://github.com/ffflorian/crates-updater/compare/v0.4.0...v1.0.0) (2019-07-17)
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
- 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))
|
|
12
|
-
|
|
13
|
-
### BREAKING CHANGES
|
|
14
|
-
|
|
15
|
-
- Node.js >= 10.9 is required.
|
|
16
|
-
|
|
17
|
-
# [0.4.0](https://github.com/ffflorian/crates-updater/compare/v0.3.0...v0.4.0) (2019-05-27)
|
|
18
|
-
|
|
19
|
-
### Features
|
|
20
|
-
|
|
21
|
-
- Force release ([c097c48](https://github.com/ffflorian/crates-updater/commit/c097c48))
|
|
22
|
-
|
|
23
|
-
# [0.3.0](https://github.com/ffflorian/crates-updater/compare/v0.2.0...v0.3.0) (2019-05-09)
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
- Cleanup, better error message ([#42](https://github.com/ffflorian/crates-updater/issues/42)) ([70c3b55](https://github.com/ffflorian/crates-updater/commit/70c3b55))
|