From 046059d2281bea2b528db8e6f2227d3000e8933e Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 6 Oct 2020 15:05:29 +0000 Subject: [PATCH] fix(core): update --- .gitlab-ci.yml | 26 +++++++++++++++++-------- .vscode/settings.json | 2 +- package.json | 5 ++++- readme.md | 8 ++++---- test/test.ts | 8 ++++---- ts/typedrequest.classes.typedhandler.ts | 6 +++--- ts/typedrequest.classes.typedrequest.ts | 13 +++++-------- 7 files changed, 39 insertions(+), 29 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ebc8b5..9a4467e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,23 +19,35 @@ 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 + +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 +62,7 @@ testStable: - npmci npm test coverage: /\d+.?\d+?\%\s*coverage/ tags: - - lossless - docker - - priv testBuild: stage: test @@ -63,9 +73,7 @@ testBuild: - npmci command npm run build coverage: /\d+.?\d+?\%\s*coverage/ tags: - - lossless - docker - - notpriv release: stage: release @@ -85,6 +93,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/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/package.json b/package.json index d1f3156..d46bd25 100644 --- a/package.json +++ b/package.json @@ -41,5 +41,8 @@ "cli.js", "npmextra.json", "readme.md" + ], + "browserslist": [ + "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/readme.md b/readme.md index 8acbf58..17e4bfe 100644 --- a/readme.md +++ b/readme.md @@ -49,9 +49,9 @@ interface ITestReqRes { tap.test('should create a typedHandler', async () => { // lets use the interface in a TypedHandler - testTypedHandler = new typedrequest.TypedHandler('hi', async reqArg => { + testTypedHandler = new typedrequest.TypedHandler('hi', async (reqArg) => { return { - surname: 'wow' + surname: 'wow', }; }); }); @@ -60,7 +60,7 @@ tap.test('should spawn a server to test with', async () => { testServer = new smartexpress.Server({ cors: true, forceSsl: false, - port: 3000 + port: 3000, }); }); @@ -83,7 +83,7 @@ tap.test('should fire a request', async () => { 'hi' ); const response = await typedRequest.fire({ - name: 'really' + name: 'really', }); console.log('this is the response:'); console.log(response); diff --git a/test/test.ts b/test/test.ts index 29296c5..dab883b 100644 --- a/test/test.ts +++ b/test/test.ts @@ -19,9 +19,9 @@ interface ITestReqRes { tap.test('should create a typedHandler', async () => { // lets use the interface in a TypedHandler - testTypedHandler = new typedrequest.TypedHandler('hi', async reqArg => { + testTypedHandler = new typedrequest.TypedHandler('hi', async (reqArg) => { return { - surname: 'wow' + surname: 'wow', }; }); }); @@ -30,7 +30,7 @@ tap.test('should spawn a server to test with', async () => { testServer = new smartexpress.Server({ cors: true, forceSsl: false, - port: 3000 + port: 3000, }); }); @@ -53,7 +53,7 @@ tap.test('should fire a request', async () => { 'hi' ); const response = await typedRequest.fire({ - name: 'really' + name: 'really', }); console.log('this is the response:'); console.log(response); diff --git a/ts/typedrequest.classes.typedhandler.ts b/ts/typedrequest.classes.typedhandler.ts index a034c40..5bb1367 100644 --- a/ts/typedrequest.classes.typedhandler.ts +++ b/ts/typedrequest.classes.typedhandler.ts @@ -28,7 +28,7 @@ export class TypedHandler { + const response = await this.handlerFunction(typedRequestArg.request).catch((e) => { if (e instanceof TypedResponseError) { typedResponseError = e; } else { @@ -39,7 +39,7 @@ export class TypedHandler; // having a typedrouter allows us to work with async request response cycles. if (this.typedRouterRef) {