@browserless/cli 10.9.16 → 10.9.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,14 +1,18 @@
1
1
  <div align="center">
2
- <br>
3
2
  <img style="width: 500px; margin:3rem 0 1.5rem;" src="https://github.com/microlinkhq/browserless/raw/master/static/logo-banner.png#gh-light-mode-only" alt="browserless">
4
3
  <img style="width: 500px; margin:3rem 0 1.5rem;" src="https://github.com/microlinkhq/browserless/raw/master/static/logo-banner-light.png#gh-dark-mode-only" alt="browserless">
5
- <br>
6
- <br>
7
- <p align="center"><strong>@browserless/cli</strong>: CLI to interact with Browserless capabilities.</p>
8
- <p align="center">See <a href="https://browserless.js.org/#%2F%3Fid=command-line-interface" target='_blank' rel='noopener noreferrer'>CLI</a> section our <a href="https://browserless.js.org" target='_blank' rel='noopener noreferrer'>website</a> for more information.</p>
9
- <br>
4
+ <br><br>
5
+ <a href="https://microlink.io"><img src="https://img.shields.io/badge/powered_by-microlink.io-blue?style=flat-square&color=%23EA407B" alt="Powered by microlink.io"></a>
6
+ <img src="https://img.shields.io/github/tag/microlinkhq/browserless.svg?style=flat-square" alt="Last version">
7
+ <a href="https://coveralls.io/github/microlinkhq/browserless"><img src="https://img.shields.io/coveralls/microlinkhq/browserless.svg?style=flat-square" alt="Coverage Status"></a>
8
+ <a href="https://www.npmjs.org/package/browserless"><img src="https://img.shields.io/npm/dm/browserless.svg?style=flat-square" alt="NPM Status"></a>
9
+ <br><br>
10
10
  </div>
11
11
 
12
+ > @browserless/cli: CLI to interact with Browserless capabilities.
13
+
14
+ See [CLI section](https://browserless.js.org/#/?id=cli) our website for more information.
15
+
12
16
  ## Install
13
17
 
14
18
  Using npm:
@@ -17,6 +21,50 @@ Using npm:
17
21
  npm install @browserless/cli -g
18
22
  ```
19
23
 
24
+ ## About
25
+
26
+ This package provides a **command-line interface** for interacting with browserless capabilities directly from your terminal. It exposes the `browserless` binary that wraps the core browserless API into easy-to-use shell commands.
27
+
28
+ ### What this package does
29
+
30
+ The `@browserless/cli` package allows you to:
31
+
32
+ - **Take screenshots** from URLs with gradient backgrounds, browser overlays, and device emulation
33
+ - **Generate PDFs** from web pages
34
+ - **Extract content** as HTML or plain text
35
+ - **Run Lighthouse audits** for performance analysis
36
+ - **Analyze page weight** (network requests, transfer size, resource size)
37
+ - **Check URL status** and response information (redirects, headers, status codes)
38
+
39
+ ### Available commands
40
+
41
+ | Command | Description |
42
+ |---------|-------------|
43
+ | `screenshot <url>` | Capture a screenshot with optional overlay and background |
44
+ | `pdf <url>` | Generate a PDF document from a web page |
45
+ | `html <url>` | Serialize the page content to HTML |
46
+ | `text <url>` | Extract plain text content from the page |
47
+ | `lighthouse <url>` | Run a Google Lighthouse audit and output JSON report |
48
+ | `page-weight <url>` | Analyze network requests and resource sizes |
49
+ | `ping <url>` | Get response info: status code, redirects, headers |
50
+ | `status <url>` | Get the HTTP status code |
51
+ | `goto <url>` | Navigate to a URL and return page/response info |
52
+
53
+ > **Note:** The `lighthouse` command requires an extra installation.
54
+ >
55
+ > Please make sure to install the standalone package by running:<br>
56
+ > <kbd>npm install -g @browserless/lighthouse</kbd>
57
+
58
+ ### How it fits in the monorepo
59
+ This package depends on:
60
+
61
+ | Dependency | Purpose |
62
+ |---------------------------|---------------------------------------------------------|
63
+ | browserless | Core API for all browser automation operations |
64
+ | @browserless/lighthouse | Lighthouse audit integration (used by lighthouse command) |
65
+
66
+ The CLI acts as a thin wrapper that parses command-line arguments, initializes a browserless instance, and delegates to the appropriate command handler.
67
+
20
68
  ## License
21
69
 
22
70
  **@browserless/cli** © [Microlink](https://microlink.io), released under the [MIT](https://github.com/microlinkhq/browserless/blob/master/LICENSE.md) License.<br>
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@browserless/cli",
3
- "description": "CLI to interact with Browserless capabilities",
3
+ "description": "Command-line interface for headless browser automation. Take screenshots, generate PDFs, and extract content from websites.",
4
4
  "homepage": "https://browserless.js.org",
5
- "version": "10.9.16",
5
+ "version": "10.9.18",
6
6
  "bin": {
7
7
  "browserless": "src/index.js"
8
8
  },
@@ -20,19 +20,22 @@
20
20
  "url": "https://github.com/microlinkhq/browserless/issues"
21
21
  },
22
22
  "keywords": [
23
- "browser",
24
23
  "browserless",
25
- "chrome",
26
- "chromeless",
27
24
  "cli",
28
- "example",
29
- "examples",
25
+ "command-line",
30
26
  "headless",
31
- "puppeteer"
27
+ "chrome",
28
+ "puppeteer",
29
+ "screenshot",
30
+ "pdf",
31
+ "automation",
32
+ "web-scraping",
33
+ "terminal",
34
+ "tool"
32
35
  ],
33
36
  "dependencies": {
34
37
  "beauty-error": "~1.2.21",
35
- "browserless": "^10.9.16",
38
+ "browserless": "^10.9.18",
36
39
  "dark-mode": "~3.0.0",
37
40
  "dset": "~3.1.4",
38
41
  "mri": "~1.2.0",
@@ -57,5 +60,5 @@
57
60
  "test": "exit 0"
58
61
  },
59
62
  "license": "MIT",
60
- "gitHead": "b40c9ffbb5d346ff1f09857ca12fa1c876b92849"
63
+ "gitHead": "f5e8cd0788e4bad3b3ad9b007943754f96653817"
61
64
  }
@@ -1,6 +1,19 @@
1
1
  'use strict'
2
2
 
3
- const createLighthouse = require('../../../lighthouse/src')
3
+ const { existsSync } = require('fs')
4
+ const { resolve } = require('path')
5
+
6
+ const lighthousePath = resolve(__dirname, '../../../lighthouse/src')
7
+
8
+ let createLighthouse
9
+
10
+ if (existsSync(lighthousePath)) {
11
+ createLighthouse = require(lighthousePath)
12
+ } else {
13
+ console.error('The @browserless/lighthouse package is not installed.')
14
+ console.error('Please install it by running: npm install -g @browserless/lighthouse')
15
+ process.exit(1)
16
+ }
4
17
 
5
18
  module.exports = async ({ url, browserless, opts }) => {
6
19
  const lighthouse = createLighthouse(async teardown => {