Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export submit-addon via package.json #3250

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,24 @@ 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.
NOTE: There is limited support for this API, 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: '[email protected]',
xpiPath: pathToExtension,
savedUploadUuidPath: '.amo-upload-uuid',
channel: 'unlisted',
userAgentString: 'web-ext/0.2',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kewisch I think it may be worth to tweak this example to suggest using a userAgentString that makes it clear which web-ext version they are using and maybe include a custom part to highlight this was sent by using signAddon internal method programmatically

});
```

You can also disable the use of standard input:

```js
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions tests/fixtures/webext-as-library/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}) {
Expand Down