Skip to content

Commit

Permalink
Merge branch 'next' into cp/convert-ts-lib-3
Browse files Browse the repository at this point in the history
  • Loading branch information
camden11 committed Dec 11, 2024
2 parents 5b559df + e34c6dc commit 376a985
Show file tree
Hide file tree
Showing 26 changed files with 372 additions and 297 deletions.
5 changes: 2 additions & 3 deletions commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ const ALLOWED_AUTH_METHODS = [
OAUTH_AUTH_METHOD.value,
PERSONAL_ACCESS_KEY_AUTH_METHOD.value,
];
const SUPPORTED_AUTHENTICATION_PROTOCOLS_TEXT = commaSeparatedValues(
ALLOWED_AUTH_METHODS
);
const SUPPORTED_AUTHENTICATION_PROTOCOLS_TEXT =
commaSeparatedValues(ALLOWED_AUTH_METHODS);

exports.command = 'auth';
exports.describe = i18n(`${i18nKey}.describe`, {
Expand Down
5 changes: 1 addition & 4 deletions commands/filemanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ exports.command = 'filemanager';
exports.describe = i18n(`${i18nKey}.describe`);

exports.builder = yargs => {
yargs
.command(upload)
.command(fetch)
.demandCommand(1, '');
yargs.command(upload).command(fetch).demandCommand(1, '');

return yargs;
};
6 changes: 1 addition & 5 deletions commands/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ exports.describe = i18n(`${i18nKey}.describe`);

exports.builder = yargs => {
addGlobalOptions(yargs);
yargs
.command(list)
.command(deploy)
.command(server)
.demandCommand(1, '');
yargs.command(list).command(deploy).command(server).demandCommand(1, '');

return yargs;
};
5 changes: 1 addition & 4 deletions commands/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ exports.describe = uiBetaTag(i18n(`${i18nKey}.describe`), false);
exports.builder = yargs => {
addGlobalOptions(yargs);

yargs
.command(create)
.command(del)
.demandCommand(1, '');
yargs.command(create).command(del).demandCommand(1, '');

return yargs;
};
9 changes: 2 additions & 7 deletions commands/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ exports.command = 'watch [src] [dest]';
exports.describe = i18n(`${i18nKey}.describe`);

exports.handler = async options => {
const {
remove,
initialUpload,
disableInitial,
notify,
derivedAccountId,
} = options;
const { remove, initialUpload, disableInitial, notify, derivedAccountId } =
options;

await loadAndValidateOptions(options);

Expand Down
2 changes: 2 additions & 0 deletions lang/en.lyaml
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,7 @@ en:
developerTestAccountLimit: "Your account reached the limit of {{ limit }} developer test accounts."
confirmDefaultAccount: "Continue testing on {{#bold}}{{ accountName }} ({{ accountType }}){{/bold}}? (Y/n)"
confirmUseExistingDeveloperTestAccount: "Continue with {{ accountName }}? This account isn't currently connected to the HubSpot CLI. By continuing, you'll be prompted to generate a personal access key and connect it."
noAccountId: "No account ID found for the selected account. Please try again."
projectLogsPrompt:
functionName: "[--function] Select function in {{#bold}}{{projectName}}{{/bold}} project"
setAsDefaultAccountPrompt:
Expand Down Expand Up @@ -1307,6 +1308,7 @@ en:
selectAppIdMigrate: "[--appId] Choose an app under {{ accountName }} to migrate:"
selectAppIdClone: "[--appId] Choose an app under {{ accountName }} to clone:"
errors:
noAccountId: "An account ID is required to select an app."
noAppsMigration: "{{#bold}}No apps to migrate{{/bold}}"
noAppsClone: "{{#bold}}No apps to clone{{/bold}}"
noAppsMigrationMessage: "The selected developer account {{#bold}}{{ accountName }}{{/bold}} doesn't have any apps that can be migrated to the projects framework."
Expand Down
8 changes: 3 additions & 5 deletions lib/LocalDevManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,8 @@ class LocalDevManager {
}

async checkPublicAppInstallation() {
const {
isInstalledWithScopeGroups,
previouslyAuthorizedScopeGroups,
} = await this.getActiveAppInstallationData();
const { isInstalledWithScopeGroups, previouslyAuthorizedScopeGroups } =
await this.getActiveAppInstallationData();

const isReinstall = previouslyAuthorizedScopeGroups.length > 0;

Expand Down Expand Up @@ -364,7 +362,7 @@ class LocalDevManager {
monitorConsoleOutput() {
const originalStdoutWrite = process.stdout.write.bind(process.stdout);

process.stdout.write = function(chunk, encoding, callback) {
process.stdout.write = function (chunk, encoding, callback) {
// Reset the most recently logged warning
if (
this.mostRecentUploadWarning &&
Expand Down
5 changes: 1 addition & 4 deletions lib/buildAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ async function saveAccountToConfig({

let validName = updatedConfig.name;
if (!updatedConfig.name) {
const nameForConfig = accountName
.toLowerCase()
.split(' ')
.join('-');
const nameForConfig = accountName.toLowerCase().split(' ').join('-');
validName = nameForConfig;
const invalidAccountName = accountNameExistsInConfig(nameForConfig);
if (invalidAccountName) {
Expand Down
3 changes: 2 additions & 1 deletion lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH = 'HubSpot/hubspot-project-components' as const;
export const HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH =
'HubSpot/hubspot-project-components' as const;
export const DEFAULT_PROJECT_TEMPLATE_BRANCH = 'main' as const;

export const FEEDBACK_INTERVAL = 10 as const;
Expand Down
12 changes: 6 additions & 6 deletions lib/interpolation.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import chalk from 'chalk';

export const helpers: { [key: string]: (stringValue: string) => string } = {
bold: function(stringValue: string): string {
bold: function (stringValue: string): string {
return chalk.bold(stringValue);
},
yellow: function(stringValue: string): string {
yellow: function (stringValue: string): string {
return chalk.reset.yellow(stringValue);
},
green: function(stringValue: string): string {
green: function (stringValue: string): string {
return chalk.reset.green(stringValue);
},
red: function(stringValue: string): string {
red: function (stringValue: string): string {
return chalk.reset.red(stringValue);
},
cyan: function(stringValue: string): string {
cyan: function (stringValue: string): string {
return chalk.cyan(stringValue);
},
orange: function(stringValue: string): string {
orange: function (stringValue: string): string {
return chalk.hex('#FC9900')(stringValue);
},
};
Expand Down
10 changes: 4 additions & 6 deletions lib/localDev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,8 @@ const createDeveloperTestAccountForLocalDev = async (
let currentPortalCount = 0;
let maxTestPortals = 10;
try {
const validateResult = await validateDevTestAccountUsageLimits(
accountConfig
);
const validateResult =
await validateDevTestAccountUsageLimits(accountConfig);
if (validateResult) {
currentPortalCount = validateResult.results
? validateResult.results.length
Expand Down Expand Up @@ -306,9 +305,8 @@ const createDeveloperTestAccountForLocalDev = async (

// Prompt user to confirm usage of an existing developer test account that is not currently in the config
const useExistingDevTestAccount = async (env, account) => {
const useExistingDevTestAcct = await confirmUseExistingDeveloperTestAccountPrompt(
account
);
const useExistingDevTestAcct =
await confirmUseExistingDeveloperTestAccountPrompt(account);
if (!useExistingDevTestAcct) {
logger.log('');
logger.log(
Expand Down
2 changes: 1 addition & 1 deletion lib/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ const handleProjectUpload = async (
const archive = archiver('zip');

const result = new Promise(resolve =>
output.on('close', async function() {
output.on('close', async function () {
let uploadResult = {};

logger.debug(
Expand Down
2 changes: 1 addition & 1 deletion lib/prompts/accountNamePrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type AccountNamePromptResponse = {
};

export function getCliAccountNamePromptConfig(
defaultName: string
defaultName?: string
): PromptConfig<AccountNamePromptResponse> {
return {
name: 'name',
Expand Down
4 changes: 2 additions & 2 deletions lib/prompts/createTemplatePrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { PromptChoices, PromptConfig } from '../../types/prompts';

const i18nKey = 'lib.prompts.createTemplatePrompt';

const templateTypeChoices: PromptChoices = [
const templateTypeChoices = [
{ name: 'page', value: 'page-template' },
{ name: 'email', value: 'email-template' },
{ name: 'partial', value: 'partial' },
{ name: 'global partial', value: 'global-partial' },
{ name: 'blog listing', value: 'blog-listing-template' },
{ name: 'blog post', value: 'blog-post-template' },
{ name: 'search results', value: 'search-template' },
] as const;
] satisfies PromptChoices;

interface CreateTemplatePromptResponse {
templateType: typeof templateTypeChoices[number]['value'];
Expand Down
Loading

0 comments on commit 376a985

Please sign in to comment.