Skip to content

Conversation

@camden11
Copy link
Contributor

@camden11 camden11 commented Jun 4, 2025

Description and Context

This PR makes many of the changes from #1529 without changing where projects are uploaded to:

  • Adds --projectAccount and --testingAccount flags
  • Removes support for --account flag from projects with platform version 2025.2 and above
  • Converts a few files to use the new lang object
  • Cleans up some of the account selection logic in commands/dev/index and unfiedFlow

Testing

  • Run hs project dev with the --projectAccount and --testingAccount flags and confirm testing account prompt is skipped and accounts are targeted as expected
  • Run hs project dev without the flags and confirm flow hasn't changed
  • Run projects with both old and new platform versions and make sure the correct flags are supported/unsupported

Who to Notify

@brandenrodgers @joe-yeager

Comment on lines 35 to 41
if (
(testingAccount && !projectAccount) ||
(projectAccount && !testingAccount)
) {
uiLogger.error(commands.project.dev.errors.invalidAccountFlags);
process.exit(EXIT_CODES.ERROR);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might be able to leverage yargs.implies for this. It also looks like there is an implies key that can be passed to yargs.option so we can make this args require each other

lang/en.ts Outdated
noRunnableComponents: (command: string) =>
`No supported components were found in this project. Run ${chalk.bold(command)} to see a list of available components and add one to your project.`,
noRunnableComponents: `No supported components were found in this project. Run ${uiCommandReference('hs project add')} to see a list of available components and add one to your project.`,
accountNotCombined: `Local development of Unified Apps is currently only compatible with accounts that are opted into the unified apps beta. Make sure that this account is opted in or switch accounts using ${uiCommandReference('hs account use')}.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: unified apps is capitalized in one usage, but not the other.

lang/en.ts Outdated
unsupportedAccountFlagLegacy:
'The --projectAccount and --testingAccount flags are not supported for projects with platform versions earlier than 2025.2.',
unsupportedAccountFlagV3:
'The --account flag is is not supported supported for projects with platform versions 2025.2 and newer. User --testingAccount and --projectAccount flags to specify accounts to use for local dev',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: User --testingAccount and --projectAccount should be Use --testingAccount and --projectAccount

'Projects cannot contain both private and public apps. Move your apps to separate projects before attempting local development.',
noRunnableComponents: (command: string) =>
`No supported components were found in this project. Run ${chalk.bold(command)} to see a list of available components and add one to your project.`,
noRunnableComponents: `No supported components were found in this project. Run ${uiCommandReference('hs project add')} to see a list of available components and add one to your project.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I believe we are calling components features to external users

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I wasn't aware of that, did that change recently? We have a lot of references to components in the CLI. Even the sample repo is called hubspot-project-components

If that is changing, I think it'd make more sense to go through and update all of the references at once

Copy link
Contributor

@joe-yeager joe-yeager Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's a fairly recent change (last few months).

Even the sample repo is called hubspot-project-components

It's fine in internal references or repo names (probably) I thinks it's just the user facing copy that UX wants us to align on ASAP. Follow up PR sounds reasonable, I'm not sure when they want us to have it switched over by.

Maybe @brandenrodgers knows more

accountUseCommand: uiCommandReference('hs account use'),
})
);
uiLogger.log('');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I believe we don't need to add these uiLogger.log('') to get a new line anymore. We could just prefix commands.project.dev.errors.accountNotCombined with a \n

@camden11 camden11 requested a review from joe-yeager June 5, 2025 16:18
@camden11 camden11 merged commit 8b6c017 into main Jun 5, 2025
1 check passed
@camden11 camden11 deleted the clean-up-unified-app-account-logic branch June 5, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants