@browserless/cli 9.10.0 → 9.10.2
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/LICENSE.md +0 -0
- package/README.md +2 -1
- package/package.json +8 -8
- package/src/commands/screenshot.js +4 -4
- package/src/index.js +16 -15
- package/src/spinner.js +5 -7
package/LICENSE.md
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<br>
|
|
3
|
-
<img style="width: 500px; margin:3rem 0 1.5rem;" src="https://
|
|
3
|
+
<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
|
+
<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">
|
|
4
5
|
<br>
|
|
5
6
|
<br>
|
|
6
7
|
<p align="center"><strong>@browserless/cli</strong>: CLI to interact with Browserless capabilities.</p>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@browserless/cli",
|
|
3
3
|
"description": "CLI to interact with Browserless capabilities",
|
|
4
4
|
"homepage": "https://browserless.js.org",
|
|
5
|
-
"version": "9.10.
|
|
5
|
+
"version": "9.10.2",
|
|
6
6
|
"bin": {
|
|
7
7
|
"browserless": "src/index.js"
|
|
8
8
|
},
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"beauty-error": "~1.2.15",
|
|
35
|
-
"browserless": "^9.
|
|
35
|
+
"browserless": "^9.10.2",
|
|
36
36
|
"dark-mode": "~3.0.0",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"dset": "~3.1.2",
|
|
38
|
+
"mri": "~1.2.0",
|
|
39
39
|
"nanospinner": "~1.1.0",
|
|
40
40
|
"picocolors": "~1.0.0",
|
|
41
41
|
"pretty-bytes": "~5.6.0",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"files": [
|
|
52
52
|
"src"
|
|
53
53
|
],
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"gitHead": "878aab8fd97879b6ab7729b4d15945a235c3a203",
|
|
54
56
|
"scripts": {
|
|
55
57
|
"coverage": "exit 0",
|
|
56
58
|
"test": "exit 0"
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
"gitHead": "c7e170ee4c1ab15de1031d9e6f7af4f04b7a03ab"
|
|
60
|
-
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const uniqueRandomArray = require('unique-random-array')
|
|
4
4
|
const darkMode = require('dark-mode')
|
|
5
5
|
const termImg = require('term-img')
|
|
6
|
-
const {
|
|
6
|
+
const { dset } = require('dset')
|
|
7
7
|
|
|
8
8
|
const BACKGROUNDS = [
|
|
9
9
|
'linear-gradient(225deg, #FF057C 0%, #8D0B93 50%, #321575 100%)',
|
|
@@ -29,15 +29,15 @@ const randBackground = uniqueRandomArray(BACKGROUNDS)
|
|
|
29
29
|
|
|
30
30
|
module.exports = async ({ url, browserless, opts }) => {
|
|
31
31
|
if (opts.background === 'unsplash') {
|
|
32
|
-
|
|
32
|
+
dset(opts, 'overlay.background', 'https://source.unsplash.com/random/1920x1080')
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
if (opts.background === 'gradient') {
|
|
36
|
-
|
|
36
|
+
dset(opts, 'overlay.background', randBackground())
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
if (opts.browser) {
|
|
40
|
-
|
|
40
|
+
dset(opts, 'overlay.browser', opts.browser)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if (opts.codeScheme === 'ghcolors') {
|
package/src/index.js
CHANGED
|
@@ -7,28 +7,29 @@ const createBrowser = require('browserless')
|
|
|
7
7
|
const beautyError = require('beauty-error')
|
|
8
8
|
const { onExit } = require('signal-exit')
|
|
9
9
|
const path = require('path')
|
|
10
|
+
const mri = require('mri')
|
|
10
11
|
const fs = require('fs')
|
|
11
12
|
|
|
12
13
|
const commands = fs.readdirSync(path.resolve(__dirname, 'commands'))
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
headless:
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
codeScheme: {
|
|
22
|
-
type: 'string',
|
|
23
|
-
default: 'ghcolors'
|
|
24
|
-
},
|
|
25
|
-
verbose: {
|
|
26
|
-
type: 'boolean',
|
|
27
|
-
default: true
|
|
28
|
-
}
|
|
15
|
+
const { _, ...flags } = mri(process.argv.slice(2), {
|
|
16
|
+
boolean: ['headless', 'verbose'],
|
|
17
|
+
default: {
|
|
18
|
+
codeScheme: 'ghcolors',
|
|
19
|
+
headless: 'new',
|
|
20
|
+
verbose: true
|
|
29
21
|
}
|
|
30
22
|
})
|
|
31
23
|
|
|
24
|
+
const cli = {
|
|
25
|
+
flags,
|
|
26
|
+
input: _,
|
|
27
|
+
showHelp: () => {
|
|
28
|
+
console.log(require('./help')(commands))
|
|
29
|
+
process.exit(0)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
32
33
|
const { verbose, headless } = cli.flags
|
|
33
34
|
|
|
34
35
|
const spinner = verbose ? require('./spinner') : { start: () => {}, stop: () => {} }
|
package/src/spinner.js
CHANGED
|
@@ -5,7 +5,7 @@ const { createSpinner } = require('nanospinner')
|
|
|
5
5
|
const prettyBytes = require('pretty-bytes')
|
|
6
6
|
const { gray } = require('picocolors')
|
|
7
7
|
|
|
8
|
-
const TICK_INTERVAL =
|
|
8
|
+
const TICK_INTERVAL = 50
|
|
9
9
|
const procStats = createProcStats({ tick: TICK_INTERVAL })
|
|
10
10
|
|
|
11
11
|
const stats = () => {
|
|
@@ -17,14 +17,12 @@ const stats = () => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const spinner = createSpinner(stats(), { color: 'white' })
|
|
20
|
-
let
|
|
20
|
+
let interval
|
|
21
21
|
|
|
22
22
|
const start = () => {
|
|
23
23
|
console.log()
|
|
24
|
-
spinner.start(stats())
|
|
25
|
-
|
|
26
|
-
spinner.update({ text: stats() })
|
|
27
|
-
}, TICK_INTERVAL)
|
|
24
|
+
spinner.start({ text: stats() })
|
|
25
|
+
interval = setInterval(() => spinner.update({ text: stats() }), TICK_INTERVAL)
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
const stop = ({ result, force = false } = {}) => {
|
|
@@ -36,7 +34,7 @@ const stop = ({ result, force = false } = {}) => {
|
|
|
36
34
|
spinner.success({ text })
|
|
37
35
|
}
|
|
38
36
|
procStats.destroy()
|
|
39
|
-
clearInterval(
|
|
37
|
+
clearInterval(interval)
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
module.exports = {
|