Skip to content

Commit

Permalink
feat: Export submit-addon via package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
kewisch committed Sep 14, 2024
1 parent fccbcf0 commit 564fcd8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: '[email protected]',
xpiPath: pathToExtension,
savedUploadUuidPath: '.amo-upload-uuid',
channel: 'unlisted',
userAgentString: 'web-ext/0.2',
});
```

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

0 comments on commit 564fcd8

Please sign in to comment.