fix(core): update

This commit is contained in:
Philipp Kunz 2022-02-17 00:18:23 +01:00
parent 695d047200
commit 95c3314400
9 changed files with 17 additions and 31 deletions

View File

@ -12,6 +12,9 @@ stages:
- release - release
- metadata - metadata
before_script:
- npm install -g @shipzone/npmci
# ==================== # ====================
# security stage # security stage
# ==================== # ====================
@ -36,6 +39,7 @@ auditProductionDependencies:
- npmci command npm audit --audit-level=high --only=prod --production - npmci command npm audit --audit-level=high --only=prod --production
tags: tags:
- docker - docker
allow_failure: true
auditDevDependencies: auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci image: registry.gitlab.com/hosttoday/ht-docker-node:npmci

24
.vscode/launch.json vendored
View File

@ -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"
} }
] ]
} }

View File

@ -9,7 +9,7 @@
"githost": "gitlab.com", "githost": "gitlab.com",
"gitscope": "pushrocks", "gitscope": "pushrocks",
"gitrepo": "smartnetwork", "gitrepo": "smartnetwork",
"shortDescription": "network diagnostics", "description": "network diagnostics",
"npmPackagename": "@pushrocks/smartnetwork", "npmPackagename": "@pushrocks/smartnetwork",
"license": "MIT" "license": "MIT"
} }

View File

@ -42,4 +42,4 @@
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
] ]
} }

View File

@ -1,4 +1,4 @@
import {tap, expect, expectAsync} from '@pushrocks/tapbundle'; import { tap, expect, expectAsync } from '@pushrocks/tapbundle';
import * as smartnetwork from '../ts'; import * as smartnetwork from '../ts';
@ -7,10 +7,10 @@ let testSmartnetwork: smartnetwork.SmartNetwork;
tap.test('should create a vlid instance of SmartNetwork', async () => { tap.test('should create a vlid instance of SmartNetwork', async () => {
testSmartnetwork = new smartnetwork.SmartNetwork(); testSmartnetwork = new smartnetwork.SmartNetwork();
expect(testSmartnetwork).toBeInstanceOf(smartnetwork.SmartNetwork); expect(testSmartnetwork).toBeInstanceOf(smartnetwork.SmartNetwork);
}) });
tap.test('should send a ping to Google', async () => { tap.test('should send a ping to Google', async () => {
expectAsync(testSmartnetwork.ping('https://lossless.com')).toBeTrue(); expectAsync(testSmartnetwork.ping('https://lossless.com')).toBeTrue();
}) });
tap.start(); tap.start();

View File

@ -1 +1 @@
export * from './smartnetwork.classes.smartnetwork'; export * from './smartnetwork.classes.smartnetwork';

View File

@ -106,7 +106,7 @@ export class CloudflareSpeed {
public async fetchServerLocations(): Promise<{ [key: string]: string }> { public async fetchServerLocations(): Promise<{ [key: string]: string }> {
const res = JSON.parse(await this.get('speed.cloudflare.com', '/locations')); const res = JSON.parse(await this.get('speed.cloudflare.com', '/locations'));
return res.reduce((data: any, optionsArg: { iata: string, city: string}) => { return res.reduce((data: any, optionsArg: { iata: string; city: string }) => {
// Bypass prettier "no-assign-param" rules // Bypass prettier "no-assign-param" rules
const data1 = data; const data1 = data;
@ -172,7 +172,7 @@ export class CloudflareSpeed {
public async request(options: plugins.https.RequestOptions, data = ''): Promise<number[]> { public async request(options: plugins.https.RequestOptions, data = ''): Promise<number[]> {
let started: number; let started: number;
let dnsLookup: number; let dnsLookup: number;
let tcpHandshake : number; let tcpHandshake: number;
let sslHandshake: number; let sslHandshake: number;
let ttfb: number; let ttfb: number;
let ended: number; let ended: number;

View File

@ -17,7 +17,7 @@ export class SmartNetwork {
} }
public async ping(hostArg: string, timeoutArg: number = 500): Promise<boolean> { public async ping(hostArg: string, timeoutArg: number = 500): Promise<boolean> {
if (process.getuid() !== 0 ) { if (process.getuid() !== 0) {
console.log('icmp not allowed for nonroot!'); console.log('icmp not allowed for nonroot!');
return; return;
} }

View File

@ -13,7 +13,7 @@ export { smartpromise, smartstring };
// @third party scope // @third party scope
const isopen = require('isopen'); const isopen = require('isopen');
const icmp = require('icmp'); const icmp = require('icmp');
import * as publicIp from 'public-ip'; import * as publicIp from 'public-ip';
import * as systeminformation from 'systeminformation'; import * as systeminformation from 'systeminformation';