fix(core): update
This commit is contained in:
parent
67f21d2500
commit
65756457aa
@ -12,40 +12,36 @@ stages:
|
|||||||
- release
|
- release
|
||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- pnpm install -g pnpm
|
||||||
|
- pnpm install -g @shipzone/npmci
|
||||||
|
- npmci npm prepare
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# security stage
|
||||||
|
# ====================
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
# ====================
|
# ====================
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
auditProductionDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --production --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
- npmci command pnpm audit --audit-level=high --prod
|
||||||
tags:
|
tags:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
auditDevDependencies:
|
auditDevDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
- 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:
|
tags:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
@ -56,7 +52,6 @@ auditDevDependencies:
|
|||||||
testStable:
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -67,7 +62,6 @@ testStable:
|
|||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command npm run build
|
- npmci command npm run build
|
||||||
@ -96,10 +90,9 @@ codequality:
|
|||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
@ -119,11 +112,9 @@ trigger:
|
|||||||
pages:
|
pages:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci node install lts
|
- npmci node install stable
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command tsdoc
|
- npmci command npm run buildDocs
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${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"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "pushrocks",
|
||||||
"gitrepo": "smartpdf",
|
"gitrepo": "smartpdf",
|
||||||
"shortDescription": "Create PDFs fast and smoothly",
|
"description": "Create PDFs fast and smoothly",
|
||||||
"npmPackagename": "@pushrocks/smartpdf",
|
"npmPackagename": "@pushrocks/smartpdf",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "(tstest test/ --web)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)"
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.65",
|
"@gitzone/tsbuild": "^2.1.65",
|
||||||
|
12
test/test.ts
12
test/test.ts
@ -39,17 +39,19 @@ tap.test('should create a valid PDFResult', async () => {
|
|||||||
}
|
}
|
||||||
fs.writeFileSync(`.nogit/${fileName}`, pdfResult.buffer as Buffer);
|
fs.writeFileSync(`.nogit/${fileName}`, pdfResult.buffer as Buffer);
|
||||||
};
|
};
|
||||||
await writePDfToDisk('https://maintainedby.lossless.com/', '1.pdf')
|
await writePDfToDisk('https://maintainedby.lossless.com/', '1.pdf');
|
||||||
await writePDfToDisk('https://rendertron.lossless.one/render/https://layer.io', '2.pdf')
|
await writePDfToDisk('https://rendertron.lossless.one/render/https://layer.io', '2.pdf');
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should combine pdfs', async () => {
|
tap.test('should combine pdfs', async () => {
|
||||||
const fs = await import('fs');
|
const fs = await import('fs');
|
||||||
const pdf1 = await testSmartPdf.readFileToPdfObject('.nogit/1.pdf');
|
const pdf1 = await testSmartPdf.readFileToPdfObject('.nogit/1.pdf');
|
||||||
const pdf2 = await testSmartPdf.readFileToPdfObject('.nogit/2.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 () => {
|
tap.test('should be able to close properly', async () => {
|
||||||
await testSmartPdf.stop();
|
await testSmartPdf.stop();
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smartpdf',
|
name: '@pushrocks/smartpdf',
|
||||||
version: '3.0.13',
|
version: '3.0.14',
|
||||||
description: 'create pdfs on the fly'
|
description: 'create pdfs on the fly'
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* pdf candidate is a construct used internally for mapping html
|
* pdf candidate is a construct used internally for mapping html
|
||||||
* to pdf buffers delivered by puppeteer
|
* to pdf buffers delivered by puppeteer
|
||||||
*/
|
*/
|
||||||
import * as plugins from './smartpdf.plugins.js';
|
import * as plugins from './smartpdf.plugins.js';
|
||||||
|
|
||||||
export class PdfCandidate {
|
export class PdfCandidate {
|
||||||
|
@ -193,7 +193,7 @@ export class SmartPdf {
|
|||||||
name: 'mergedPdf',
|
name: 'mergedPdf',
|
||||||
buffer: resultBuffer,
|
buffer: resultBuffer,
|
||||||
id: null,
|
id: null,
|
||||||
metadata: null
|
metadata: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,8 +205,8 @@ export class SmartPdf {
|
|||||||
name: parsedPath.base,
|
name: parsedPath.base,
|
||||||
buffer,
|
buffer,
|
||||||
id: null,
|
id: null,
|
||||||
metadata: null
|
metadata: null,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async extractTextFromPdfBuffer(pdfBufferArg: Buffer): Promise<string> {
|
public async extractTextFromPdfBuffer(pdfBufferArg: Buffer): Promise<string> {
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
import * as plugins from './smartpdf.plugins.js';
|
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),
|
||||||
|
'../'
|
||||||
|
);
|
||||||
|
@ -13,14 +13,20 @@ import * as smartpuppeteer from '@pushrocks/smartpuppeteer';
|
|||||||
import * as smartnetwork from '@pushrocks/smartnetwork';
|
import * as smartnetwork from '@pushrocks/smartnetwork';
|
||||||
import * as smartunique from '@pushrocks/smartunique';
|
import * as smartunique from '@pushrocks/smartunique';
|
||||||
|
|
||||||
export { smartfile, smartdelay, smartpromise, smartpath, smartpuppeteer, smartunique, smartnetwork };
|
export {
|
||||||
|
smartfile,
|
||||||
|
smartdelay,
|
||||||
|
smartpromise,
|
||||||
|
smartpath,
|
||||||
|
smartpuppeteer,
|
||||||
|
smartunique,
|
||||||
|
smartnetwork,
|
||||||
|
};
|
||||||
|
|
||||||
// tsclass scope
|
// tsclass scope
|
||||||
import * as tsclass from '@tsclass/tsclass';
|
import * as tsclass from '@tsclass/tsclass';
|
||||||
|
|
||||||
export {
|
export { tsclass };
|
||||||
tsclass
|
|
||||||
}
|
|
||||||
|
|
||||||
// thirdparty
|
// thirdparty
|
||||||
import pdfMerger from 'pdf-merger-js';
|
import pdfMerger from 'pdf-merger-js';
|
||||||
|
Loading…
Reference in New Issue
Block a user