fix(core): update

This commit is contained in:
Philipp Kunz 2021-04-29 14:52:28 +00:00
parent 9ecf7c81d4
commit c1cf019af2
7 changed files with 9314 additions and 1259 deletions

View File

@ -19,23 +19,35 @@ mirror:
stage: security stage: security
script: script:
- npmci git mirror - npmci git mirror
only:
- tags
tags: tags:
- lossless - lossless
- docker - docker
- notpriv - 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 image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security stage: security
script: script:
- npmci npm prepare - npmci npm prepare
- npmci command npm install --ignore-scripts - 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 - npmci command npm audit --audit-level=high --only=dev
tags: tags:
- lossless
- docker - docker
- notpriv allow_failure: true
# ==================== # ====================
# test stage # test stage
@ -50,9 +62,7 @@ testStable:
- npmci npm test - npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- priv
testBuild: testBuild:
stage: test stage: test
@ -63,9 +73,7 @@ testBuild:
- npmci command npm run build - npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- lossless
- docker - docker
- notpriv
release: release:
stage: release stage: release
@ -85,6 +93,8 @@ release:
codequality: codequality:
stage: metadata stage: metadata
allow_failure: true allow_failure: true
only:
- tags
script: script:
- npmci command npm install -g tslint typescript - npmci command npm install -g tslint typescript
- npmci npm prepare - npmci npm prepare

View File

@ -15,7 +15,7 @@
"properties": { "properties": {
"projectType": { "projectType": {
"type": "string", "type": "string",
"enum": ["website", "element", "service", "npm"] "enum": ["website", "element", "service", "npm", "wcc"]
} }
} }
} }

10513
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,16 +19,16 @@
}, },
"homepage": "https://gitlab.com/pushrocks/smartbrowser#README", "homepage": "https://gitlab.com/pushrocks/smartbrowser#README",
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.9", "@pushrocks/smartdelay": "^2.0.10",
"@pushrocks/smartpdf": "^2.0.2", "@pushrocks/smartpdf": "^2.0.8",
"@pushrocks/smartpuppeteer": "^1.0.15", "@pushrocks/smartpuppeteer": "^1.0.21",
"@pushrocks/smartunique": "^3.0.3" "@pushrocks/smartunique": "^3.0.3"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.24", "@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.32", "@gitzone/tstest": "^1.0.52",
"@pushrocks/tapbundle": "^3.2.1", "@pushrocks/tapbundle": "^3.2.14",
"tslint": "^6.1.2", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },
"private": false, "private": false,
@ -43,5 +43,8 @@
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
],
"browserslist": [
"last 1 chrome versions"
] ]
} }

View File

@ -19,7 +19,7 @@ TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartbrowser)](https://lossless.cloud) PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartbrowser)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartbrowser)](https://lossless.cloud) PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartbrowser)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartbrowser)](https://lossless.cloud) BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartbrowser)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud) Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
@ -27,7 +27,6 @@ Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20W
Use TypeScript for best in class instellisense. Use TypeScript for best in class instellisense.
## Contribution ## Contribution
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)

View File

@ -12,12 +12,12 @@ tap.test('should start the browser ', async () => {
await expect(testSmartBrowser.start()).to.eventually.be.fulfilled; await expect(testSmartBrowser.start()).to.eventually.be.fulfilled;
}); });
tap.test('should create a PDF from a page', async tools => { tap.test('should create a PDF from a page', async (tools) => {
const result = await testSmartBrowser.pdfFromPage('https://lossless.com'); const result = await testSmartBrowser.pdfFromPage('https://lossless.com');
expect(result.buffer).to.be.instanceOf(Buffer); expect(result.buffer).to.be.instanceOf(Buffer);
}); });
tap.test('should produce a valid screenshot', async tools => { tap.test('should produce a valid screenshot', async (tools) => {
const result = await testSmartBrowser.screenshotFromPage('https://lossless.com'); const result = await testSmartBrowser.screenshotFromPage('https://lossless.com');
expect(result.buffer).to.be.instanceOf(Buffer); expect(result.buffer).to.be.instanceOf(Buffer);
}); });

View File

@ -43,16 +43,16 @@ export class SmartBrowser {
const pageId = plugins.smartunique.shortId(); const pageId = plugins.smartunique.shortId();
const page = await this.headlessBrowser.newPage(); const page = await this.headlessBrowser.newPage();
await page.goto(urlArg, { await page.goto(urlArg, {
waitUntil: 'networkidle2' waitUntil: 'networkidle2',
}); });
const screenshotBuffer = await page.screenshot({ const screenshotBuffer = await page.screenshot({
encoding: 'binary' encoding: 'binary',
}); });
await page.close(); await page.close();
return { return {
name: pageId, name: pageId,
id: `${pageId}.js`, id: `${pageId}.js`,
buffer: screenshotBuffer buffer: screenshotBuffer,
}; };
} }
@ -64,7 +64,7 @@ export class SmartBrowser {
public async evaluateOnPage<T>(urlArg: string, funcArg: () => Promise<T>) { public async evaluateOnPage<T>(urlArg: string, funcArg: () => Promise<T>) {
const page = await this.headlessBrowser.newPage(); const page = await this.headlessBrowser.newPage();
await page.goto(urlArg, { await page.goto(urlArg, {
waitUntil: 'networkidle2' waitUntil: 'networkidle2',
}); });
const result = await page.evaluate(funcArg); const result = await page.evaluate(funcArg);
await page.close(); await page.close();