Compare commits

..

11 Commits

Author SHA1 Message Date
41aefa7f18 1.0.8 2019-11-15 23:41:41 +01:00
c9f42b4c66 fix(core): update 2019-11-15 23:41:39 +01:00
0645364ca9 1.0.7 2019-11-15 21:44:13 +01:00
2d3f59cc65 fix(core): update 2019-11-15 21:44:11 +01:00
0e9c81b898 1.0.6 2019-11-15 18:59:29 +01:00
64cd7cd75d fix(core): update 2019-11-15 18:59:29 +01:00
f110320dae 1.0.5 2019-06-03 23:28:44 +02:00
cbc7fcb323 fix(core): update 2019-06-03 23:28:44 +02:00
0dc0e6ad53 1.0.4 2019-06-03 23:18:48 +02:00
a76d7439c4 1.0.3 2019-06-03 22:48:40 +02:00
df0b48cc47 fix(core): update 2019-06-03 22:48:40 +02:00
8 changed files with 621 additions and 514 deletions

View File

@@ -1,16 +1,16 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmci
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
- security
- test
- release
- metadata
# ====================
# security stage
@@ -20,6 +20,7 @@ mirror:
script:
- npmci git mirror
tags:
- lossless
- docker
- notpriv
@@ -31,6 +32,7 @@ snyk:
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- lossless
- docker
- notpriv
@@ -38,19 +40,7 @@ snyk:
# test stage
# ====================
testLTS:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
testStable:
stage: test
script:
- npmci npm prepare
@@ -59,6 +49,20 @@ testSTABLE:
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
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:
- lossless
- docker
- notpriv
@@ -70,6 +74,7 @@ release:
only:
- tags
tags:
- lossless
- docker
- notpriv
@@ -78,20 +83,14 @@ release:
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
- 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
@@ -102,18 +101,20 @@ trigger:
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
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:

921
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartpuppeteer",
"version": "1.0.2",
"version": "1.0.8",
"private": false,
"description": "simplified access to puppeteer",
"main": "dist/index.js",
@@ -9,24 +9,29 @@
"license": "MIT",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild)",
"build": "(tsbuild --web)",
"format": "(gitzone format)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.11.7",
"tslint": "^5.11.0",
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.12.7",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {},
"dependencies": {
"@pushrocks/smartenv": "^4.0.8",
"@types/puppeteer": "^1.20.2",
"puppeteer": "^2.0.0"
},
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"assets/*",
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_web/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"

View File

@@ -18,9 +18,18 @@ simplified access to puppeteer
## Usage
## 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). :)
## 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). :)
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)

View File

@@ -2,7 +2,10 @@ import { expect, tap } from '@pushrocks/tapbundle';
import * as smartpuppeteer from '../ts/index';
tap.test('first test', async () => {
console.log(smartpuppeteer.standardExport);
const headlessBrowser = await smartpuppeteer.getEnvAwareBrowserInstance({
forceNoSandbox: true
});
await headlessBrowser.close();
});
tap.start();

View File

@@ -1,3 +1,7 @@
import * as plugins from './smartpuppeteer.plugins';
// module exports
export let standardExport = 'Hi there! :) This is an exported string';
export * from './smartpuppeteer.classes.smartpuppeteer';
// direct exports
import { puppeteer } from './smartpuppeteer.plugins';
export { puppeteer };

View File

@@ -0,0 +1,41 @@
import * as plugins from './smartpuppeteer.plugins';
export interface IEnvAwareOptions {
forceNoSandbox?: boolean;
}
export const getEnvAwareBrowserInstance = async (
optionsArg: IEnvAwareOptions = {}
): Promise<plugins.puppeteer.Browser> => {
const smartenv = new plugins.smartenv.Smartenv();
const options: IEnvAwareOptions = {
...{
forceNoSandbox: false
},
...optionsArg
};
let chromeArgs: string[] = [];
if ((process.env.CI || options.forceNoSandbox) && !smartenv.isWsl) {
chromeArgs = chromeArgs.concat([
'--no-sandbox',
'--disable-setuid-sandbox'
// '--disable-dev-shm-usage'
]);
}
let headlessBrowser: plugins.puppeteer.Browser;
if (!smartenv.isWsl) {
// lets get the actual instance
headlessBrowser = await plugins.puppeteer.launch({
args: chromeArgs
});
} else {
console.log('Detected WSL. Using chromium.');
headlessBrowser = await plugins.puppeteer.launch({
executablePath: '/usr/bin/chromium-browser'
});
}
return headlessBrowser;
};

View File

@@ -1,2 +1,9 @@
const removeme = {};
export { removeme };
// @pushrocks scope
import * as smartenv from '@pushrocks/smartenv';
export { smartenv };
// third party scope
import puppeteer from 'puppeteer';
export { puppeteer };