Skip to content

Commit

Permalink
Merge pull request #215 from HubSpot/update-default-mode-type
Browse files Browse the repository at this point in the history
chore: Update config mode to Mode type
  • Loading branch information
camden11 authored Nov 20, 2024
2 parents 9da6e5f + ad78178 commit 11f934a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config/CLIConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
import { CLIOptions } from '../types/CLIOptions';
import { ValueOf } from '../types/Utils';
import { i18n } from '../utils/lang';
import { Mode } from '../types/Files';

const i18nKey = 'config.cliConfiguration';

Expand Down Expand Up @@ -553,7 +554,7 @@ class _CLIConfiguration {
/**
* @throws {Error}
*/
updateDefaultMode(defaultMode: string): CLIConfig_NEW | null {
updateDefaultMode(defaultMode: Mode): CLIConfig_NEW | null {
if (!this.config) {
throw new Error(i18n(`${i18nKey}.errors.noConfigLoaded`));
}
Expand Down
2 changes: 1 addition & 1 deletion config/__tests__/CLIConfiguration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('config/CLIConfiguration', () => {
describe('updateDefaultMode()', () => {
it('throws when no config is loaded', () => {
expect(() => {
config.updateDefaultMode('newMode');
config.updateDefaultMode('draft');
}).toThrow();
});
});
Expand Down
5 changes: 3 additions & 2 deletions types/Config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { ENVIRONMENTS } from '../constants/environments';
import { CLIAccount_NEW, CLIAccount_DEPRECATED } from './Accounts';
import { Mode } from './Files';
import { ValueOf } from './Utils';

export interface CLIConfig_NEW {
accounts: Array<CLIAccount_NEW>;
allowUsageTracking?: boolean;
defaultAccount?: string | number;
defaultMode?: string;
defaultMode?: Mode;
httpTimeout?: number;
env?: Environment;
httpUseLocalhost?: boolean;
Expand All @@ -16,7 +17,7 @@ export interface CLIConfig_DEPRECATED {
portals: Array<CLIAccount_DEPRECATED>;
allowUsageTracking?: boolean;
defaultPortal?: string | number;
defaultMode?: string;
defaultMode?: Mode;
httpTimeout?: number;
env?: Environment;
httpUseLocalhost?: boolean;
Expand Down

0 comments on commit 11f934a

Please sign in to comment.