Compare commits

..

13 Commits

Author SHA1 Message Date
d4232decdd 2.0.1 2022-07-18 02:48:47 +02:00
76999d8720 fix(core): update 2022-07-18 02:48:46 +02:00
407ccf66b9 2.0.0 2022-03-24 13:51:13 +01:00
72e6ef04cb BREAKING CHANGE(core): switch to esm 2022-03-24 13:51:12 +01:00
d3732dcecc 1.0.36 2021-11-07 19:51:50 +01:00
a10b42270c fix(core): update 2021-11-07 19:51:50 +01:00
b2efe28f4d 1.0.35 2021-11-07 19:33:10 +01:00
1ab34d909b fix(core): update 2021-11-07 19:33:09 +01:00
09a8888d47 1.0.34 2021-11-07 18:55:11 +01:00
243beb2c75 1.0.33 2021-11-07 18:50:23 +01:00
c6fd1bea7a fix(core): update 2021-11-07 18:50:22 +01:00
4f94fa31ac 1.0.32 2021-11-07 18:38:16 +01:00
ac61d8ff4d fix(core): update 2021-11-07 18:38:15 +01:00
10 changed files with 3737 additions and 19573 deletions

View File

@@ -7,12 +7,59 @@ cache:
key: '$CI_BUILD_STAGE' key: '$CI_BUILD_STAGE'
stages: stages:
- only - security
- test
- release
- metadata
before_script:
- npm install -g @shipzone/npmci
# ====================
# 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
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 --only=dev
tags:
- docker
allow_failure: true
# ====================
# test stage
# ====================
testStable: testStable:
stage: only stage: test
script: script:
- whereis google-chrome
- npmci npm prepare - npmci npm prepare
- npmci node install stable - npmci node install stable
- npmci npm install - npmci npm install
@@ -21,3 +68,74 @@ testStable:
tags: tags:
- docker - docker
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
only:
- tags
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

23109
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,29 +1,27 @@
{ {
"name": "@pushrocks/smartpuppeteer", "name": "@pushrocks/smartpuppeteer",
"version": "1.0.31", "version": "2.0.1",
"private": false, "private": false,
"description": "simplified access to puppeteer", "description": "simplified access to puppeteer",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/)", "test": "tstest test/",
"build": "(tsbuild --web)", "build": "tsbuild --web --allowimplicitany"
"format": "(gitzone format)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.28", "@gitzone/tsbuild": "^2.1.63",
"@gitzone/tstest": "^1.0.59", "@gitzone/tstest": "^1.0.71",
"@pushrocks/tapbundle": "^3.2.14", "@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^16.11.6", "@types/node": "^18.0.6"
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.13", "@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16", "@pushrocks/smartshell": "^2.0.30",
"puppeteer": "^11.0.0", "puppeteer": "^15.4.0",
"tree-kill": "^1.2.2" "tree-kill": "^1.2.2"
}, },
"files": [ "files": [

View File

@@ -1,5 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as smartpuppeteer from '../ts/index'; import * as smartpuppeteer from '../ts/index.js';
tap.test('first test', async (tools) => { tap.test('first test', async (tools) => {
const headlessBrowser = await smartpuppeteer.getEnvAwareBrowserInstance({ const headlessBrowser = await smartpuppeteer.getEnvAwareBrowserInstance({

8
ts/00_commitinfo_data.ts Normal file
View File

@@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartpuppeteer',
version: '2.0.1',
description: 'simplified access to puppeteer'
}

View File

@@ -1,8 +1,8 @@
// module exports // module exports
export * from './smartpuppeteer.classes.smartpuppeteer'; export * from './smartpuppeteer.classes.smartpuppeteer.js';
export * from './smartpuppeteer.classes.incognitobrowser'; export * from './smartpuppeteer.classes.incognitobrowser.js';
// direct exports // direct exports
import { puppeteer } from './smartpuppeteer.plugins'; import { puppeteer } from './smartpuppeteer.plugins.js';
export { puppeteer }; export { puppeteer };

View File

@@ -1,5 +1,5 @@
import { getEnvAwareBrowserInstance } from './smartpuppeteer.classes.smartpuppeteer'; import { getEnvAwareBrowserInstance } from './smartpuppeteer.classes.smartpuppeteer.js';
import * as plugins from './smartpuppeteer.plugins'; import * as plugins from './smartpuppeteer.plugins.js';
export class IncognitoBrowser { export class IncognitoBrowser {
public status: 'started' | 'stopped' = 'stopped'; public status: 'started' | 'stopped' = 'stopped';
@@ -28,7 +28,7 @@ export class IncognitoBrowser {
*/ */
public async stop() { public async stop() {
this.status = 'stopped'; this.status = 'stopped';
plugins.treeKill(this.browser.process().pid, 'SIGKILL'); plugins.treeKill(this.browser.process()?.pid as number, 'SIGKILL');
await this.browser.close(); await this.browser.close();
} }

View File

@@ -1,4 +1,4 @@
import * as plugins from './smartpuppeteer.plugins'; import * as plugins from './smartpuppeteer.plugins.js';
export interface IEnvAwareOptions { export interface IEnvAwareOptions {
forceNoSandbox?: boolean; forceNoSandbox?: boolean;
@@ -7,7 +7,6 @@ export interface IEnvAwareOptions {
export const getEnvAwareBrowserInstance = async ( export const getEnvAwareBrowserInstance = async (
optionsArg: IEnvAwareOptions = {} optionsArg: IEnvAwareOptions = {}
): Promise<plugins.puppeteer.Browser> => { ): Promise<plugins.puppeteer.Browser> => {
const smartenv = new plugins.smartenv.Smartenv();
const options: IEnvAwareOptions = { const options: IEnvAwareOptions = {
...{ ...{
forceNoSandbox: false, forceNoSandbox: false,
@@ -27,7 +26,14 @@ export const getEnvAwareBrowserInstance = async (
args: chromeArgs, args: chromeArgs,
pipe: true, pipe: true,
headless: true, headless: true,
executablePath: '/bin/chrome' ...(() => {
const returnObject: any = {};
const googleChrome = plugins.smartshell.which.sync('google-chrome');
if (googleChrome) {
returnObject.executablePath = googleChrome;
}
return returnObject;
})(),
}); });
return headlessBrowser; return headlessBrowser;

View File

@@ -5,9 +5,9 @@ export { os };
// @pushrocks scope // @pushrocks scope
import * as smartdelay from '@pushrocks/smartdelay'; import * as smartdelay from '@pushrocks/smartdelay';
import * as smartenv from '@pushrocks/smartenv'; import * as smartshell from '@pushrocks/smartshell';
export { smartdelay, smartenv }; export { smartdelay, smartshell };
// third party scope // third party scope
import puppeteer from 'puppeteer'; import puppeteer from 'puppeteer';

View File

@@ -1,17 +0,0 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}