@browserless/cli 9.10.0 → 9.10.1
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 +2 -1
- package/package.json +5 -5
- package/src/commands/screenshot.js +4 -4
- package/src/index.js +15 -15
- package/src/spinner.js +5 -7
- package/LICENSE.md +0 -21
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="
|
|
3
|
+
<img style="width: 500px; margin:3rem 0 1.5rem;" src="/static/logo-banner.png#gh-light-mode-only" alt="browserless">
|
|
4
|
+
<img style="width: 500px; margin:3rem 0 1.5rem;" src="/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.1",
|
|
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.1",
|
|
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",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"test": "exit 0"
|
|
57
57
|
},
|
|
58
58
|
"license": "MIT",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "0826317b9edda6f4d77b38d843e6087060876a00"
|
|
60
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,28 @@ 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
|
-
|
|
19
|
-
default: 'new'
|
|
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
|
+
headless: 'new',
|
|
19
|
+
codeScheme: 'ghcolors'
|
|
29
20
|
}
|
|
30
21
|
})
|
|
31
22
|
|
|
23
|
+
const cli = {
|
|
24
|
+
flags,
|
|
25
|
+
input: _,
|
|
26
|
+
showHelp: () => {
|
|
27
|
+
console.log(require('./help')(commands))
|
|
28
|
+
process.exit(0)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
32
|
const { verbose, headless } = cli.flags
|
|
33
33
|
|
|
34
34
|
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 = {
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright © 2019 Microlink <hello@microlink.io> (microlink.io)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|