fix(core): update

This commit is contained in:
Philipp Kunz 2022-10-26 23:04:59 +02:00
parent 67f21d2500
commit 65756457aa
10 changed files with 52 additions and 67 deletions

View File

@ -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

24
.vscode/launch.json vendored
View File

@ -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"
}
]
}

View File

@ -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"
}

View File

@ -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"
]
}
}

View File

@ -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();

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartpdf',
version: '3.0.13',
version: '3.0.14',
description: 'create pdfs on the fly'
}

View File

@ -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 {

View File

@ -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<string> {

View File

@ -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),
'../'
);

View File

@ -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';