Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
2abac29dff | |||
293da8859d | |||
111ef1fe44 | |||
97b285be5c | |||
cc659a57f7 | |||
f5cb86b53e |
@ -12,6 +12,9 @@ stages:
|
|||||||
- release
|
- release
|
||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- npm install -g @shipzone/npmci
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
# ====================
|
# ====================
|
||||||
@ -19,23 +22,35 @@ mirror:
|
|||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
|
||||||
audit:
|
auditProductionDependencies:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci command npm install --production --ignore-scripts
|
||||||
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high --only=prod --production
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
auditDevDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
- npmci command npm audit --audit-level=high
|
- npmci command npm audit --audit-level=high --only=dev
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
@ -51,9 +66,7 @@ testStable:
|
|||||||
- npmci npm test
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- priv
|
|
||||||
|
|
||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
@ -64,9 +77,7 @@ testBuild:
|
|||||||
- npmci command npm run build
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
@ -86,11 +97,12 @@ release:
|
|||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"projectType": {
|
"projectType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["website", "element", "service", "npm"]
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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",
|
||||||
"shortDescription": "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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9368
package-lock.json
generated
9368
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartupdate",
|
"name": "@push.rocks/smartupdate",
|
||||||
"version": "2.0.2",
|
"version": "2.0.5",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "update your tools in a smart way",
|
"description": "update your tools in a smart way",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -13,21 +13,19 @@
|
|||||||
"build": "(tsbuild --web --allowimplicitany)"
|
"build": "(tsbuild --web --allowimplicitany)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.61",
|
"@gitzone/tsbuild": "^2.1.66",
|
||||||
"@gitzone/tsrun": "^1.2.32",
|
"@gitzone/tsrun": "^1.2.44",
|
||||||
"@gitzone/tstest": "^1.0.70",
|
"@gitzone/tstest": "^1.0.77",
|
||||||
"@pushrocks/tapbundle": "^5.0.3",
|
"@push.rocks/tapbundle": "^5.0.12",
|
||||||
"@types/node": "^17.0.23",
|
"@types/node": "^20.4.5"
|
||||||
"tslint": "^6.1.3",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"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": "^2.0.7"
|
"@push.rocks/smartversion": "^3.0.2"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
@ -40,5 +38,8 @@
|
|||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
5382
pnpm-lock.yaml
generated
Normal file
5382
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
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 * 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,18 +16,18 @@ 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',
|
||||||
performedUpgrade: false
|
performedUpgrade: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// the comparison data from the keyValue store
|
// the comparison data from the keyValue store
|
||||||
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;
|
||||||
|
@ -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 };
|
||||||
|
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "nodenext"
|
||||||
|
}
|
||||||
|
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Reference in New Issue
Block a user