diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ebc8b5..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 # ==================== @@ -19,23 +22,36 @@ mirror: stage: security script: - npmci git mirror + only: + - tags tags: - lossless - docker - 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 stage: security script: - npmci npm prepare - npmci command npm install --ignore-scripts - 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: - - lossless - docker - - notpriv + allow_failure: true # ==================== # test stage @@ -50,9 +66,7 @@ testStable: - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - - lossless - docker - - priv testBuild: stage: test @@ -63,9 +77,7 @@ testBuild: - npmci command npm run build coverage: /\d+.?\d+?\%\s*coverage/ tags: - - lossless - docker - - notpriv release: stage: release @@ -85,6 +97,8 @@ release: codequality: stage: metadata allow_failure: true + only: + - tags script: - npmci command npm install -g tslint typescript - npmci npm prepare 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/.vscode/settings.json b/.vscode/settings.json index 01d2b8d..3648eaa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,7 +15,7 @@ "properties": { "projectType": { "type": "string", - "enum": ["website", "element", "service", "npm"] + "enum": ["website", "element", "service", "npm", "wcc"] } } } diff --git a/npmextra.json b/npmextra.json index 52dec96..75613df 100644 --- a/npmextra.json +++ b/npmextra.json @@ -9,7 +9,7 @@ "githost": "gitlab.com", "gitscope": "pushrocks", "gitrepo": "smartlog-receiver", - "shortDescription": "a receiver for smartlog-destination-receiver", + "description": "a receiver for smartlog-destination-receiver", "npmPackagename": "@pushrocks/smartlog-receiver", "license": "MIT" } diff --git a/package.json b/package.json index e42a2cf..cd214b2 100644 --- a/package.json +++ b/package.json @@ -36,5 +36,8 @@ "cli.js", "npmextra.json", "readme.md" + ], + "browserslist": [ + "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index d75805f..3ebde82 100644 --- a/test/test.ts +++ b/test/test.ts @@ -7,7 +7,7 @@ import * as smartlogReceiver from '../ts/index'; let testReceiver: smartlogReceiver.SmartlogReceiver; let testSmartlog = new smartlog.Smartlog({ logContext: null, - minimumLogLevel: 'debug' + minimumLogLevel: 'debug', }); testSmartlog.enableConsole(); @@ -17,7 +17,7 @@ tap.test('should create a valid SmartlogReceiver', async () => { smartlogInstance: testSmartlog, validatorFunction: async () => { return true; - } + }, }); expect(testReceiver).toBeInstanceOf(smartlogReceiver.SmartlogReceiver); }); @@ -33,16 +33,16 @@ tap.test('should receive a message', async () => { containerName: null, environment: 'staging', runtime: 'node', - zone: 'gitzone' + zone: 'gitzone', }, level: 'info', type: 'log', correlation: { id: '123', - type: 'none' + type: 'none', }, - message: 'hi there' - } + message: 'hi there', + }, }); }); diff --git a/ts/sl.classes.smartlogreceiver.ts b/ts/sl.classes.smartlogreceiver.ts index f3f593b..6abc8ef 100644 --- a/ts/sl.classes.smartlogreceiver.ts +++ b/ts/sl.classes.smartlogreceiver.ts @@ -3,7 +3,7 @@ import * as plugins from './sl.receiver.plugins'; import { ILogPackage, ILogPackageAuthenticated, - ILogDestination + ILogDestination, } from '@pushrocks/smartlog-interfaces'; export type TValidatorFunction = (logPackage: ILogPackage) => Promise; @@ -26,7 +26,7 @@ export class SmartlogReceiver { this.passphrase = smartlogReceiverOptions.passphrase; this.validatorFunction = smartlogReceiverOptions.validatorFunction || - (async logpackageArg => { + (async (logpackageArg) => { return true; }); this.smartlogInstance = smartlogReceiverOptions.smartlogInstance;