Skip to content

Commit

Permalink
this can be simplified since derivedAccountID is already the id
Browse files Browse the repository at this point in the history
  • Loading branch information
brandenrodgers committed Jan 10, 2025
1 parent aa7a06c commit 5dc138b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
4 changes: 0 additions & 4 deletions lib/__tests__/commonOpts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const {
const {
getAndLoadConfigIfNeeded,
getAccountConfig,
getAccountId,
loadConfigFromEnvironment,
} = require('@hubspot/local-dev-lib/config');
const { getCmsPublishMode } = require('../commonOpts');
Expand Down Expand Up @@ -40,7 +39,6 @@ describe('lib/commonOpts', () => {

afterEach(() => {
getAndLoadConfigIfNeeded.mockReset();
getAccountId.mockReset();
getAccountConfig.mockReset();
loadConfigFromEnvironment.mockReset();
});
Expand Down Expand Up @@ -68,7 +66,6 @@ describe('lib/commonOpts', () => {
getAndLoadConfigIfNeeded.mockReturnValue(
configWithDefaultCmsPublishMode
);
getAccountId.mockReturnValue(accounts.DEV);
getAccountConfig.mockReturnValue(devAccountConfig);
loadConfigFromEnvironment.mockReturnValue(undefined);
expect(getCmsPublishMode({ account: accounts.DEV })).toBe(
Expand All @@ -81,7 +78,6 @@ describe('lib/commonOpts', () => {
getAndLoadConfigIfNeeded.mockReturnValue(
configWithDefaultCmsPublishMode
);
getAccountId.mockReturnValue(accounts.PROD);
getAccountConfig.mockReturnValue(prodAccountConfig);
loadConfigFromEnvironment.mockReturnValue(undefined);
expect(getCmsPublishMode({ account: accounts.PROD })).toBe(
Expand Down
6 changes: 2 additions & 4 deletions lib/commonOpts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
} from '@hubspot/local-dev-lib/constants/files';
import { CmsPublishMode } from '@hubspot/local-dev-lib/types/Files';
import {
getAccountId,
getAccountConfig,
getAndLoadConfigIfNeeded,
} from '@hubspot/local-dev-lib/config';
Expand Down Expand Up @@ -114,9 +113,8 @@ export function getCmsPublishMode(
return cmsPublishMode.toLowerCase() as CmsPublishMode;
}
// 2. config[account].defaultCmsPublishMode
const accountId = getAccountId(options.derivedAccountId);
if (accountId) {
const accountConfig = getAccountConfig(accountId);
if (options.derivedAccountId) {
const accountConfig = getAccountConfig(options.derivedAccountId);
if (accountConfig && accountConfig.defaultCmsPublishMode) {
return accountConfig.defaultCmsPublishMode;
}
Expand Down

0 comments on commit 5dc138b

Please sign in to comment.