update to reflect more accurate update information
This commit is contained in:
parent
4501469365
commit
61d7ac981b
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -3,6 +3,6 @@ export declare class SmartUpdate {
|
|||||||
kvStore: KeyValueStore;
|
kvStore: KeyValueStore;
|
||||||
check(npmnameArg: string, compareVersion: string, changelogUrlArg?: string): Promise<void>;
|
check(npmnameArg: string, compareVersion: string, changelogUrlArg?: string): Promise<void>;
|
||||||
private getNpmPackageFromRegistry(npmnameArg);
|
private getNpmPackageFromRegistry(npmnameArg);
|
||||||
private checkIfUpgrade(npmPackage, versionArg, changelogUrlArg?);
|
private checkIfUpgrade(npmPackage, localVersionStringArg, changelogUrlArg?);
|
||||||
}
|
}
|
||||||
export declare let standardHandler: SmartUpdate;
|
export declare let standardHandler: SmartUpdate;
|
||||||
|
16
dist/index.js
vendored
16
dist/index.js
vendored
@ -26,9 +26,10 @@ class SmartUpdate {
|
|||||||
};
|
};
|
||||||
if (result) {
|
if (result) {
|
||||||
let lastCheckTimeStamp = smarttime_1.TimeStamp.fromMilliSeconds(result.lastCheck);
|
let lastCheckTimeStamp = smarttime_1.TimeStamp.fromMilliSeconds(result.lastCheck);
|
||||||
let compareTime = plugins.smarttime.getMilliSecondsFromUnits({ days: 1 });
|
let compareTime = plugins.smarttime.getMilliSecondsFromUnits({ hours: 1 });
|
||||||
if (!lastCheckTimeStamp.isOlderThan(timeStamp, compareTime)) {
|
if (!lastCheckTimeStamp.isOlderThan(timeStamp, compareTime)) {
|
||||||
plugins.beautylog.log(`smartupdate: next check tomorrow: ${plugins.beautycolor.coloredString(`${npmnameArg} has already been checked for today.`, 'pink')}`);
|
plugins.beautylog.log(`smartupdate: next check tomorrow: ` +
|
||||||
|
`${plugins.beautycolor.coloredString(`${npmnameArg} has already been checked within the last hour.`, 'pink')}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,15 +49,18 @@ class SmartUpdate {
|
|||||||
return npmPackage;
|
return npmPackage;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
checkIfUpgrade(npmPackage, versionArg, changelogUrlArg) {
|
checkIfUpgrade(npmPackage, localVersionStringArg, changelogUrlArg) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (npmPackage.version === versionArg) {
|
// create Version objects
|
||||||
|
let versionNpm = new plugins.smartversion.SmartVersion(npmPackage.version);
|
||||||
|
let versionLocal = new plugins.smartversion.SmartVersion(localVersionStringArg);
|
||||||
|
if (versionNpm.greaterThan(versionLocal)) {
|
||||||
plugins.beautylog.ok(`smartupdate: You are running the latest version of ${plugins.beautycolor.coloredString(npmPackage.name, 'pink')}`);
|
plugins.beautylog.ok(`smartupdate: You are running the latest version of ${plugins.beautycolor.coloredString(npmPackage.name, 'pink')}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plugins.beautylog.warn(`There is a newer version of ${npmPackage.name} available on npm.`);
|
plugins.beautylog.warn(`There is a newer version of ${npmPackage.name} available on npm.`);
|
||||||
plugins.beautylog.warn(`Your version: ${versionArg} | version on npm: ${npmPackage.version}`);
|
plugins.beautylog.warn(`Your version: ${versionLocal.versionString} | version on npm: ${versionNpm.versionString}`);
|
||||||
if (!process.env.CI && changelogUrlArg) {
|
if (!process.env.CI && changelogUrlArg) {
|
||||||
plugins.beautylog.log('trying to open changelog...');
|
plugins.beautylog.log('trying to open changelog...');
|
||||||
plugins.smartopen.openUrl(changelogUrlArg);
|
plugins.smartopen.openUrl(changelogUrlArg);
|
||||||
@ -68,4 +72,4 @@ class SmartUpdate {
|
|||||||
}
|
}
|
||||||
exports.SmartUpdate = SmartUpdate;
|
exports.SmartUpdate = SmartUpdate;
|
||||||
exports.standardHandler = new SmartUpdate();
|
exports.standardHandler = new SmartUpdate();
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3V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xDQUFDLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUFFLElBQUksZUFBZSxDQUFDLENBQUMsQ0FBQztvQkFDdkMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsNkJBQTZCLENBQUMsQ0FBQTtvQkFDcEQsT0FBTyxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsZUFBZSxDQUFDLENBQUE7Z0JBQzVDLENBQUM7Z0JBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQTtZQUNiLENBQUM7UUFDSCxDQUFDO0tBQUE7Q0FDRjtBQWhFRCxrQ0FnRUM7QUFDVSxRQUFBLGVBQWUsR0FBRyxJQUFJLFdBQVcsRUFBRSxDQUFBIn0=
|
3
dist/smartupdate.plugins.d.ts
vendored
3
dist/smartupdate.plugins.d.ts
vendored
@ -5,4 +5,5 @@ import * as npmextra from 'npmextra';
|
|||||||
import * as smartnpm from 'smartnpm';
|
import * as smartnpm from 'smartnpm';
|
||||||
import * as smartopen from 'smartopen';
|
import * as smartopen from 'smartopen';
|
||||||
import * as smarttime from 'smarttime';
|
import * as smarttime from 'smarttime';
|
||||||
export { beautylog, beautycolor, npmextra, smartnpm, smartopen, smarttime };
|
import * as smartversion from 'smartversion';
|
||||||
|
export { beautylog, beautycolor, npmextra, smartnpm, smartopen, smarttime, smartversion };
|
||||||
|
4
dist/smartupdate.plugins.js
vendored
4
dist/smartupdate.plugins.js
vendored
@ -13,4 +13,6 @@ const smartopen = require("smartopen");
|
|||||||
exports.smartopen = smartopen;
|
exports.smartopen = smartopen;
|
||||||
const smarttime = require("smarttime");
|
const smarttime = require("smarttime");
|
||||||
exports.smarttime = smarttime;
|
exports.smarttime = smarttime;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR1cGRhdGUucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0dXBkYXRlLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFFdkIsdUNBQXNDO0FBUXBDLDhCQUFTO0FBUFgsMkNBQTBDO0FBUXhDLGtDQUFXO0FBUGIscUNBQW9DO0FBUWxDLDRCQUFRO0FBUFYscUNBQW9DO0FBUWxDLDRCQUFRO0FBUFYsdUNBQXNDO0FBUXBDLDhCQUFTO0FBUFgsdUNBQXNDO0FBUXBDLDhCQUFTIn0=
|
const smartversion = require("smartversion");
|
||||||
|
exports.smartversion = smartversion;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnR1cGRhdGUucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0dXBkYXRlLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFFdkIsdUNBQXNDO0FBU3BDLDhCQUFTO0FBUlgsMkNBQTBDO0FBU3hDLGtDQUFXO0FBUmIscUNBQW9DO0FBU2xDLDRCQUFRO0FBUlYscUNBQW9DO0FBU2xDLDRCQUFRO0FBUlYsdUNBQXNDO0FBU3BDLDhCQUFTO0FBUlgsdUNBQXNDO0FBU3BDLDhCQUFTO0FBUlgsNkNBQTRDO0FBUzFDLG9DQUFZIn0=
|
@ -13,12 +13,13 @@
|
|||||||
"tapbundle": "^1.1.1"
|
"tapbundle": "^1.1.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautycolor": "^1.0.10",
|
"beautycolor": "^1.0.11",
|
||||||
"beautylog": "^6.1.10",
|
"beautylog": "^6.1.10",
|
||||||
"npmextra": "^2.0.9",
|
"npmextra": "^2.0.9",
|
||||||
"smartnpm": "^1.0.4",
|
"smartnpm": "^1.0.4",
|
||||||
"smartopen": "^1.0.3",
|
"smartopen": "^1.0.3",
|
||||||
"smarttime": "^1.0.6",
|
"smarttime": "^1.0.6",
|
||||||
|
"smartversion": "^1.0.3",
|
||||||
"typings-global": "^1.0.20"
|
"typings-global": "^1.0.20"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
ts/index.ts
19
ts/index.ts
@ -25,9 +25,15 @@ export class SmartUpdate {
|
|||||||
}
|
}
|
||||||
if (result) {
|
if (result) {
|
||||||
let lastCheckTimeStamp = TimeStamp.fromMilliSeconds(result.lastCheck)
|
let lastCheckTimeStamp = TimeStamp.fromMilliSeconds(result.lastCheck)
|
||||||
let compareTime = plugins.smarttime.getMilliSecondsFromUnits({ days: 1 })
|
let compareTime = plugins.smarttime.getMilliSecondsFromUnits({ hours: 1 })
|
||||||
if (!lastCheckTimeStamp.isOlderThan(timeStamp, compareTime)) {
|
if (!lastCheckTimeStamp.isOlderThan(timeStamp, compareTime)) {
|
||||||
plugins.beautylog.log(`smartupdate: next check tomorrow: ${plugins.beautycolor.coloredString(`${npmnameArg} has already been checked for today.`, 'pink')}`)
|
plugins.beautylog.log(
|
||||||
|
`smartupdate: next check in : ` +
|
||||||
|
`${plugins.beautycolor.coloredString(
|
||||||
|
`${npmnameArg} has already been checked within the last hour.`
|
||||||
|
, 'pink'
|
||||||
|
)}`
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,15 +55,18 @@ export class SmartUpdate {
|
|||||||
|
|
||||||
private async checkIfUpgrade (
|
private async checkIfUpgrade (
|
||||||
npmPackage: plugins.smartnpm.NpmPackage,
|
npmPackage: plugins.smartnpm.NpmPackage,
|
||||||
versionArg: string,
|
localVersionStringArg: string,
|
||||||
changelogUrlArg?: string
|
changelogUrlArg?: string
|
||||||
) {
|
) {
|
||||||
if (npmPackage.version === versionArg) {
|
// create Version objects
|
||||||
|
let versionNpm = new plugins.smartversion.SmartVersion(npmPackage.version)
|
||||||
|
let versionLocal = new plugins.smartversion.SmartVersion(localVersionStringArg)
|
||||||
|
if (versionNpm.greaterThan(versionLocal)) {
|
||||||
plugins.beautylog.ok(`smartupdate: You are running the latest version of ${plugins.beautycolor.coloredString(npmPackage.name, 'pink')}`)
|
plugins.beautylog.ok(`smartupdate: You are running the latest version of ${plugins.beautycolor.coloredString(npmPackage.name, 'pink')}`)
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
plugins.beautylog.warn(`There is a newer version of ${npmPackage.name} available on npm.`)
|
plugins.beautylog.warn(`There is a newer version of ${npmPackage.name} available on npm.`)
|
||||||
plugins.beautylog.warn(`Your version: ${versionArg} | version on npm: ${npmPackage.version}`)
|
plugins.beautylog.warn(`Your version: ${versionLocal.versionString} | version on npm: ${versionNpm.versionString}`)
|
||||||
if (!process.env.CI && changelogUrlArg) {
|
if (!process.env.CI && changelogUrlArg) {
|
||||||
plugins.beautylog.log('trying to open changelog...')
|
plugins.beautylog.log('trying to open changelog...')
|
||||||
plugins.smartopen.openUrl(changelogUrlArg)
|
plugins.smartopen.openUrl(changelogUrlArg)
|
||||||
|
@ -6,6 +6,7 @@ import * as npmextra from 'npmextra'
|
|||||||
import * as smartnpm from 'smartnpm'
|
import * as smartnpm from 'smartnpm'
|
||||||
import * as smartopen from 'smartopen'
|
import * as smartopen from 'smartopen'
|
||||||
import * as smarttime from 'smarttime'
|
import * as smarttime from 'smarttime'
|
||||||
|
import * as smartversion from 'smartversion'
|
||||||
|
|
||||||
export {
|
export {
|
||||||
beautylog,
|
beautylog,
|
||||||
@ -13,5 +14,6 @@ export {
|
|||||||
npmextra,
|
npmextra,
|
||||||
smartnpm,
|
smartnpm,
|
||||||
smartopen,
|
smartopen,
|
||||||
smarttime
|
smarttime,
|
||||||
|
smartversion
|
||||||
}
|
}
|
||||||
|
25
yarn.lock
25
yarn.lock
@ -53,8 +53,8 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
|
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-2.0.29.tgz#5002e14f75e2d71e564281df0431c8c1b4a2a36a"
|
||||||
|
|
||||||
"@types/node@*", "@types/node@^8.0.10":
|
"@types/node@*", "@types/node@^8.0.10":
|
||||||
version "8.0.22"
|
version "8.0.24"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.22.tgz#9c6bfee1f45f5e9952ff6b487e657ecca48c7777"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.24.tgz#06c580084d9add1fb40c1510ef0b448961246fb1"
|
||||||
|
|
||||||
"@types/open@^0.0.29":
|
"@types/open@^0.0.29":
|
||||||
version "0.0.29"
|
version "0.0.29"
|
||||||
@ -68,6 +68,10 @@
|
|||||||
version "1.0.3"
|
version "1.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.0.3.tgz#08e99d20f7abfc0fe202b6d5a0921bfafcdea8d0"
|
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.0.3.tgz#08e99d20f7abfc0fe202b6d5a0921bfafcdea8d0"
|
||||||
|
|
||||||
|
"@types/semver@^5.3.33":
|
||||||
|
version "5.3.34"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.3.34.tgz#6fade409ceb8ae817c1f7f1cfa5375416e97045f"
|
||||||
|
|
||||||
"@types/shelljs@^0.7.2":
|
"@types/shelljs@^0.7.2":
|
||||||
version "0.7.4"
|
version "0.7.4"
|
||||||
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.4.tgz#137b5f31306eaff4de120ffe5b9d74b297809cfc"
|
resolved "https://registry.yarnpkg.com/@types/shelljs/-/shelljs-0.7.4.tgz#137b5f31306eaff4de120ffe5b9d74b297809cfc"
|
||||||
@ -111,12 +115,11 @@ balanced-match@^1.0.0:
|
|||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||||
|
|
||||||
beautycolor@^1.0.10, beautycolor@^1.0.7, beautycolor@^1.0.9:
|
beautycolor@^1.0.11, beautycolor@^1.0.7, beautycolor@^1.0.9:
|
||||||
version "1.0.10"
|
version "1.0.11"
|
||||||
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.10.tgz#4b50758e59115839b3bb2bfe8aaaec9e29c747dd"
|
resolved "https://registry.yarnpkg.com/beautycolor/-/beautycolor-1.0.11.tgz#71c5568d5a7ed5c144d3a54f753ad1b08862aea5"
|
||||||
dependencies:
|
dependencies:
|
||||||
ansi-256-colors "^1.1.0"
|
ansi-256-colors "^1.1.0"
|
||||||
tapbundle "^1.1.1"
|
|
||||||
typings-global "^1.0.14"
|
typings-global "^1.0.14"
|
||||||
|
|
||||||
beautylog@^6.1.10:
|
beautylog@^6.1.10:
|
||||||
@ -593,7 +596,7 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1:
|
|||||||
version "5.1.1"
|
version "5.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
|
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
|
||||||
|
|
||||||
semver@^5.3.0:
|
semver@^5.3.0, semver@^5.4.1:
|
||||||
version "5.4.1"
|
version "5.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
|
resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e"
|
||||||
|
|
||||||
@ -714,6 +717,14 @@ smarttime@^1.0.6:
|
|||||||
dependencies:
|
dependencies:
|
||||||
typings-global "^1.0.16"
|
typings-global "^1.0.16"
|
||||||
|
|
||||||
|
smartversion@^1.0.3:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/smartversion/-/smartversion-1.0.3.tgz#8b6b1553594a4df7fac8495bc2802b4a6f84a27c"
|
||||||
|
dependencies:
|
||||||
|
"@types/semver" "^5.3.33"
|
||||||
|
semver "^5.4.1"
|
||||||
|
typings-global "^1.0.16"
|
||||||
|
|
||||||
sprintf-js@~1.0.2:
|
sprintf-js@~1.0.2:
|
||||||
version "1.0.3"
|
version "1.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user