update dependencies
This commit is contained in:
parent
61f2ed9ef7
commit
9666658a77
10
dist/index.js
vendored
10
dist/index.js
vendored
@ -16,20 +16,22 @@ class SmartUpdate {
|
|||||||
}
|
}
|
||||||
check(npmnameArg, compareVersion, changelogUrlArg) {
|
check(npmnameArg, compareVersion, changelogUrlArg) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let result = yield this.kvStore.readKey(npmnameArg);
|
|
||||||
let timeStamp = new smarttime_1.TimeStamp();
|
|
||||||
// the newData to write
|
// the newData to write
|
||||||
|
let timeStamp = new smarttime_1.TimeStamp();
|
||||||
let newData = {
|
let newData = {
|
||||||
lastCheck: timeStamp.milliSeconds,
|
lastCheck: timeStamp.milliSeconds,
|
||||||
latestVersion: 'x.x.x',
|
latestVersion: 'x.x.x',
|
||||||
performedUpgrade: false
|
performedUpgrade: false
|
||||||
};
|
};
|
||||||
|
// the comparison data from the keyValue store
|
||||||
|
let result = yield this.kvStore.readKey(npmnameArg);
|
||||||
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({ hours: 1 });
|
let compareTime = plugins.smarttime.getMilliSecondsFromUnits({ hours: 1 });
|
||||||
if (!lastCheckTimeStamp.isOlderThan(timeStamp, compareTime)) {
|
if (!lastCheckTimeStamp.isOlderThan(timeStamp, compareTime)) {
|
||||||
newData.lastCheck = lastCheckTimeStamp.milliSeconds;
|
newData.lastCheck = lastCheckTimeStamp.milliSeconds;
|
||||||
plugins.beautylog.log(`smartupdate: next check in : ` +
|
let nextCheckInMinutes = (timeStamp.milliSeconds - lastCheckTimeStamp.milliSeconds) / 60000;
|
||||||
|
plugins.beautylog.log(`smartupdate: next check in ${nextCheckInMinutes}: ` +
|
||||||
`${plugins.beautycolor.coloredString(`${npmnameArg} has already been checked within the last hour.`, 'pink')}`);
|
`${plugins.beautycolor.coloredString(`${npmnameArg} has already been checked within the last hour.`, 'pink')}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -73,4 +75,4 @@ class SmartUpdate {
|
|||||||
}
|
}
|
||||||
exports.SmartUpdate = SmartUpdate;
|
exports.SmartUpdate = SmartUpdate;
|
||||||
exports.standardHandler = new SmartUpdate();
|
exports.standardHandler = new SmartUpdate();
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsaURBQWdEO0FBRWhELHlDQUFxQztBQVVyQztJQUFBO1FBQ0UsWUFBTyxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxhQUFhLENBQUMsUUFBUSxFQUFFLG9CQUFvQixDQUFDLENBQUE7SUFnRTlFLENBQUM7SUE5RE8sS0FBSyxDQUFFLFVBQWtCLEVBQUUsY0FBc0IsRUFBRSxlQUF3Qjs7WUFDL0UsSUFBSSxNQUFNLEdBQWlCLE1BQU0sSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDLENBQUE7WUFDakUsSUFBSSxTQUFTLEdBQUcsSUFBSSxxQkFBUyxFQUFFLENBQUE7WUFFL0IsdUJBQXVCO1lBQ3ZCLElBQUksT0FBTyxHQUFHO2dCQUNaLFNBQVMsRUFBRSxTQUFTLENBQUMsWUFBWTtnQkFDakMsYUFBYSxFQUFFLE9BQU87Z0JBQ3RCLGdCQUFnQixFQUFFLEtBQUs7YUFDeEIsQ0FBQTtZQUNELEVBQUUsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7Z0JBQ1gsSUFBSSxrQkFB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0FBTyxDQUFDLFNBQVMsQ0FBQyxPQUFPLENBQUMsZUFBZSxDQUFDLENBQUE7Z0JBQzVDLENBQUM7Z0JBQ0QsTUFBTSxDQUFDLElBQUksQ0FBQTtZQUNiLENBQUM7UUFDSCxDQUFDO0tBQUE7Q0FDRjtBQXJFRCxrQ0FxRUM7QUFDVSxRQUFBLGVBQWUsR0FBRyxJQUFJLFdBQVcsRUFBRSxDQUFBIn0=
|
@ -18,7 +18,7 @@
|
|||||||
"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.7",
|
||||||
"smartversion": "^1.0.3",
|
"smartversion": "^1.0.3",
|
||||||
"typings-global": "^1.0.20"
|
"typings-global": "^1.0.20"
|
||||||
}
|
}
|
||||||
|
12
ts/index.ts
12
ts/index.ts
@ -14,22 +14,26 @@ export class SmartUpdate {
|
|||||||
kvStore = new plugins.npmextra.KeyValueStore('custom', 'global:smartupdate')
|
kvStore = new plugins.npmextra.KeyValueStore('custom', 'global:smartupdate')
|
||||||
|
|
||||||
async check (npmnameArg: string, compareVersion: string, changelogUrlArg?: string) {
|
async check (npmnameArg: string, compareVersion: string, changelogUrlArg?: string) {
|
||||||
let result: ICacheStatus = await this.kvStore.readKey(npmnameArg)
|
|
||||||
let timeStamp = new TimeStamp()
|
|
||||||
|
|
||||||
// the newData to write
|
// the newData to write
|
||||||
|
let timeStamp = new TimeStamp()
|
||||||
let newData = {
|
let newData = {
|
||||||
lastCheck: timeStamp.milliSeconds,
|
lastCheck: timeStamp.milliSeconds,
|
||||||
latestVersion: 'x.x.x',
|
latestVersion: 'x.x.x',
|
||||||
performedUpgrade: false
|
performedUpgrade: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the comparison data from the keyValue store
|
||||||
|
let result: ICacheStatus = await this.kvStore.readKey(npmnameArg)
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
let lastCheckTimeStamp = TimeStamp.fromMilliSeconds(result.lastCheck)
|
let lastCheckTimeStamp = TimeStamp.fromMilliSeconds(result.lastCheck)
|
||||||
let compareTime = plugins.smarttime.getMilliSecondsFromUnits({ hours: 1 })
|
let compareTime = plugins.smarttime.getMilliSecondsFromUnits({ hours: 1 })
|
||||||
if (!lastCheckTimeStamp.isOlderThan(timeStamp, compareTime)) {
|
if (!lastCheckTimeStamp.isOlderThan(timeStamp, compareTime)) {
|
||||||
newData.lastCheck = lastCheckTimeStamp.milliSeconds
|
newData.lastCheck = lastCheckTimeStamp.milliSeconds
|
||||||
|
let nextCheckInMinutes = (timeStamp.milliSeconds - lastCheckTimeStamp.milliSeconds) / 60000
|
||||||
plugins.beautylog.log(
|
plugins.beautylog.log(
|
||||||
`smartupdate: next check in : ` +
|
`smartupdate: next check in ${nextCheckInMinutes}: ` +
|
||||||
`${plugins.beautycolor.coloredString(
|
`${plugins.beautycolor.coloredString(
|
||||||
`${npmnameArg} has already been checked within the last hour.`
|
`${npmnameArg} has already been checked within the last hour.`
|
||||||
, 'pink'
|
, 'pink'
|
||||||
|
@ -711,9 +711,9 @@ smartshell@^1.0.6:
|
|||||||
typings-global "^1.0.19"
|
typings-global "^1.0.19"
|
||||||
which "^1.2.14"
|
which "^1.2.14"
|
||||||
|
|
||||||
smarttime@^1.0.6:
|
smarttime@^1.0.7:
|
||||||
version "1.0.6"
|
version "1.0.7"
|
||||||
resolved "https://registry.yarnpkg.com/smarttime/-/smarttime-1.0.6.tgz#0412a021cff88e8e41b766103a2d9e42fe816ddc"
|
resolved "https://registry.yarnpkg.com/smarttime/-/smarttime-1.0.7.tgz#d3030d7cd71bf58d752e88c81f6f4fd59681efd1"
|
||||||
dependencies:
|
dependencies:
|
||||||
typings-global "^1.0.16"
|
typings-global "^1.0.16"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user