diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dc47f7c..928fff3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,6 @@ jobs: node-version: - 18 - 16 - - 14 steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/cli.js b/cli.js index 7d54690..1e83b94 100755 --- a/cli.js +++ b/cli.js @@ -2,7 +2,6 @@ import process from 'node:process'; import meow from 'meow'; import captureWebsite from 'capture-website'; -import arrify from 'arrify'; import splitOnFirst from 'split-on-first'; import getStdin from 'get-stdin'; @@ -166,6 +165,7 @@ const cli = meow(` }, header: { type: 'string', + isMultiple: true, }, userAgent: { type: 'string', @@ -222,11 +222,13 @@ if (options.clip) { } options.headers = {}; -for (const header of arrify(options.header)) { +for (const header of options.header) { const [key, value] = header.split(':'); options.headers[key.trim()] = value.trim(); } +delete options.header; + if (options.authentication) { const [username, password] = splitOnFirst(options.authentication, ':'); options.authentication = {username, password}; @@ -256,7 +258,7 @@ if (options.inset) { options.isJavaScriptEnabled = options.javascript; -(async () => { +async function main() { const { internalPrintFlags, listDevices, @@ -288,4 +290,6 @@ options.isJavaScriptEnabled = options.javascript; } else { process.stdout.write(await captureWebsite.buffer(input, options)); } -})(); +} + +await main(); diff --git a/package.json b/package.json index 0856772..474f70a 100644 --- a/package.json +++ b/package.json @@ -41,17 +41,16 @@ "jpg" ], "dependencies": { - "arrify": "^3.0.0", - "capture-website": "^3.0.0", + "capture-website": "^3.2.0", "get-stdin": "^9.0.0", - "meow": "^10.1.3", + "meow": "^11.0.0", "split-on-first": "^3.0.0" }, "devDependencies": { - "ava": "^4.3.1", + "ava": "^5.2.0", "create-test-server": "^3.0.1", - "execa": "^6.1.0", - "file-type": "^17.1.6", - "xo": "^0.51.0" + "execa": "^7.1.1", + "file-type": "^18.2.1", + "xo": "^0.54.1" } } diff --git a/test.js.md b/test.js.md index 11a84ee..ea5ce42 100644 --- a/test.js.md +++ b/test.js.md @@ -32,7 +32,6 @@ Generated by [AVA](https://avajs.dev). element: '.main-content', emulateDevice: 'iPhone X', fullPage: false, - header: 'x-powered-by: capture-website-cli', headers: { 'x-powered-by': 'capture-website-cli', }, diff --git a/test.js.snap b/test.js.snap index 7f47039..7ec122b 100644 Binary files a/test.js.snap and b/test.js.snap differ