Skip to content

Commit

Permalink
fix hs accounts clean
Browse files Browse the repository at this point in the history
  • Loading branch information
camden11 committed Dec 13, 2023
1 parent 3cd9a5a commit 45f6a49
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
9 changes: 3 additions & 6 deletions packages/cli/commands/accounts/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ const SpinniesManager = require('../../lib/SpinniesManager');
const { getConfig, deleteAccount } = require('@hubspot/local-dev-lib/config');
const {
isSpecifiedHubSpotAuthError,
} = require('../../lib/errorHandlers/apiErrors');
const { logErrorInstance } = require('../lib/errorHandlers/standardErrors');
} = require('@hubspot/local-dev-lib/errors/apiErrors');

const i18nKey = 'cli.commands.accounts.subcommands.clean';

Expand Down Expand Up @@ -59,19 +58,17 @@ exports.handler = async options => {
} catch (error) {
if (
isSpecifiedHubSpotAuthError(error, {
statusCode: 401,
status: 401,
category: 'INVALID_AUTHENTICATION',
subCategory: 'LocalDevAuthErrorType.PORTAL_NOT_ACTIVE',
}) ||
isSpecifiedHubSpotAuthError(error, {
statusCode: 404,
status: 404,
category: 'INVALID_AUTHENTICATION',
subCategory: 'LocalDevAuthErrorType.INVALID_PORTAL_ID',
})
) {
accountsToRemove.push(account);
} else {
logErrorInstance(error);
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions packages/cli/commands/accounts/info.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
const { logger } = require('@hubspot/cli-lib/logger');
const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
const {
getAccessToken,
} = require('@hubspot/local-dev-lib/personalAccessKey.js');
const { getAccessToken } = require('@hubspot/local-dev-lib/personalAccessKey');
const {
getAccountId,
addAccountOptions,
Expand Down
13 changes: 4 additions & 9 deletions packages/cli/commands/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const { trackAuthAction, trackCommandUsage } = require('../lib/usageTracking');
const { authenticateWithOauth } = require('../lib/oauth');
const { EXIT_CODES } = require('../lib/enums/exitCodes');
const { uiFeatureHighlight } = require('../lib/ui');
const { logErrorInstance } = require('../lib/errorHandlers/standardErrors');

const i18nKey = 'cli.commands.auth';

Expand Down Expand Up @@ -99,14 +98,10 @@ exports.handler = async options => {
case PERSONAL_ACCESS_KEY_AUTH_METHOD.value:
configData = await personalAccessKeyPrompt({ env, account });

try {
updatedConfig = await updateConfigWithPersonalAccessKey(
configData.personalAccesskey,
env
);
} catch (e) {
logErrorInstance(e);
}
updatedConfig = await updateConfigWithPersonalAccessKey(
configData.personalAccessKey,
env
);

if (!updatedConfig) {
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/commands/lint.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { lint } = require('@hubspot/local-dev-lib/validate');
const { lint } = require('@hubspot/local-dev-lib/cms/validate');
const { printHublValidationResult } = require('../lib/hublValidate');
const { logger } = require('@hubspot/cli-lib/logger');
const { logErrorInstance } = require('../lib/errorHandlers/standardErrors');
Expand Down

0 comments on commit 45f6a49

Please sign in to comment.