Skip to content

Commit

Permalink
use local-dev-lib for accessTokenForPersonalAccessKey
Browse files Browse the repository at this point in the history
  • Loading branch information
camden11 committed Dec 7, 2023
1 parent dc2ba97 commit eeb209f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/cli/commands/accounts/clean.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { logger } = require('@hubspot/cli-lib/logger');
const {
accessTokenForPersonalAccessKey,
} = require('@hubspot/cli-lib/personalAccessKey');
} = require('@hubspot/local-dev-lib/personalAccessKey');

const { trackCommandUsage } = require('../../lib/usageTracking');
const { i18n } = require('../../lib/lang');
Expand All @@ -21,6 +21,7 @@ const { getConfig, deleteAccount } = require('@hubspot/local-dev-lib/config');
const {
isSpecifiedHubSpotAuthError,
} = require('../../lib/errorHandlers/apiErrors');
const { logErrorInstance } = require('../lib/errorHandlers/standardErrors');

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

Expand Down Expand Up @@ -69,6 +70,8 @@ exports.handler = async options => {
})
) {
accountsToRemove.push(account);
} else {
logErrorInstance(error);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/lib/__tests__/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { getAccountConfig } = require('@hubspot/local-dev-lib/config');
const { getOauthManager } = require('@hubspot/cli-lib/oauth');
const {
accessTokenForPersonalAccessKey,
} = require('@hubspot/cli-lib/personalAccessKey');
} = require('@hubspot/local-dev-lib/personalAccessKey');

const { getAccountId } = require('../commonOpts');
const { validateAccount } = require('../validation');
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/lib/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ const { getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path');
const { getOauthManager } = require('@hubspot/cli-lib/oauth');
const {
accessTokenForPersonalAccessKey,
} = require('@hubspot/cli-lib/personalAccessKey');
} = require('@hubspot/local-dev-lib/personalAccessKey');
const { getCwd, getExt } = require('@hubspot/local-dev-lib/path');
const { getAccountId, getMode, setLogLevel } = require('./commonOpts');
const { logDebugInfo } = require('./debugInfo');
const fs = require('fs');
const path = require('path');
const { EXIT_CODES } = require('./enums/exitCodes');
const { logErrorInstance } = require('./errorHandlers/standardErrors');

async function loadAndValidateOptions(options, shouldValidateAccount = true) {
setLogLevel(options);
Expand Down Expand Up @@ -151,7 +152,7 @@ async function validateAccount(options) {
return false;
}
} catch (e) {
logger.error(e.message);
logErrorInstance(e);
return false;
}
} else if (!apiKey) {
Expand Down

0 comments on commit eeb209f

Please sign in to comment.