From 37e47fc33fc2df54a6a693a97c341f8fadf9d515 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 4 Jun 2019 11:29:30 +0200 Subject: [PATCH] fix(core): update --- .gitignore | 3 +-- .gitlab-ci.yml | 15 +++------------ package.json | 2 +- test/test.ts | 4 +++- ts/interfaces/index.ts | 2 +- ts/interfaces/interface.pdfresult.ts | 4 ++-- ts/smartpdf.classes.smartpdf.ts | 4 ++-- 7 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 0865b11..91c0db0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,4 @@ dist_web/ dist_serve/ dist_ts_web/ -# custom -assets/pdfdir +# custom \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1c84099..bb38cf7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -# gitzone standard +# gitzone ci_default image: hosttoday/ht-docker-node:npmci cache: @@ -78,19 +78,10 @@ release: # ==================== codequality: stage: metadata - image: docker:stable allow_failure: true - services: - - docker:stable-dind script: - - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/') - - docker run - --env SOURCE_CODE="$PWD" - --volume "$PWD":/code - --volume /var/run/docker.sock:/var/run/docker.sock - "registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code - artifacts: - paths: [codeclimate.json] + - npm install -g tslint typescript + - tslint -c tslint.json ./ts/**/*.ts tags: - docker - priv diff --git a/package.json b/package.json index ee11367..0de3578 100644 --- a/package.json +++ b/package.json @@ -38,4 +38,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index 8988f7b..e1716d4 100644 --- a/test/test.ts +++ b/test/test.ts @@ -25,7 +25,9 @@ tap.test('should create a pdf from website as single page PDF', async () => { }); tap.test('should create a valid PDFResult', async () => { - const pdfResult = await testSmartPdf.getFullWebsiteAsSinglePdf('https://maintainedby.lossless.com'); + const pdfResult = await testSmartPdf.getFullWebsiteAsSinglePdf( + 'https://maintainedby.lossless.com' + ); expect(pdfResult.buffer).to.be.instanceOf(Buffer); }); diff --git a/ts/interfaces/index.ts b/ts/interfaces/index.ts index b911c7d..51fff64 100644 --- a/ts/interfaces/index.ts +++ b/ts/interfaces/index.ts @@ -1 +1 @@ -export * from './interface.pdfresult'; \ No newline at end of file +export * from './interface.pdfresult'; diff --git a/ts/interfaces/interface.pdfresult.ts b/ts/interfaces/interface.pdfresult.ts index 31e6ce2..688cfbd 100644 --- a/ts/interfaces/interface.pdfresult.ts +++ b/ts/interfaces/interface.pdfresult.ts @@ -1,5 +1,5 @@ export interface IPdfResult { - name: string, - id: string, + name: string; + id: string; buffer: Buffer; } diff --git a/ts/smartpdf.classes.smartpdf.ts b/ts/smartpdf.classes.smartpdf.ts index 53efed6..6d323ea 100644 --- a/ts/smartpdf.classes.smartpdf.ts +++ b/ts/smartpdf.classes.smartpdf.ts @@ -21,7 +21,7 @@ export class SmartPdf { async start(headlessBrowserArg?) { // lets set the external browser in case one is provided - this.headlessBrowser = headlessBrowserArg + this.headlessBrowser = headlessBrowserArg; // setup puppeteer if (this.headlessBrowser) { this.externalBrowserBool = true; @@ -50,7 +50,7 @@ export class SmartPdf { this.htmlServerInstance.close(() => { done.resolve(); }); - + if (!this.externalBrowserBool) { await this.headlessBrowser.close(); }