fix(core): update

This commit is contained in:
Philipp Kunz 2023-07-26 20:51:11 +02:00
parent 111ef1fe44
commit 293da8859d
7 changed files with 5408 additions and 30 deletions

View File

@ -7,10 +7,10 @@
"projectType": "npm", "projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "push.rocks",
"gitrepo": "smartupdate", "gitrepo": "smartupdate",
"description": "update your tools in a smart way", "description": "update your tools in a smart way",
"npmPackagename": "@pushrocks/smartupdate", "npmPackagename": "@push.rocks/smartupdate",
"license": "MIT" "license": "MIT"
} }
} }

View File

@ -1,5 +1,5 @@
{ {
"name": "@pushrocks/smartupdate", "name": "@push.rocks/smartupdate",
"version": "2.0.4", "version": "2.0.4",
"private": false, "private": false,
"description": "update your tools in a smart way", "description": "update your tools in a smart way",
@ -13,19 +13,19 @@
"build": "(tsbuild --web --allowimplicitany)" "build": "(tsbuild --web --allowimplicitany)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.63", "@gitzone/tsbuild": "^2.1.66",
"@gitzone/tsrun": "^1.2.34", "@gitzone/tsrun": "^1.2.44",
"@gitzone/tstest": "^1.0.71", "@gitzone/tstest": "^1.0.77",
"@pushrocks/tapbundle": "^5.0.3", "@push.rocks/tapbundle": "^5.0.12",
"@types/node": "^17.0.38" "@types/node": "^20.4.5"
}, },
"dependencies": { "dependencies": {
"@pushrocks/consolecolor": "^2.0.1", "@push.rocks/consolecolor": "^2.0.1",
"@pushrocks/npmextra": "^3.0.9", "@push.rocks/npmextra": "^3.0.9",
"@pushrocks/smartnpm": "^2.0.0", "@push.rocks/smartnpm": "^2.0.4",
"@pushrocks/smartopen": "^2.0.0", "@push.rocks/smartopen": "^2.0.0",
"@pushrocks/smarttime": "^3.0.45", "@push.rocks/smarttime": "^4.0.4",
"@pushrocks/smartversion": "^3.0.2" "@push.rocks/smartversion": "^3.0.2"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
@ -42,4 +42,4 @@
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
] ]
} }

5382
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@push.rocks/tapbundle';
import * as smartupdate from '../ts/index.js'; import * as smartupdate from '../ts/index.js';
let testSmartUpdate: smartupdate.SmartUpdate; let testSmartUpdate: smartupdate.SmartUpdate;

View File

@ -2,7 +2,7 @@
* autocreated commitinfo by @pushrocks/commitinfo * autocreated commitinfo by @pushrocks/commitinfo
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/smartupdate', name: '@push.rocks/smartupdate',
version: '2.0.4', version: '2.0.5',
description: 'update your tools in a smart way' description: 'update your tools in a smart way'
} }

View File

@ -1,15 +1,11 @@
import * as plugins from './smartupdate.plugins.js'; import * as plugins from './smartupdate.plugins.js';
import { TimeStamp } from '@pushrocks/smarttime';
interface ICacheStatus { interface ICacheStatus {
lastCheck: number; lastCheck: number;
latestVersion: string; latestVersion: string;
performedUpgrade: boolean; performedUpgrade: boolean;
} }
import { KeyValueStore } from '@pushrocks/npmextra';
export class SmartUpdate { export class SmartUpdate {
public npmRegistry: plugins.smartnpm.NpmRegistry; public npmRegistry: plugins.smartnpm.NpmRegistry;
public kvStore = new plugins.npmextra.KeyValueStore('custom', 'global_smartupdate'); 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) { public async checkForCli(npmnameArg: string, compareVersion: string, changelogUrlArg?: string) {
// the newData to write // the newData to write
const timeStamp = new TimeStamp(); const timeStamp = new plugins.smarttime.TimeStamp();
const newCacheData: ICacheStatus = { const newCacheData: ICacheStatus = {
lastCheck: timeStamp.milliSeconds, lastCheck: timeStamp.milliSeconds,
latestVersion: 'x.x.x', latestVersion: 'x.x.x',
@ -31,7 +27,7 @@ export class SmartUpdate {
const retrievedCacheData: ICacheStatus = await this.kvStore.readKey(npmnameArg); const retrievedCacheData: ICacheStatus = await this.kvStore.readKey(npmnameArg);
if (retrievedCacheData) { if (retrievedCacheData) {
const lastCheckTimeStamp = TimeStamp.fromMilliSeconds(retrievedCacheData.lastCheck); const lastCheckTimeStamp = plugins.smarttime.TimeStamp.fromMilliSeconds(retrievedCacheData.lastCheck);
const tresholdTime = plugins.smarttime.getMilliSecondsFromUnits({ hours: 1 }); const tresholdTime = plugins.smarttime.getMilliSecondsFromUnits({ hours: 1 });
if (!lastCheckTimeStamp.isOlderThan(timeStamp, tresholdTime)) { if (!lastCheckTimeStamp.isOlderThan(timeStamp, tresholdTime)) {
newCacheData.lastCheck = lastCheckTimeStamp.milliSeconds; newCacheData.lastCheck = lastCheckTimeStamp.milliSeconds;

View File

@ -1,8 +1,8 @@
import * as consolecolor from '@pushrocks/consolecolor'; import * as consolecolor from '@push.rocks/consolecolor';
import * as npmextra from '@pushrocks/npmextra'; import * as npmextra from '@push.rocks/npmextra';
import * as smartnpm from '@pushrocks/smartnpm'; import * as smartnpm from '@push.rocks/smartnpm';
import * as smartopen from '@pushrocks/smartopen'; import * as smartopen from '@push.rocks/smartopen';
import * as smarttime from '@pushrocks/smarttime'; import * as smarttime from '@push.rocks/smarttime';
import * as smartversion from '@pushrocks/smartversion'; import * as smartversion from '@push.rocks/smartversion';
export { consolecolor, npmextra, smartnpm, smartopen, smarttime, smartversion }; export { consolecolor, npmextra, smartnpm, smartopen, smarttime, smartversion };