From a0aea87c91b93046ba7d05616aa3a6dd93e7410f Mon Sep 17 00:00:00 2001 From: Branden Rodgers Date: Tue, 22 Apr 2025 13:58:55 -0400 Subject: [PATCH 1/3] Fix dev test account creation --- lib/__tests__/buildAccount.test.ts | 2 +- lib/buildAccount.ts | 20 +++++++++++++------- lib/localDev.ts | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/__tests__/buildAccount.test.ts b/lib/__tests__/buildAccount.test.ts index 54f446225..9a2f96921 100644 --- a/lib/__tests__/buildAccount.test.ts +++ b/lib/__tests__/buildAccount.test.ts @@ -177,7 +177,7 @@ describe('lib/buildAccount', () => { mockParentAccountConfig.env, 10 ); - expect(result).toEqual(mockDeveloperTestAccount); + expect(result).toEqual(mockDeveloperTestAccount.id); }); it('should throw error if account ID is not found', async () => { diff --git a/lib/buildAccount.ts b/lib/buildAccount.ts index 3118042ad..e46f91bce 100644 --- a/lib/buildAccount.ts +++ b/lib/buildAccount.ts @@ -24,7 +24,6 @@ import { debugError, logError } from './errorHandlers/index'; import { SANDBOX_API_TYPE_MAP, handleSandboxCreateError } from './sandboxes'; import { handleDeveloperTestAccountCreateError } from './developerTestAccounts'; import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts'; -import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts'; import { SandboxResponse } from '@hubspot/local-dev-lib/types/Sandbox'; import { SandboxAccountType } from '../types/Sandboxes'; @@ -91,7 +90,7 @@ export async function buildDeveloperTestAccount( parentAccountConfig: CLIAccount, env: Environment, portalLimit: number -): Promise { +): Promise { const i18nKey = 'lib.developerTestAccount.create.loading'; const id = getAccountIdentifier(parentAccountConfig); @@ -112,7 +111,8 @@ export async function buildDeveloperTestAccount( }), }); - let developerTestAccount: DeveloperTestAccount; + let developerTestAccountId: number; + let developerTestAccountPersonalAccessKey: string; try { const { data } = await createDeveloperTestAccount( @@ -120,12 +120,13 @@ export async function buildDeveloperTestAccount( testAccountName ); - developerTestAccount = data; + developerTestAccountId = data.id; + developerTestAccountPersonalAccessKey = data.personalAccessKey; SpinniesManager.succeed('buildDeveloperTestAccount', { text: i18n(`${i18nKey}.succeed`, { accountName: testAccountName, - accountId: developerTestAccount.id, + accountId: developerTestAccountId, }), }); } catch (e) { @@ -141,13 +142,18 @@ export async function buildDeveloperTestAccount( } try { - await saveAccountToConfig(developerTestAccount.id, testAccountName, env); + await saveAccountToConfig( + developerTestAccountId, + testAccountName, + env, + developerTestAccountPersonalAccessKey + ); } catch (err) { logError(err); throw err; } - return developerTestAccount; + return developerTestAccountId; } type SandboxAccount = SandboxResponse & { diff --git a/lib/localDev.ts b/lib/localDev.ts index dec2edad0..c8549a001 100644 --- a/lib/localDev.ts +++ b/lib/localDev.ts @@ -323,14 +323,14 @@ export async function createDeveloperTestAccountForLocalDev( accountId ); - const result = await buildDeveloperTestAccount( + const devTestAccountId = await buildDeveloperTestAccount( name, accountConfig, env, maxTestPortals ); - return result.id; + return devTestAccountId; } catch (err) { logError(err); process.exit(EXIT_CODES.ERROR); From 83031dc774934177ecd381b560530e1530ea50bd Mon Sep 17 00:00:00 2001 From: Branden Rodgers Date: Thu, 24 Apr 2025 16:46:10 -0400 Subject: [PATCH 2/3] bump LDL --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2671a38d1..9a2658604 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "Apache-2.0", "repository": "https://github.com/HubSpot/hubspot-cli", "dependencies": { - "@hubspot/local-dev-lib": "3.5.2", + "@hubspot/local-dev-lib": "3.5.3", "@hubspot/project-parsing-lib": "0.1.7", "@hubspot/serverless-dev-runtime": "7.0.2", "@hubspot/theme-preview-dev-server": "0.0.10", From 9582b41640c4313083145801858d27bcd078855c Mon Sep 17 00:00:00 2001 From: Branden Rodgers Date: Thu, 24 Apr 2025 16:47:55 -0400 Subject: [PATCH 3/3] just return result --- lib/localDev.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/localDev.ts b/lib/localDev.ts index c8549a001..50a2de833 100644 --- a/lib/localDev.ts +++ b/lib/localDev.ts @@ -323,14 +323,14 @@ export async function createDeveloperTestAccountForLocalDev( accountId ); - const devTestAccountId = await buildDeveloperTestAccount( + const result = await buildDeveloperTestAccount( name, accountConfig, env, maxTestPortals ); - return devTestAccountId; + return result; } catch (err) { logError(err); process.exit(EXIT_CODES.ERROR);