11 Commits

Author SHA1 Message Date
c13a125ac7 2.0.0 2022-03-24 14:58:00 +01:00
8f6949b1b8 1.0.23 2022-03-24 14:57:17 +01:00
9b698c6dea fix(core): update 2022-03-24 14:57:16 +01:00
157bcff7c4 1.0.22 2021-11-07 20:42:50 +01:00
934423f0ad fix(core): update 2021-11-07 20:42:49 +01:00
e6d7fdced6 1.0.21 2021-11-07 20:21:04 +01:00
2fc4e691ac fix(core): update 2021-11-07 20:21:03 +01:00
7e8035ea61 1.0.20 2021-04-29 15:26:08 +00:00
1bc3112bb7 fix(core): update 2021-04-29 15:26:08 +00:00
4a177fd166 1.0.19 2021-04-29 14:52:28 +00:00
c1cf019af2 fix(core): update 2021-04-29 14:52:28 +00:00
9 changed files with 15493 additions and 2098 deletions

View File

@ -12,6 +12,9 @@ stages:
- release
- metadata
before_script:
- npm install -g @shipzone/npmci
# ====================
# security stage
# ====================
@ -19,23 +22,36 @@ mirror:
stage: security
script:
- npmci git mirror
only:
- tags
tags:
- lossless
- docker
- 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
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
- npmci command npm audit --audit-level=high --only=dev
tags:
- lossless
- docker
- notpriv
allow_failure: true
# ====================
# test stage
@ -50,9 +66,7 @@ testStable:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
@ -63,9 +77,7 @@ testBuild:
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
@ -85,6 +97,8 @@ release:
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare

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

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

17476
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,13 @@
{
"name": "@pushrocks/smartbrowser",
"version": "1.0.18",
"version": "2.0.0",
"description": "simplified puppeteer",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"scripts": {
"test": "(tstest test/ --web)",
"build": "(tsbuild --web)"
"build": "(tsbuild --web --allowimplicitany)"
},
"repository": {
"type": "git",
@ -19,16 +20,16 @@
},
"homepage": "https://gitlab.com/pushrocks/smartbrowser#README",
"dependencies": {
"@pushrocks/smartdelay": "^2.0.9",
"@pushrocks/smartpdf": "^2.0.2",
"@pushrocks/smartpuppeteer": "^1.0.15",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartpdf": "^3.0.0",
"@pushrocks/smartpuppeteer": "^2.0.0",
"@pushrocks/smartunique": "^3.0.3"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.24",
"@gitzone/tstest": "^1.0.32",
"@pushrocks/tapbundle": "^3.2.1",
"tslint": "^6.1.2",
"@gitzone/tsbuild": "^2.1.60",
"@gitzone/tstest": "^1.0.69",
"@pushrocks/tapbundle": "^5.0.3",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"private": false,
@ -43,5 +44,8 @@
"cli.js",
"npmextra.json",
"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/)
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 (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)
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.
## 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). :)

View File

@ -1,25 +1,25 @@
import { tap, expect } from '@pushrocks/tapbundle';
import { tap, expect, expectAsync } from '@pushrocks/tapbundle';
import * as smartbrowser from '../ts/index';
import * as smartbrowser from '../ts/index.js';
let testSmartBrowser: smartbrowser.SmartBrowser;
tap.test('should instanstiate a new browser ', async () => {
testSmartBrowser = new smartbrowser.SmartBrowser();
return expect(testSmartBrowser).to.be.instanceof(smartbrowser.SmartBrowser);
return expect(testSmartBrowser).toBeInstanceOf(smartbrowser.SmartBrowser);
});
tap.test('should start the browser ', async () => {
await expect(testSmartBrowser.start()).to.eventually.be.fulfilled;
await testSmartBrowser.start();
});
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');
expect(result.buffer).to.be.instanceOf(Buffer);
expect(result.buffer).toBeInstanceOf(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');
expect(result.buffer).to.be.instanceOf(Buffer);
expect(result.buffer).toBeInstanceOf(Buffer);
});
tap.test('should evalute something in the browser', async () => {
@ -30,7 +30,7 @@ tap.test('should evalute something in the browser', async () => {
});
tap.test('should stop the browser ', async () => {
await expect(testSmartBrowser.stop()).to.eventually.be.fulfilled;
await testSmartBrowser.stop();
});
tap.start();

View File

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

View File

@ -1 +1 @@
export * from './interfaces.screenshotresult';
export * from './interfaces.screenshotresult.js';