Skip to content

Commit

Permalink
Require Node.js 10 and upgrade to Puppeteer 3
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 11, 2020
1 parent 4c73e8c commit f07e88f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,6 +1,6 @@
os: osx
language: node_js
node_js:
- '14'
- '12'
- '10'
- '8'
30 changes: 17 additions & 13 deletions cli.js
Expand Up @@ -122,10 +122,12 @@ const cli = meow(`
type: 'string'
},
hideElements: {
type: 'string'
type: 'string',
isMultiple: true
},
removeElements: {
type: 'string'
type: 'string',
isMultiple: true
},
clickElement: {
type: 'string'
Expand All @@ -141,13 +143,16 @@ const cli = meow(`
default: true
},
module: {
type: 'string'
type: 'string',
isMultiple: true
},
script: {
type: 'string'
type: 'string',
isMultiple: true
},
style: {
type: 'string'
type: 'string',
isMultiple: true
},
header: {
type: 'string'
Expand All @@ -156,7 +161,8 @@ const cli = meow(`
type: 'string'
},
cookie: {
type: 'string'
type: 'string',
isMultiple: true
},
authentication: {
type: 'string'
Expand All @@ -179,11 +185,11 @@ const cli = meow(`
let [input] = cli.input;
const options = cli.flags;

options.hideElements = arrify(options.hideElements);
options.removeElements = arrify(options.removeElements);
options.modules = arrify(options.module);
options.scripts = arrify(options.script);
options.styles = arrify(options.style);
// TODO: `meow` needs a way to handle this.
options.modules = options.module;
options.scripts = options.script;
options.styles = options.style;
options.cookies = options.cookie;

if (options.launchOptions) {
options.launchOptions = JSON.parse(options.launchOptions);
Expand All @@ -195,8 +201,6 @@ for (const header of arrify(options.header)) {
options.headers[key.trim()] = value.trim();
}

options.cookies = arrify(options.cookie);

if (options.authentication) {
const [username, password] = splitOnFirst(options.authentication, ':');
options.authentication = {username, password};
Expand Down
2 changes: 1 addition & 1 deletion license
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
13 changes: 7 additions & 6 deletions package.json
Expand Up @@ -4,16 +4,17 @@
"description": "Capture screenshots of websites from the command-line",
"license": "MIT",
"repository": "sindresorhus/capture-website-cli",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"bin": {
"capture-website": "cli.js"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -40,16 +41,16 @@
],
"dependencies": {
"arrify": "^2.0.1",
"capture-website": "^0.8.0",
"capture-website": "^1.0.0",
"get-stdin": "^7.0.0",
"meow": "^5.0.0",
"meow": "^7.0.1",
"split-on-first": "^2.0.0"
},
"devDependencies": {
"ava": "^2.0.0",
"create-test-server": "^3.0.1",
"execa": "^3.3.0",
"execa": "^4.0.1",
"file-type": "^12.4.0",
"xo": "^0.25.3"
"xo": "^0.30.0"
}
}
4 changes: 0 additions & 4 deletions readme.md
Expand Up @@ -4,7 +4,6 @@
It uses [Puppeteer](https://github.com/GoogleChrome/puppeteer) (Chrome) under the hood.


## Install

```
Expand All @@ -13,7 +12,6 @@ $ npm install --global capture-website-cli

Note to Linux users: If you get a "No usable sandbox!" error, you need to enable [system sandboxing](https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#setting-up-chrome-linux-sandbox).


## Usage

```
Expand Down Expand Up @@ -90,12 +88,10 @@ $ capture-website --help
--dark-mode
```


## FAQ

[Click here.](https://github.com/sindresorhus/capture-website#faq)


## Related

- [capture-website](https://github.com/sindresorhus/capture-website) - API for this module
Expand Down
6 changes: 3 additions & 3 deletions test.js.md
Expand Up @@ -14,7 +14,9 @@ Generated by [AVA](https://ava.li).
username: 'username',
},
clickElement: 'button',
cookie: 'id=unicorn; Expires=Wed, 21 Oct 2018 07:28:00 GMT;',
cookie: [
'id=unicorn; Expires=Wed, 21 Oct 2018 07:28:00 GMT;',
],
cookies: [
'id=unicorn; Expires=Wed, 21 Oct 2018 07:28:00 GMT;',
],
Expand Down Expand Up @@ -58,9 +60,7 @@ Generated by [AVA](https://ava.li).
'img.ad',
],
scaleFactor: 3,
scripts: [],
scrollToElement: '#map',
styles: [],
timeout: 80,
type: 'jpeg.',
userAgent: 'I love unicorns',
Expand Down
Binary file modified test.js.snap
Binary file not shown.

0 comments on commit f07e88f

Please sign in to comment.