diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a4467e..a70f7eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,9 @@ stages: - release - metadata +before_script: + - npm install -g @shipzone/npmci + # ==================== # security stage # ==================== @@ -36,6 +39,7 @@ auditProductionDependencies: - 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 diff --git a/.vscode/launch.json b/.vscode/launch.json index 112db52..26e9f92 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,28 +2,10 @@ "version": "0.2.0", "configurations": [ { - "name": "current file", - "type": "node", + "command": "npm test", + "name": "Run npm test", "request": "launch", - "args": [ - "${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" + "type": "node-terminal" } ] } diff --git a/npmextra.json b/npmextra.json index d44ff6c..2294249 100644 --- a/npmextra.json +++ b/npmextra.json @@ -9,7 +9,7 @@ "githost": "gitlab.com", "gitscope": "pushrocks", "gitrepo": "smartnetwork", - "shortDescription": "network diagnostics", + "description": "network diagnostics", "npmPackagename": "@pushrocks/smartnetwork", "license": "MIT" } diff --git a/package.json b/package.json index cd6fd2d..039261a 100644 --- a/package.json +++ b/package.json @@ -42,4 +42,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/test/test.ping.ts b/test/test.ping.ts index 123a213..9375beb 100644 --- a/test/test.ping.ts +++ b/test/test.ping.ts @@ -1,4 +1,4 @@ -import {tap, expect, expectAsync} from '@pushrocks/tapbundle'; +import { tap, expect, expectAsync } from '@pushrocks/tapbundle'; import * as smartnetwork from '../ts'; @@ -7,10 +7,10 @@ let testSmartnetwork: smartnetwork.SmartNetwork; tap.test('should create a vlid instance of SmartNetwork', async () => { testSmartnetwork = new smartnetwork.SmartNetwork(); expect(testSmartnetwork).toBeInstanceOf(smartnetwork.SmartNetwork); -}) +}); tap.test('should send a ping to Google', async () => { expectAsync(testSmartnetwork.ping('https://lossless.com')).toBeTrue(); -}) +}); tap.start(); diff --git a/ts/index.ts b/ts/index.ts index 40c07a7..0439cfd 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1 +1 @@ -export * from './smartnetwork.classes.smartnetwork'; \ No newline at end of file +export * from './smartnetwork.classes.smartnetwork'; diff --git a/ts/smartnetwork.classes.cloudflarespeed.ts b/ts/smartnetwork.classes.cloudflarespeed.ts index 89a17d0..9ae99af 100644 --- a/ts/smartnetwork.classes.cloudflarespeed.ts +++ b/ts/smartnetwork.classes.cloudflarespeed.ts @@ -106,7 +106,7 @@ export class CloudflareSpeed { public async fetchServerLocations(): Promise<{ [key: string]: string }> { 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 const data1 = data; @@ -172,7 +172,7 @@ export class CloudflareSpeed { public async request(options: plugins.https.RequestOptions, data = ''): Promise { let started: number; let dnsLookup: number; - let tcpHandshake : number; + let tcpHandshake: number; let sslHandshake: number; let ttfb: number; let ended: number; diff --git a/ts/smartnetwork.classes.smartnetwork.ts b/ts/smartnetwork.classes.smartnetwork.ts index fd4d34e..c384f1c 100644 --- a/ts/smartnetwork.classes.smartnetwork.ts +++ b/ts/smartnetwork.classes.smartnetwork.ts @@ -17,7 +17,7 @@ export class SmartNetwork { } public async ping(hostArg: string, timeoutArg: number = 500): Promise { - if (process.getuid() !== 0 ) { + if (process.getuid() !== 0) { console.log('icmp not allowed for nonroot!'); return; } diff --git a/ts/smartnetwork.plugins.ts b/ts/smartnetwork.plugins.ts index e8d9439..5e14f71 100644 --- a/ts/smartnetwork.plugins.ts +++ b/ts/smartnetwork.plugins.ts @@ -13,7 +13,7 @@ export { smartpromise, smartstring }; // @third party scope const isopen = require('isopen'); -const icmp = require('icmp'); +const icmp = require('icmp'); import * as publicIp from 'public-ip'; import * as systeminformation from 'systeminformation';