From 65756457aaad63ce5c9e8d0635e354a35e61d901 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 26 Oct 2022 23:04:59 +0200 Subject: [PATCH] fix(core): update --- .gitlab-ci.yml | 43 ++++++++++++----------------- .vscode/launch.json | 24 ++-------------- npmextra.json | 2 +- package.json | 5 ++-- test/test.ts | 12 ++++---- ts/00_commitinfo_data.ts | 2 +- ts/smartpdf.classes.pdfcandidate.ts | 6 ++-- ts/smartpdf.classes.smartpdf.ts | 6 ++-- ts/smartpdf.paths.ts | 5 +++- ts/smartpdf.plugins.ts | 14 +++++++--- 10 files changed, 52 insertions(+), 67 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a4467e..30b07d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,40 +12,36 @@ stages: - release - metadata +before_script: + - pnpm install -g pnpm + - pnpm install -g @shipzone/npmci + - npmci npm prepare + +# ==================== +# security stage +# ==================== # ==================== # security stage # ==================== -mirror: - stage: security - script: - - npmci git mirror - only: - - tags - tags: - - lossless - - docker - - notpriv - 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 + - npmci command npm config set registry https://registry.npmjs.org + - npmci command pnpm audit --audit-level=high --prod tags: + - lossless - 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 --only=dev + - npmci command pnpm audit --audit-level=high --dev tags: + - lossless - docker allow_failure: true @@ -56,7 +52,6 @@ auditDevDependencies: testStable: stage: test script: - - npmci npm prepare - npmci node install stable - npmci npm install - npmci npm test @@ -67,7 +62,6 @@ testStable: testBuild: stage: test script: - - npmci npm prepare - npmci node install stable - npmci npm install - npmci command npm run build @@ -96,10 +90,9 @@ codequality: only: - tags script: - - npmci command npm install -g tslint typescript + - npmci command npm install -g typescript - npmci npm prepare - npmci npm install - - npmci command "tslint -c tslint.json ./ts/**/*.ts" tags: - lossless - docker @@ -119,11 +112,9 @@ trigger: pages: stage: metadata script: - - npmci node install lts - - npmci command npm install -g @gitzone/tsdoc - - npmci npm prepare + - npmci node install stable - npmci npm install - - npmci command tsdoc + - npmci command npm run buildDocs tags: - lossless - docker 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 daabd05..6465570 100644 --- a/npmextra.json +++ b/npmextra.json @@ -9,7 +9,7 @@ "githost": "gitlab.com", "gitscope": "pushrocks", "gitrepo": "smartpdf", - "shortDescription": "Create PDFs fast and smoothly", + "description": "Create PDFs fast and smoothly", "npmPackagename": "@pushrocks/smartpdf", "license": "MIT" } diff --git a/package.json b/package.json index eec64a6..f3defc8 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "license": "MIT", "scripts": { "test": "(tstest test/ --web)", - "build": "(tsbuild --web --allowimplicitany)" + "build": "(tsbuild --web --allowimplicitany)", + "buildDocs": "tsdoc" }, "devDependencies": { "@gitzone/tsbuild": "^2.1.65", @@ -49,4 +50,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index 494d6ac..ce0be06 100644 --- a/test/test.ts +++ b/test/test.ts @@ -39,17 +39,19 @@ tap.test('should create a valid PDFResult', async () => { } fs.writeFileSync(`.nogit/${fileName}`, pdfResult.buffer as Buffer); }; - await writePDfToDisk('https://maintainedby.lossless.com/', '1.pdf') - await writePDfToDisk('https://rendertron.lossless.one/render/https://layer.io', '2.pdf') + await writePDfToDisk('https://maintainedby.lossless.com/', '1.pdf'); + await writePDfToDisk('https://rendertron.lossless.one/render/https://layer.io', '2.pdf'); }); tap.test('should combine pdfs', async () => { const fs = await import('fs'); const pdf1 = await testSmartPdf.readFileToPdfObject('.nogit/1.pdf'); const pdf2 = await testSmartPdf.readFileToPdfObject('.nogit/2.pdf'); - fs.writeFileSync(`.nogit/combined.pdf`, (await testSmartPdf.mergePdfs([pdf1, pdf2])).buffer as Buffer); - -}) + fs.writeFileSync( + `.nogit/combined.pdf`, + (await testSmartPdf.mergePdfs([pdf1, pdf2])).buffer as Buffer + ); +}); tap.test('should be able to close properly', async () => { await testSmartPdf.stop(); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index acba0ef..bf2c4d1 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartpdf', - version: '3.0.13', + version: '3.0.14', description: 'create pdfs on the fly' } diff --git a/ts/smartpdf.classes.pdfcandidate.ts b/ts/smartpdf.classes.pdfcandidate.ts index 341a336..1e9878b 100644 --- a/ts/smartpdf.classes.pdfcandidate.ts +++ b/ts/smartpdf.classes.pdfcandidate.ts @@ -1,7 +1,7 @@ /* -* pdf candidate is a construct used internally for mapping html -* to pdf buffers delivered by puppeteer -*/ + * pdf candidate is a construct used internally for mapping html + * to pdf buffers delivered by puppeteer + */ import * as plugins from './smartpdf.plugins.js'; export class PdfCandidate { diff --git a/ts/smartpdf.classes.smartpdf.ts b/ts/smartpdf.classes.smartpdf.ts index eb5f975..38e22d7 100644 --- a/ts/smartpdf.classes.smartpdf.ts +++ b/ts/smartpdf.classes.smartpdf.ts @@ -193,7 +193,7 @@ export class SmartPdf { name: 'mergedPdf', buffer: resultBuffer, id: null, - metadata: null + metadata: null, }; } @@ -205,8 +205,8 @@ export class SmartPdf { name: parsedPath.base, buffer, id: null, - metadata: null - } + metadata: null, + }; } public async extractTextFromPdfBuffer(pdfBufferArg: Buffer): Promise { diff --git a/ts/smartpdf.paths.ts b/ts/smartpdf.paths.ts index 342f05e..df5dba0 100644 --- a/ts/smartpdf.paths.ts +++ b/ts/smartpdf.paths.ts @@ -1,3 +1,6 @@ import * as plugins from './smartpdf.plugins.js'; -export const packageDir = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../'); +export const packageDir = plugins.path.join( + plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), + '../' +); diff --git a/ts/smartpdf.plugins.ts b/ts/smartpdf.plugins.ts index 785d790..e9661a2 100644 --- a/ts/smartpdf.plugins.ts +++ b/ts/smartpdf.plugins.ts @@ -13,14 +13,20 @@ import * as smartpuppeteer from '@pushrocks/smartpuppeteer'; import * as smartnetwork from '@pushrocks/smartnetwork'; import * as smartunique from '@pushrocks/smartunique'; -export { smartfile, smartdelay, smartpromise, smartpath, smartpuppeteer, smartunique, smartnetwork }; +export { + smartfile, + smartdelay, + smartpromise, + smartpath, + smartpuppeteer, + smartunique, + smartnetwork, +}; // tsclass scope import * as tsclass from '@tsclass/tsclass'; -export { - tsclass -} +export { tsclass }; // thirdparty import pdfMerger from 'pdf-merger-js';