diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 9e42eba..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Andrew Levine - -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: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Travis autoupload guide.md b/Travis autoupload guide.md index 4789ddf..d47a092 100644 --- a/Travis autoupload guide.md +++ b/Travis autoupload guide.md @@ -26,10 +26,10 @@ With this setup, you can automatically deploy your extension when creating a tag ```json { "devDependencies": { - "chrome-webstore-upload-cli": "^1.0.0" + "chrome-webstore-upload-cli": "^2.0.0" }, "scripts": { - "release": "webstore upload --source=path/to/extension --auto-publish" + "release": "chrome-webstore-upload upload --source=path/to/extension --auto-publish" } } ``` diff --git a/cli.js b/cli.js index f6bf092..53590fe 100755 --- a/cli.js +++ b/cli.js @@ -47,7 +47,7 @@ const cli = meow(` const preliminaryValidation = validateInput(cli.input, cli.flags); if (preliminaryValidation.error) { - console.error((preliminaryValidation.error)); + console.error(preliminaryValidation.error); cli.showHelp(1); } @@ -83,7 +83,10 @@ async function doAutoPublish() { } spinnerStart('Publishing'); - const publishResponse = await publish({ apiConfig, token }, trustedTesters && 'trustedTesters'); + const publishResponse = await publish( + { apiConfig, token }, + trustedTesters && 'trustedTesters', + ); spinner.stop(); handlePublishStatus(publishResponse); } @@ -106,7 +109,10 @@ async function doUpload() { async function doPublish() { spinnerStart('Publishing'); - const response = await publish({ apiConfig }, trustedTesters && 'trustedTesters'); + const response = await publish( + { apiConfig }, + trustedTesters && 'trustedTesters', + ); spinner.stop(); handlePublishStatus(response); } @@ -118,9 +124,13 @@ function errorHandler(error) { const response = JSON.parse(error?.response?.body ?? '{}'); const { clientId, refreshToken } = apiConfig; if (response.error_description === 'The OAuth client was not found.') { - console.error(('Error: `The OAuth client was not found`')); - console.error(('Probably the provided client ID is not valid. Try following the guide again')); - console.error(('https://github.com/fregante/chrome-webstore-upload/blob/main/How%20to%20generate%20Google%20API%20keys.md')); + console.error('Error: `The OAuth client was not found`'); + console.error( + 'Probably the provided client ID is not valid. Try following the guide again', + ); + console.error( + 'https://github.com/fregante/chrome-webstore-upload/blob/main/How%20to%20generate%20Google%20API%20keys.md', + ); console.error({ clientId }); process.exitCode = 1; return; @@ -128,9 +138,13 @@ function errorHandler(error) { if (response.error_description === 'Bad Request') { const { clientId } = apiConfig; - console.error(('Error: `invalid_grant`')); - console.error(('Probably the provided refresh token is not valid. Try following the guide again')); - console.error(('https://github.com/fregante/chrome-webstore-upload/blob/main/How%20to%20generate%20Google%20API%20keys.md')); + console.error('Error: `invalid_grant`'); + console.error( + 'Probably the provided refresh token is not valid. Try following the guide again', + ); + console.error( + 'https://github.com/fregante/chrome-webstore-upload/blob/main/How%20to%20generate%20Google%20API%20keys.md', + ); console.error({ clientId, refreshToken }); process.exitCode = 1; return; @@ -139,15 +153,15 @@ function errorHandler(error) { if (error?.itemError?.length > 0) { for (const itemError of error.itemError) { - console.error(('Error: ' + itemError.error_code)); - console.error((itemError.error_detail)); + console.error('Error: ' + itemError.error_code); + console.error(itemError.error_detail); } process.exitCode = 1; return; } - console.error(('Error')); + console.error('Error'); console.error(error); process.exitCode = 1; } diff --git a/license b/license new file mode 100644 index 0000000..35b61d0 --- /dev/null +++ b/license @@ -0,0 +1,10 @@ +The MIT License (MIT) + +Copyright (c) Federico Brigante (https://fregante.com) +Copyright (c) 2020 Andrew Levine + +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: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/package.json b/package.json index 81df6cf..12e089a 100644 --- a/package.json +++ b/package.json @@ -1,56 +1,33 @@ { "name": "chrome-webstore-upload-cli", "version": "2.0.0", - "license": "MIT", - "description": "CLI Utility to quickly upload + publish extensions to the Chrome Web Store", - "repository": "fregante/chrome-webstore-upload-cli", - "bin": { - "chrome-webstore-upload": "cli.js" - }, - "type": "module", - "scripts": { - "test": "xo && ava" - }, + "description": "CLI tool to upload Chrome Extensions to the Chrome Web Store", "keywords": [ "chrome", "publish", "webstore", + "store", "extension", "deploy", "update", "upload", "cli" ], + "repository": "fregante/chrome-webstore-upload-cli", + "funding": "https://github.com/sponsors/fregante", + "license": "MIT", "author": "Andrew Levine", - "devDependencies": { - "ava": "^3.15.0", - "execa": "^5.1.1", - "is-stream": "^3.0.0", - "xo": "^0.44.0" - }, - "dependencies": { - "chrome-webstore-upload": "^0.5.0", - "junk": "^4.0.0", - "meow": "^10.1.1", - "ora": "^6.0.1", - "recursive-readdir": "^2.2.2", - "yazl": "^2.5.1" - }, - "engines": { - "node": "^14.13.1 || >=16.0.0" - }, "contributors": [ - "Andrew Levine", "Federico Brigante (https://fregante.com)" ], - "ava": { - "files": [ - "!test/fixtures/**", - "!test/helpers/**" - ] + "type": "module", + "bin": { + "chrome-webstore-upload": "cli.js" + }, + "scripts": { + "test": "xo && ava" }, "xo": { - "space": 4, "rules": { "object-curly-spacing": [ "error", @@ -58,6 +35,30 @@ ], "camelcase": "off", "unicorn/no-process-exit": "off" - } + }, + "space": 4 + }, + "ava": { + "files": [ + "!test/fixtures/**", + "!test/helpers/**" + ] + }, + "dependencies": { + "chrome-webstore-upload": "^0.5.0", + "junk": "^4.0.0", + "meow": "^10.1.1", + "ora": "^6.0.1", + "recursive-readdir": "^2.2.2", + "yazl": "^2.5.1" + }, + "devDependencies": { + "ava": "^3.15.0", + "execa": "^5.1.1", + "is-stream": "^3.0.0", + "xo": "^0.44.0" + }, + "engines": { + "node": "^14.13.1 || >=16.0.0" } } diff --git a/README.md b/readme.md similarity index 88% rename from README.md rename to readme.md index e5bd392..2b2e176 100644 --- a/README.md +++ b/readme.md @@ -24,12 +24,12 @@ You can also automatically upload your extension on: ## Usage ``` -$ webstore --help +$ chrome-webstore-upload --help CLI Utility to quickly upload + publish extensions to the Chrome Web Store Usage - $ webstore + $ chrome-webstore-upload where is one of upload, publish @@ -45,15 +45,16 @@ $ webstore --help Examples Upload new extension archive to the Chrome Web Store - $ webstore upload --source extension.zip --extension-id $EXTENSION_ID --client-id $CLIENT_ID --client-secret $CLIENT_SECRET --refresh-token $REFRESH_TOKEN + $ chrome-webstore-upload upload --source extension.zip --extension-id $EXTENSION_ID --client-id $CLIENT_ID --client-secret $CLIENT_SECRET --refresh-token $REFRESH_TOKEN Publish extension (with CLIENT_ID, CLIENT_SECRET, and REFRESH_TOKEN set as env variables) - $ webstore publish --extension-id elomekmlfonmdhmpmdfldcjgdoacjcba + $ chrome-webstore-upload publish --extension-id elomekmlfonmdhmpmdfldcjgdoacjcba ``` ## Examples The following projects use this package to facilitate auto-deployment of extensions + - [GifHub](https://github.com/DrewML/GifHub) - [Octo Preview](https://github.com/DrewML/octo-preview) - [GhostText](https://github.com/fregante/GhostText) @@ -67,4 +68,4 @@ The following projects use this package to facilitate auto-deployment of extensi - [webext-storage-cache](https://github.com/fregante/webext-storage-cache) - Map-like promised cache storage with expiration. Chrome and Firefox - [webext-dynamic-content-scripts](https://github.com/fregante/webext-dynamic-content-scripts) - Automatically registers your content_scripts on domains added via permission.request - [Awesome-WebExtensions](https://github.com/fregante/Awesome-WebExtensions) - A curated list of awesome resources for WebExtensions development. -- [More…](https://github.dihe.moe/fregante/webext-fun) +- [More…](https://github.com/fregante/webext-fun) diff --git a/test/helpers/stubs.js b/test/helpers/stubs.js index 0d8689e..31eb53c 100644 --- a/test/helpers/stubs.js +++ b/test/helpers/stubs.js @@ -15,4 +15,3 @@ export function stubConsoleLog(stub) { console.log = old; }; } - diff --git a/util.js b/util.js index 78fc844..2cf89bc 100644 --- a/util.js +++ b/util.js @@ -29,4 +29,3 @@ export function validateInput(input) { export function zipPath(root, file) { return relative(root, file); } - diff --git a/wrapper.js b/wrapper.js index 0264319..03a07ee 100644 --- a/wrapper.js +++ b/wrapper.js @@ -34,4 +34,3 @@ export async function fetchToken(apiConfig) { const client = getClient(apiConfig); return client.fetchToken(); } -