fix(core): update
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartupdate',
|
||||
version: '2.0.4',
|
||||
name: '@push.rocks/smartupdate',
|
||||
version: '2.0.5',
|
||||
description: 'update your tools in a smart way'
|
||||
}
|
||||
|
@ -1,15 +1,11 @@
|
||||
import * as plugins from './smartupdate.plugins.js';
|
||||
|
||||
import { TimeStamp } from '@pushrocks/smarttime';
|
||||
|
||||
interface ICacheStatus {
|
||||
lastCheck: number;
|
||||
latestVersion: string;
|
||||
performedUpgrade: boolean;
|
||||
}
|
||||
|
||||
import { KeyValueStore } from '@pushrocks/npmextra';
|
||||
|
||||
export class SmartUpdate {
|
||||
public npmRegistry: plugins.smartnpm.NpmRegistry;
|
||||
public kvStore = new plugins.npmextra.KeyValueStore('custom', 'global_smartupdate');
|
||||
@ -20,7 +16,7 @@ export class SmartUpdate {
|
||||
|
||||
public async checkForCli(npmnameArg: string, compareVersion: string, changelogUrlArg?: string) {
|
||||
// the newData to write
|
||||
const timeStamp = new TimeStamp();
|
||||
const timeStamp = new plugins.smarttime.TimeStamp();
|
||||
const newCacheData: ICacheStatus = {
|
||||
lastCheck: timeStamp.milliSeconds,
|
||||
latestVersion: 'x.x.x',
|
||||
@ -31,7 +27,7 @@ export class SmartUpdate {
|
||||
const retrievedCacheData: ICacheStatus = await this.kvStore.readKey(npmnameArg);
|
||||
|
||||
if (retrievedCacheData) {
|
||||
const lastCheckTimeStamp = TimeStamp.fromMilliSeconds(retrievedCacheData.lastCheck);
|
||||
const lastCheckTimeStamp = plugins.smarttime.TimeStamp.fromMilliSeconds(retrievedCacheData.lastCheck);
|
||||
const tresholdTime = plugins.smarttime.getMilliSecondsFromUnits({ hours: 1 });
|
||||
if (!lastCheckTimeStamp.isOlderThan(timeStamp, tresholdTime)) {
|
||||
newCacheData.lastCheck = lastCheckTimeStamp.milliSeconds;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as consolecolor from '@pushrocks/consolecolor';
|
||||
import * as npmextra from '@pushrocks/npmextra';
|
||||
import * as smartnpm from '@pushrocks/smartnpm';
|
||||
import * as smartopen from '@pushrocks/smartopen';
|
||||
import * as smarttime from '@pushrocks/smarttime';
|
||||
import * as smartversion from '@pushrocks/smartversion';
|
||||
import * as consolecolor from '@push.rocks/consolecolor';
|
||||
import * as npmextra from '@push.rocks/npmextra';
|
||||
import * as smartnpm from '@push.rocks/smartnpm';
|
||||
import * as smartopen from '@push.rocks/smartopen';
|
||||
import * as smarttime from '@push.rocks/smarttime';
|
||||
import * as smartversion from '@push.rocks/smartversion';
|
||||
|
||||
export { consolecolor, npmextra, smartnpm, smartopen, smarttime, smartversion };
|
||||
|
Reference in New Issue
Block a user