diff --git a/README.md b/README.md index 226bbd1694..8fbe3f8363 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,23 @@ webExtLogger.consoleStream.makeVerbose(); webExt.cmd.run({ sourceDir: './src' }, { shouldExitProgram: false }); ``` +You can also access the function for signing directly if you need to provide custom options, though the recommended path is via webExt.cmd.sign(): + +```js +import { signAddon } from 'web-ext/util/submit-addon'; + +signAddon({ + apiKey, + apiSecret, + amoBaseUrl: 'https://addons.mozilla.org/api/v5/', + id: 'extension-id@example.com', + xpiPath: pathToExtension, + savedUploadUuidPath: '.amo-upload-uuid', + channel: 'unlisted', + userAgentString: 'web-ext/0.2', +}); +``` + You can also disable the use of standard input: ```js diff --git a/package.json b/package.json index 35fe283439..790742d108 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "exports": { ".": "./index.js", "./util/adb": "./lib/util/adb.js", - "./util/logger": "./lib/util/logger.js" + "./util/logger": "./lib/util/logger.js", + "./util/submit-addon": "./lib/util/submit-addon.js" }, "files": [ "index.js", diff --git a/tests/fixtures/webext-as-library/helpers.js b/tests/fixtures/webext-as-library/helpers.js index 713e310a45..b3a420fae2 100644 --- a/tests/fixtures/webext-as-library/helpers.js +++ b/tests/fixtures/webext-as-library/helpers.js @@ -18,6 +18,11 @@ async function testModuleExportedUtils() { assert.equal(typeof utilLogger.createLogger, 'function'); assert.equal(typeof utilLogger.ConsoleStream?.constructor, 'function'); assert.ok(utilLogger.consoleStream instanceof utilLogger.ConsoleStream); + + const utilSubmitAddon = await import('web-ext/util/submit-addon'); // eslint-disable-line import/no-unresolved + assert.equal(typeof utilSubmitAddon.signAddon, 'function'); + assert.equal(typeof utilSubmitAddon.default, 'function'); + assert.equal(typeof utilSubmitAddon.JwtApiAuth, 'function'); } function assertImportedADB({expectLoaded}) {