From 6a3b036b38183d7699a287bd97bbbd61204055b7 Mon Sep 17 00:00:00 2001 From: Federico Brigante Date: Sun, 5 Mar 2023 23:35:15 +0800 Subject: [PATCH] Update dependencies (#65) --- cli.js | 6 +++++- package.json | 23 ++++++++++++----------- test/cli.js | 2 +- wrapper.js | 18 ++++-------------- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/cli.js b/cli.js index 2bbac82..3007392 100755 --- a/cli.js +++ b/cli.js @@ -173,4 +173,8 @@ async function init() { } } -init().catch(errorHandler); +try { + await init(); +} catch (error) { + errorHandler(error); +} diff --git a/package.json b/package.json index 1373df6..f9e1f18 100644 --- a/package.json +++ b/package.json @@ -32,11 +32,12 @@ "object-curly-spacing": [ "error", "always" - ], - "camelcase": "off", - "unicorn/no-process-exit": "off" + ] }, - "space": 4 + "space": 4, + "ignore": [ + "test/fixtures" + ] }, "ava": { "files": [ @@ -45,18 +46,18 @@ ] }, "dependencies": { - "chrome-webstore-upload": "^0.5.0", + "chrome-webstore-upload": "^1.0.0", "junk": "^4.0.0", - "meow": "^10.1.1", - "ora": "^6.0.1", - "recursive-readdir": "^2.2.2", + "meow": "^11.0.0", + "ora": "^6.1.2", + "recursive-readdir": "^2.2.3", "yazl": "^2.5.1" }, "devDependencies": { - "ava": "^3.15.0", - "execa": "^5.1.1", + "ava": "^5.2.0", + "execa": "^7.0.0", "is-stream": "^3.0.0", - "xo": "^0.44.0" + "xo": "^0.53.1" }, "engines": { "node": "^14.13.1 || >=16.0.0" diff --git a/test/cli.js b/test/cli.js index fd05bd6..d008af2 100644 --- a/test/cli.js +++ b/test/cli.js @@ -1,5 +1,5 @@ import test from 'ava'; -import execa from 'execa'; +import { execa } from 'execa'; function env(vars = {}) { return { diff --git a/wrapper.js b/wrapper.js index 03a07ee..dc4d8e3 100644 --- a/wrapper.js +++ b/wrapper.js @@ -7,21 +7,11 @@ import zipdir from './zipdir.js'; const isZip = filepath => path.extname(filepath) === '.zip'; export async function upload({ apiConfig, zipPath, token }) { - let client; - try { - client = getClient(apiConfig); - } catch (error) { - return Promise.reject(error); - } - + const client = getClient(apiConfig); const fullPath = path.join(process.cwd(), zipPath); - - if (isZip(fullPath)) { - const zipStream = fs.createReadStream(fullPath); - return client.uploadExisting(zipStream, token); - } - - const zipStream = await zipdir(zipPath); + const zipStream = isZip(fullPath) + ? fs.createReadStream(fullPath) + : await zipdir(zipPath); return client.uploadExisting(zipStream, token); }