Skip to content

Commit

Permalink
Merge branch 'main' into br/p1-lib-util-tests-2
Browse files Browse the repository at this point in the history
  • Loading branch information
brandenrodgers committed Jan 22, 2025
2 parents 378409b + f936c67 commit cabcb29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions lang/en.lyaml
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,7 @@ en:
invalidCharacters: "The selected destination contains invalid characters. Please provide a new path and try again."
invalidTemplate: "[--template] Could not find template {{ template }}. Please choose an available template."
noProjectsInConfig: "Please ensure that there is a config.json file that contains a \"projects\" field."
missingConfigFileTemplateSource: "Please ensure that there is a config.json file in the repository used as the --template-source"
missingPropertiesInConfig: "Please ensure that each of the projects in your config.json file contain the following properties: [\"name\", \"label\", \"path\", \"insertPath\"]."
selectPublicAppPrompt:
selectAppIdMigrate: "[--appId] Choose an app under {{ accountName }} to migrate:"
Expand Down
16 changes: 11 additions & 5 deletions lib/prompts/createProjectPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ async function createTemplateOptions(
? DEFAULT_PROJECT_TEMPLATE_BRANCH
: githubRef;

const config = await fetchFileFromRepository<ProjectTemplateRepoConfig>(
templateSource || HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
'config.json',
branch
);
let config: ProjectTemplateRepoConfig;
try {
config = await fetchFileFromRepository<ProjectTemplateRepoConfig>(
templateSource || HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH,
'config.json',
branch
);
} catch (e) {
logger.error(i18n(`${i18nKey}.errors.missingConfigFileTemplateSource`));
process.exit(EXIT_CODES.ERROR);
}

if (!config || !config[PROJECT_COMPONENT_TYPES.PROJECTS]) {
logger.error(i18n(`${i18nKey}.errors.noProjectsInConfig`));
Expand Down

0 comments on commit cabcb29

Please sign in to comment.