Skip to content
Merged
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ webExt.cmd.sign({
userAgentString: 'YOUR-CUSTOM-USERAGENT',
apiKey,
apiSecret,
amoBaseUrl: 'https://addons.mozilla.org/api/v5/',
sourceDir: ...,
channel: 'unlisted',
...
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path';
import defaultBuilder from './build.js';
import { isErrorWithCode, UsageError, WebExtError } from '../errors.js';
import { prepareArtifactsDir } from '../util/artifacts.js';
import { AMO_BASE_URL } from '../util/constants.js';
import { createLogger } from '../util/logger.js';
import getValidatedManifest, { getManifestId } from '../util/manifest.js';
import {
Expand All @@ -20,7 +21,7 @@ export const uploadUuidFile = '.amo-upload-uuid';

export default function sign(
{
amoBaseUrl,
amoBaseUrl = AMO_BASE_URL,
apiKey,
apiProxy,
apiSecret,
Expand Down
3 changes: 2 additions & 1 deletion src/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import {
loadJSConfigFile as defaultLoadJSConfigFile,
applyConfigToArgv as defaultApplyConfigToArgv,
} from './config.js';
import { AMO_BASE_URL } from './util/constants.js';

const log = createLogger(import.meta.url);
const envPrefix = 'WEB_EXT';
// Default to "development" (the value actually assigned will be interpolated
// at build time by scripts/babel-plugin-inline-environment-variables.cjs).
const defaultGlobalEnv = process.env.WEBEXT_BUILD_ENV || 'development';

export const AMO_BASE_URL = 'https://addons.mozilla.org/api/v5/';
export { AMO_BASE_URL };

/*
* The command line program.
Expand Down
5 changes: 5 additions & 0 deletions src/util/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Shared constants that both the command line interface and the commands
// themselves need. Keeping them here avoids importing the CLI program (and
// its dependencies) from a command module.

export const AMO_BASE_URL = 'https://addons.mozilla.org/api/v5/';
11 changes: 11 additions & 0 deletions tests/unit/test-cmd/test.sign.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ describe('sign', () => {
},
));

it('defaults the AMO base URL when it is not passed in', () =>
withTempDir(async (tmpDir) => {
const stubs = getStubs();
const signingConfig = { ...stubs.signingConfig };
delete signingConfig.amoBaseUrl;
await sign(tmpDir, { ...stubs, signingConfig });
sinon.assert.calledWithMatch(stubs.signingOptions.submitAddon, {
amoBaseUrl: AMO_BASE_URL,
});
}));

it('requires a channel for submission API', () =>
withTempDir(async (tmpDir) => {
const stubs = getStubs();
Expand Down
Loading