Skip to content

Commit

Permalink
chore(release): set package.json to 1.4.0 [skip ci]
Browse files Browse the repository at this point in the history
# [1.4.0](v1.3.4...v1.4.0) (2021-10-29)

### Features

* **puppeter-arguments:** implemented puppeter arguments and path logs ([f33210b](f33210b))
  • Loading branch information
semantic-release-bot committed Oct 29, 2021
1 parent f33210b commit 972e6e0
Show file tree
Hide file tree
Showing 17 changed files with 118 additions and 99 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
## [1.3.4](https://github.com/devalexanderdaza/puppeteer-extends/compare/v1.3.3...v1.3.4) (2021-10-29)
# [1.4.0](https://github.com/devalexanderdaza/puppeteer-extends/compare/v1.3.4...v1.4.0) (2021-10-29)


### Features

* **puppeter-arguments:** implemented puppeter arguments and path logs ([f33210b](https://github.com/devalexanderdaza/puppeteer-extends/commit/f33210bf67f1a4dedc9f49604ddd6418e5068c8c))

## [1.3.4](https://github.com/devalexanderdaza/puppeteer-extends/compare/v1.3.3...v1.3.4) (2021-10-29)

### Bug Fixes

* **documentation:** updated readme and examples ([7d2fca9](https://github.com/devalexanderdaza/puppeteer-extends/commit/7d2fca94c421b217502ec282f41bc22d77f581a9))
- **documentation:** updated readme and examples ([7d2fca9](https://github.com/devalexanderdaza/puppeteer-extends/commit/7d2fca94c421b217502ec282f41bc22d77f581a9))

## [1.3.3](https://github.com/devalexanderdaza/puppeteer-extends/compare/v1.3.2...v1.3.3) (2021-10-29)

Expand Down
111 changes: 56 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,95 @@
# puppeteer-extends

[![License][]](https://opensource.org/licenses/Apache-2.0)
[![Build Status]](https://github.com/devalexanderdaza/puppeteer-extends/actions/workflows/ci.yml)
[![NPM Package]](https://npmjs.org/package/puppeteer-extends)
[![semantic-release]](https://github.com/semantic-release/semantic-release)

[License]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
[Build Status]: https://github.com/devalexanderdaza/puppeteer-extends/actions/workflows/ci.yml/badge.svg
[NPM Package]: https://img.shields.io/npm/v/puppeteer-extends.svg
[license]: https://img.shields.io/badge/License-Apache%202.0-blue.svg
[build status]: https://github.com/devalexanderdaza/puppeteer-extends/actions/workflows/ci.yml/badge.svg
[npm package]: https://img.shields.io/npm/v/puppeteer-extends.svg
[semantic-release]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg

> Easy manage and instance a puppeteer using a singleton pattern. Minimal configuration implemented for install and use.
## Install

``` shell
```shell
npm install puppeteer-extends
```

## Use

``` javascript
```javascript
const { PuppeteerExtends, Logger } = require("puppeteer-extends");
const path = require("path");
const { Browser, Page } = require("puppeteer");

// Define your custom browser arguments
const customArguments = [
"--no-sandbox",
"--disable-web-security",
"--disable-setuid-sandbox",
"--aggressive-cache-discard",
"--disable-cache",
"--disable-infobars",
"--disable-application-cache",
"--window-position=0,0",
"--disable-offline-load-stale-cache",
"--disk-cache-size=0",
"--disable-background-networking",
"--disable-default-apps",
"--disable-extensions",
"--disable-sync",
"--disable-translate",
"--hide-scrollbars",
"--metrics-recording-only",
"--mute-audio",
"--no-first-run",
"--safebrowsing-disable-auto-update",
"--ignore-certificate-errors",
"--ignore-ssl-errors",
"--ignore-certificate-errors-spki-list",
"--no-sandbox",
"--disable-web-security",
"--disable-setuid-sandbox",
"--aggressive-cache-discard",
"--disable-cache",
"--disable-infobars",
"--disable-application-cache",
"--window-position=0,0",
"--disable-offline-load-stale-cache",
"--disk-cache-size=0",
"--disable-background-networking",
"--disable-default-apps",
"--disable-extensions",
"--disable-sync",
"--disable-translate",
"--hide-scrollbars",
"--metrics-recording-only",
"--mute-audio",
"--no-first-run",
"--safebrowsing-disable-auto-update",
"--ignore-certificate-errors",
"--ignore-ssl-errors",
"--ignore-certificate-errors-spki-list",
];

// Folder of puppeteer store data
const puppeteerDataDirectory = path.join(__dirname, "./tmp/puppeteer-extends");

const main = async () => {
// Set custom parameters on init browser instance
const browser = await PuppeteerExtends.getBrowser({
isHeadless: true,
isDebug: false,
customArguments: customArguments,
userDataDir: puppeteerDataDirectory,
});
if (browser) {
const page = await browser.newPage();
// * An example of crawling a page with CloudFlare applied.
Logger.debug("🚧 Crawling in progress...");
const url = "https://github.com/devalexanderdaza";
await PuppeteerExtends.goto(page, url);
await page.screenshot({
path: path.join(__dirname, "./tmp/puppeteer-extends/example-js.png"),
});
Logger.debug("🚧 Crawling is complete.");
Logger.debug("🚧 Closing page...");
PuppeteerExtends.closePage(page);
Logger.debug("🚧 Exit the Puppeteer...");
PuppeteerExtends.closeBrowser(browser);
}
// Set custom parameters on init browser instance
const browser = await PuppeteerExtends.getBrowser({
isHeadless: true,
isDebug: false,
customArguments: customArguments,
userDataDir: puppeteerDataDirectory,
});
if (browser) {
const page = await browser.newPage();

// * An example of crawling a page with CloudFlare applied.
Logger.debug("🚧 Crawling in progress...");

const url = "https://github.com/devalexanderdaza";
await PuppeteerExtends.goto(page, url);
await page.screenshot({
path: path.join(__dirname, "./tmp/puppeteer-extends/example-js.png"),
});

Logger.debug("🚧 Crawling is complete.");
Logger.debug("🚧 Closing page...");
PuppeteerExtends.closePage(page);
Logger.debug("🚧 Exit the Puppeteer...");
PuppeteerExtends.closeBrowser(browser);
}
};

main().then();
```

## TypeScript support

``` typescript
import { PuppeteerExtends, Logger } from 'puppeteer-extends';
```typescript
import { PuppeteerExtends, Logger } from "puppeteer-extends";
import path from "path";
import { Browser, Page } from "puppeteer";

Expand Down
24 changes: 5 additions & 19 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
import * as PuppeteerExtends from './main/puppeteer';
import { Logger } from './main/logger';
import * as PuppeteerExtends from "./main/puppeteer";
import { Logger } from "./main/logger";
/**
* Main instances of puppeteer-extends
*
* ```typescript
* import { PuppeteerExtends, Logger } from 'puppeteer-extends';
* ```
*
* const main = async () => {
* const browser = await PuppeteerExtends.getBrowser({ isHeadless: true });
* if (browser) {
* const page = await browser.newPage();
* // An example of crawling a page with CloudFlare applied.
* Logger.debug('🚧 Crawling in progress...');
* const url = 'https://github.com/devalexanderdaza';
* await PuppeteerExtends.goto(page, url);
* await page.screenshot({ path: 'devalexanderdaza-github-screenshot.png' });
*
* Logger.debug('🚧 Crawling is complete.');
* Logger.debug('🚧 Exit the Puppeteer...');
* await browser.close();
* }
* }
*
* main().then(r => {});
* ```javascript
* const { PuppeteerExtends, Logger } = require("puppeteer-extends");
* ```
*/
export { PuppeteerExtends, Logger };
2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main/logger.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @since 1.0.0
*/
import { FolderLogger } from 'folder-logger';
import { FolderLogger } from "folder-logger";
/**
* Export library components
*
Expand Down
4 changes: 2 additions & 2 deletions dist/main/moment.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import moment from 'moment';
import 'moment/locale/en';
import moment from "moment";
import "moment/locale/en";
export { moment };
2 changes: 1 addition & 1 deletion dist/main/moment.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion dist/main/puppeteer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface IOptions {
export declare const getBrowser: (options: IOptions) => Promise<Browser | undefined>;
/**
* Go to that page using puppeteer.
* @ignore
* @since 1.0.0
*/
export declare const goto: (page: puppeteer.Page, targetUrl: string, options?: {
waitUntil: string[];
Expand All @@ -27,11 +27,13 @@ export declare const goto: (page: puppeteer.Page, targetUrl: string, options?: {
}) => Promise<boolean>;
/**
* Close page, not browser
* @since 1.4.0
* @param page
*/
export declare const closePage: (page: puppeteer.Page) => void;
/**
* Close browser and all pages
* @since 1.4.0
* @param browser
*/
export declare const closeBrowser: (browser: Browser) => void;
Expand Down
8 changes: 5 additions & 3 deletions dist/main/puppeteer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/main/puppeteer.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions docs/assets/highlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
--dark-hl-3: #CE9178;
--light-hl-4: #0000FF;
--dark-hl-4: #569CD6;
--light-hl-5: #795E26;
--dark-hl-5: #DCDCAA;
--light-hl-6: #0070C1;
--dark-hl-6: #4FC1FF;
--light-hl-5: #0070C1;
--dark-hl-5: #4FC1FF;
--light-hl-6: #795E26;
--dark-hl-6: #DCDCAA;
--light-hl-7: #008000;
--dark-hl-7: #6A9955;
--light-hl-8: #267F99;
--dark-hl-8: #4EC9B0;
--light-code-background: #FFFFFF;
--dark-code-background: #1E1E1E;
}
Expand All @@ -28,6 +30,7 @@
--hl-5: var(--light-hl-5);
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--code-background: var(--light-code-background);
} }

Expand All @@ -40,6 +43,7 @@
--hl-5: var(--dark-hl-5);
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--code-background: var(--dark-code-background);
} }

Expand All @@ -52,6 +56,7 @@ body.light {
--hl-5: var(--light-hl-5);
--hl-6: var(--light-hl-6);
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--code-background: var(--light-code-background);
}

Expand All @@ -64,6 +69,7 @@ body.dark {
--hl-5: var(--dark-hl-5);
--hl-6: var(--dark-hl-6);
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--code-background: var(--dark-code-background);
}

Expand All @@ -75,4 +81,5 @@ body.dark {
.hl-5 { color: var(--hl-5); }
.hl-6 { color: var(--hl-6); }
.hl-7 { color: var(--hl-7); }
.hl-8 { color: var(--hl-8); }
pre, code { background: var(--code-background); }
Loading

0 comments on commit 972e6e0

Please sign in to comment.