avi12 / web-ext-deploy

A tool for deploying WebExtensions to multiple stores.
GNU General Public License v3.0
47 stars 5 forks source link
automation chrome-extension chrome-webstore cli-app cookies deployment edge edge-extension firefox-addons firefox-extension firefox-submisison-api-v5 firefox-submission-api nodejs nodejs-modules opera-addon playwright playwright-typescript web-extensions

WebExt Deploy

The ultimate automation tool for deploying to multiple extension stores simultaneously!

Made by avi12

Supported stores:

Core packages/APIs used

Installing

npm i -D web-ext-deploy
# or
pnpm i -D web-ext-deploy
# or
yarn add -D web-ext-deploy

or install globally

npm i -g web-ext-deploy
# or
pnpm i -g web-ext-deploy
# or
yarn global add web-ext-deploy

Deployment to Chrome Web Store: follow this guide. Deployment to Edge Add-ons Store: follow this guide.

Usage

1. Obtain the relevant cookie(s) of the publisher's account:

Disclaimer: I do NOT take any responsibility for leaked cookies or credentials.

If you have a hard time obtaining the cookie(s), you can run:

web-ext-deploy --get-cookies=opera

Note that for the Chrome Web Store, you'll use the Chrome Web Store Publish API. As for the Edge Add-ons Store, you'll use the Microsoft Edge Publish API.

2. Decide how to access the data & credentials

.env files method

Use the .env snippet(s) relevant to your extension. Include each one in your root directory. Make sure to have *.env in your .gitignore Note that if you used the aforementioned --get-cookies, it automatically added the .env listing(s) to it.

To use the .env files, in the CLI:

web-ext-deploy --env

Additional arguments for the .env mode:

Notes:

Possible .env files

chrome.env

REFRESH_TOKEN="RefreshToken"
CLIENT_ID="ClientID"
CLIENT_SECRET="ClientSecret"
ZIP="dist/some-zip-v{version}.zip"
EXT_ID="ExtensionID"

firefox.env

JWT_ISSUER="JwtIssuer"
JWT_SECRET="JwtSecret"
ZIP="dist/some-zip-v{version}.zip"
ZIP_SOURCE="dist/some-zip-source-v{version}.zip"
EXT_ID="ExtensionID"

edge.env

CLIENT_ID="ClientID"
CLIENT_SECRET="ClientSecret"
ACCESS_TOKEN_URL="AccessTokenURL"
ACCESS_TOKEN="AccessToken"
ZIP="dist/some-zip-v{version}.zip"
PRODUCT_ID="ProductID"

opera.env

SESSIONID="sessionid_value"
CSRFTOKEN="csrftoken_value"
ZIP="dist/some-zip-v{version}.zip"
PACKAGE_ID=123456

CLI arguments method

Use it only if your extension's code will not be published.

web-ext-deploy --chrome-zip="some-zip-v{version}.zip" --chrome-ext-id="ExtensionID" --firefox-zip="some-zip-v{version}.zip" --firefox-ext-id="ExtensionID"

CLI API

Stores:

Options:

Chrome Web Store CLI

To get your --chrome-refresh-token, --chrome-client-id and --chrome-client-secret, follow this guide. Example:

web-ext-deploy --chrome-ext-id="ExtensionID" --chrome-refresh-token="RefreshToken" --chrome-client-id="ClientID" --chrome-client-secret="ClientSecret" --chrome-zip="some-zip-v{version}.zip"

Firefox Add-ons CLI

Get your --firefox-jwt-issuer and --firefox-jwt-secret from the Developer Hub.

Example:

web-ext-deploy --firefox-ext-id="ExtensionID" --firefox-jwt-issuer="JwtIssuer" --firefox-jwt-secret="JwtSecret" --firefox-zip="dist/some-zip-v{version}.zip" --firefox-changelog="Changelog\nWith line breaks" --firefox-dev-changelog="Changelog for reviewers\nWith line breaks"

Edge Add-ons CLI

To get your --edge-access-token, --edge-client-id, --edge-client-secret, --edge-access-token-url, follow this guide.

Example:

web-ext-deploy --edge-product-id="ProductID" --edge-access-token="accessToken value" --edge-client-id="clientId" --edge-client-secret="clientSecret" --edge-access-token-url="accessTokenUrl" --edge-zip="dist/some-zip-v{version}.zip" --edge-dev-changelog="Changelog for reviewers\nWith line breaks"

Note: Due to the way the Edge dashboard works, when an extension is being reviewed or its review has just been canceled, it will take about a minute until a cancellation will cause its state to change from "In review" to "In draft", after which the new version can be submitted. Therefore, expect for longer wait times if you run the tool on an extension you had just published/canceled.

Opera Add-ons CLI

Example:

web-ext-deploy --opera-package-id=123456 --opera-sessionid="sessionid_value" --opera-csrftoken="csrftoken_value" --opera-zip="dist/some-zip-v{version}.zip" --opera-changelog="Changelog\nWith line breaks"

Notes:

Node.js API method

ESM

import { deployChrome, deployFirefoxSubmissionApi, deployEdgePublishApi, deployOpera } from "web-ext-deploy";

Node.js API

Chrome Web Store API

deployChrome object Options:

To get your refreshToken, clientId, and clientSecret, follow this guide. Returns Promise<true> or throws an exception.

Firefox Publish API

deployFirefoxSubmissionApi object Options:

Get your jwtIssuer and jwtSecret from the Developer Hub. Returns Promise<true> or throws an exception.

Edge Publish API

deployEdgePublishApi object Options:

To get your accessToken, clientId, clientSecret, and accessTokenUrl, follow this guide. Returns Promise<true> or throws an exception.

Note: Due to the way the Edge dashboard works, when an extension is being reviewed or its review has just been canceled, it will take about a minute until a cancellation will cause its state to change from "In review" to "In draft", after which the new version can be submitted. Therefore, expect for longer wait times if you run the tool on an extension you had just published/canceled.

Opera Publish API

deployOpera object Options:

If you have a hard time obtaining the values of the cookies sessionid and csrftoken, you can run:

web-ext-deploy --get-cookies=opera

Returns Promise<true> or throws an exception.

Notes:

Examples:

import { deployChrome, deployFirefoxSubmissionApi, deployEdgePublishApi, deployOpera } from "web-ext-deploy";

deployChrome({
  extId: "ExtensionID",
  refreshToken: "refreshToken",
  clientId: "clientId",
  clientSecret: "clientSecret",
  zip: "dist/some-zip-v{version}.zip",
  verbose: false
}).catch(console.error);

deployFirefoxSubmissionApi({
  extId: "EXT_ID",
  jwtIssuer: "jwtIssuer",
  jwtSecret: "jwtSecret",
  zip: "dist/some-zip-v{version}.zip",
  zipSource: "dist/zip-source-v{version}.zip",
  changelog: "Some changes",
  devChangelog: "Changes for reviewers",
  verbose: false
}).catch(console.error);

deployEdgePublishApi({
  productId: "PRODUCT_ID",
  clientId: "clientId",
  clientSecret: "clientSecret",
  accessTokenUrl: "accessTokenUrl",
  accessToken: "accessToken",
  zip: "dist/some-zip-v{version}.zip",
  devChangelog: "Changes for reviewers",
  verbose: false
}).catch(console.error);

deployOpera({
  packageId: 123456,
  sessionid: "sessionid_value",
  csrftoken: "csrftoken_value",
  zip: "dist/some-zip-v{version}.zip",
  changelog: "Some changes",
  verbose: false
}).catch(console.error);