@browserless/cli 9.11.1 → 9.11.3

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/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.11.1",
5
+ "version": "9.11.3",
6
6
  "bin": {
7
7
  "browserless": "src/index.js"
8
8
  },
@@ -56,5 +56,5 @@
56
56
  "test": "exit 0"
57
57
  },
58
58
  "license": "MIT",
59
- "gitHead": "27c817029945630ccaede934c8a7e9fa5c2800aa"
59
+ "gitHead": "7dae64d3bd48fe59a4f456b6235995fc041a40a9"
60
60
  }
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const uniqueRandomArray = require('unique-random-array')
4
+ const { gray, yellow } = require('picocolors')
4
5
  const darkMode = require('dark-mode')
5
6
  const termImg = require('term-img')
6
7
  const { dset } = require('dset')
@@ -41,7 +42,7 @@ module.exports = async ({ url, browserless, opts }) => {
41
42
  }
42
43
 
43
44
  if (opts.codeScheme === 'ghcolors') {
44
- const isDark = darkMode.isDark()
45
+ const isDark = await darkMode.isDark().catch(() => false)
45
46
  const color = isDark ? '#29BC9B' : '#f81ce5'
46
47
  const bg = isDark ? '#000' : '#fff'
47
48
 
@@ -56,5 +57,11 @@ module.exports = async ({ url, browserless, opts }) => {
56
57
 
57
58
  const screenshot = await browserless.screenshot(url, opts)
58
59
 
59
- return [screenshot, termImg(Buffer.from(screenshot), { width: '50%' })]
60
+ return [
61
+ screenshot,
62
+ termImg(Buffer.from(screenshot), {
63
+ width: '50%',
64
+ fallback: () => `\n${yellow(' tip:')} ${gray('use iTerm >=3 to see the image here!')}`
65
+ })
66
+ ]
60
67
  }
package/src/index.js CHANGED
@@ -56,7 +56,7 @@ const run = async () => {
56
56
  run()
57
57
  .then(([result, preview = result]) => {
58
58
  spinner.stop({ result })
59
- if (typeof preview === 'string') console.log(preview)
59
+ if (typeof preview === 'string') console.error(preview)
60
60
  process.exit()
61
61
  })
62
62
  .catch(error => {